[Biojava-l] (no subject)

Arnaud arnaud.verbaere@univ-pau.fr
Tue, 19 Mar 2002 18:57:48 +0100


--=====================_41953479==_
Content-Type: text/plain; charset="us-ascii"; format=flowed

Hello everybody,

As you said me there wasn't anything like an alleles class currently in 
biojava, I wrote one.

I also did changes to Class SimpleModeleBio of my late mail. It is aimed to 
simulate the evolution of a population.

I don't know if it could be usefull now.

Arnaud.

PS : I hope you won't have problem with my files originating from a Windows 
workstation. 
--=====================_41953479==_
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: attachment; filename="Substrats.java"

/*
 *                    BioJava development code
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  If you do not have a copy,
 * see:
 *
 *      http://www.gnu.org/copyleft/lesser.html
 *
 * Copyright for this code is held jointly by the individual
 * authors.  These should be listed in @author doc comments.
 *
 * For more information on the BioJava project and its aims,
 * or to join the biojava-l mailing list, visit the home page
 * at:
 *
 *      http://www.biojava.org/
 *
 */  
 
public class Substrats{
/**
 * Substrats is a class that creates and describes a biochemical reaction.
 * Its features are NomSubstrat, NomProduit, Quantite, Produit and Stoec.
 * @author <a href="mailto:arnaud.verbaere@univ-pau.fr">A Verbaere</a>
 */

public String NomSubstrat;
/** feature NomSubstrat is a string for the substrate name.*/

public String NomProduit;
/** feature NomProduit is a string for the corresponding product name.*/

public double Quantite;
/**
 * feature Quantite is a real for the substrate quantity (no 
 * specified unit).
 */
public double Produit;
/** feature Produit is a real for the product quantity.*/

public double Stoech;
/** real feature Stoech stands for a stoechiometric rate. */

public static void main(String[] args) 
{
}

public void Initialiser(String Ns, String Np, int Nb, double st){
/** Initialiser method aimed to initialize the different features. */

NomSubstrat=Ns;
NomProduit=Np;
Quantite=Nb;
Stoech=st;
}

public void Ajouter(double Nb){
/** Ajouter method adds a real number to the Quantite feature. */

Quantite=Quantite+Nb;
}

public void Consommer(double Nb){
/** Consommer method is aimed to substract a real number
 * to the Quantite feature and to initialize the Produit feature.
 */
 
Quantite=Quantite-Nb;
Produit=(Nb*Stoech);
}

}

--=====================_41953479==_
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: attachment; filename="Especes.java"

/*
 *                    BioJava development code
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  If you do not have a copy,
 * see:
 *
 *      http://www.gnu.org/copyleft/lesser.html
 *
 * Copyright for this code is held jointly by the individual
 * authors.  These should be listed in @author doc comments.
 *
 * For more information on the BioJava project and its aims,
 * or to join the biojava-l mailing list, visit the home page
 * at:
 *
 *      http://www.biojava.org/
 *
 */   
public class Especes{

/**
 * Especes is a class that creates and describes a species by
 * a genus and a species name (feature).
 * @author <a href="mailto:arnaud.verbaere@univ-pau.fr">A Verbaere</a>
 */

public String Genre;
/** feature Genre is a string for a Genus name*/
public String sp;
/** feature sp is a string for a species name*/

public static void main(String[] args) 
{
}

public void DonnerUnNom(String NomGenre, String NomEspece)
/** to initialize the Genre and sp features*/
{
Genre=NomGenre;
sp=NomEspece;
}

}

--=====================_41953479==_
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: attachment; filename="SimpleModeleBio.java"

/*
 *                    BioJava development code
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  If you do not have a copy,
 * see:
 *
 *      http://www.gnu.org/copyleft/lesser.html
 *
 * Copyright for this code is held jointly by the individual
 * authors.  These should be listed in @author doc comments.
 *
 * For more information on the BioJava project and its aims,
 * or to join the biojava-l mailing list, visit the home page
 * at:
 *
 *      http://www.biojava.org/
 *
 */  

class  SimpleModeleBio
{
/**
 * SimpleModelebio is a demo class that implements a diploid model
 * with a pair of alleles of an enzyme. One of the alleles gives
 * a normal activity, the other, a reduced activity. the growth of
 * virtual populations can thus be calculated.
 * The populations are considered at the Hardy-Weinberg equilibrium.
 *
 * @author <a href="mailto:arnaud.verbaere@univ-pau.fr">A Verbaere</a>
 */
static String NomGenre;
static String NomEspece;
static double u1;
static double v1;
static double w1;
static double T;

public static void main(String[] args) 
{
/* for instance*/
NomGenre="Drosophila";
NomEspece="melanogaster";

SimplePopulations population=new SimplePopulations();
population.InitialiserNom(NomGenre,NomEspece);
population.Initialiser(20,20,445);

Substrats substrat=new Substrats();
substrat.Initialiser("Substance","produit",1000,2);

Alleles allozyme=new Alleles();
allozyme.DonnerUnNom("enzyme");
allozyme.DonnerDesNoms("R","l");
allozyme.Initialiser(1,0.65,0.85);

for (int i=0; i<20; i++){
population.Calculer();
u1=population.u*allozyme.fA1;
v1=population.v*allozyme.fAa;
w1=population.w*allozyme.fA2;
T=u1+v1+w1;

population.Initialiser((u1/T)*population.N,(v1/T)*population.N,(w1)*population.N);

System.out.println(population.NbA1A1+":"+population.NbA1A2+":"+population.NbA2A2);
}
}

}

--=====================_41953479==_
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: attachment; filename="SimplePopulations.java"

/*
 *                    BioJava development code
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  If you do not have a copy,
 * see:
 *
 *      http://www.gnu.org/copyleft/lesser.html
 *
 * Copyright for this code is held jointly by the individual
 * authors.  These should be listed in @author doc comments.
 *
 * For more information on the BioJava project and its aims,
 * or to join the biojava-l mailing list, visit the home page
 * at:
 *
 *      http://www.biojava.org/
 *
 */   
public class SimplePopulations{

/**
 * SimplePopulations is a class that describes a population with
 * one locus and two alleles.
 * @author <a href="mailto:arnaud.verbaere@univ-pau.fr">A Verbaere</a>
 */

public Especes espece;
/** feature espece gives a name to the population.*/
public double N;
/** N is the number of individuals of the population.*/
public double NbA1A1;
public double NbA1A2;
public double NbA2A2;
/** feature NbA1A1, NbA1A2, NbA2A2 are numbers of individuals 
* of the homozygous A1A1, A2A2 and heterozygous A1A2 genotypes*/
public double u;
public double v;
public double w;
/** u, v and w are the genotypic frequencies.*/
public double p;
public double q;
/** p and q are the alleleic frequencies.
* p is associated with the A1 allele.
* q is associated with the A2 allele.*/

public static void main(String[] args) 
{
}

public void InitialiserNom(String NomGenre, String NomEspece)
/** to initialize the Genre and species names features*/
{
Especes espece=new Especes();
espece.DonnerUnNom(NomGenre, NomEspece);
}

public void Initialiser(double Nb1, double Nb2, double Nb3)
/** to initialize the Genre, sp and Population features*/
{
NbA1A1=Nb1;
NbA1A2=Nb2;
NbA2A2=Nb3;
}

public void Calculer(){
/** to calculate the size of the population.*/
N=NbA1A1+NbA1A2+NbA2A2;
/** to calculate the genotypic frequencies.*/
u=NbA1A1/N;
v=NbA1A2/N;
w=NbA2A2/N;
/** to calculate the allelic frequencies. */
p=u+v/2;
q=v+w/2;
}

}

--=====================_41953479==_
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: attachment; filename="Alleles.java"

/*
 *                    BioJava development code
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  If you do not have a copy,
 * see:
 *
 *      http://www.gnu.org/copyleft/lesser.html
 *
 * Copyright for this code is held jointly by the individual
 * authors.  These should be listed in @author doc comments.
 *
 * For more information on the BioJava project and its aims,
 * or to join the biojava-l mailing list, visit the home page
 * at:
 *
 *      http://www.biojava.org/
 *
 */   
public class Alleles{

/**
 * Alleles is a class that creates and describes a alleles sytem.
 * For a population thre will be a variancy around an average value for a character.
 * There is a locus with two alleles which homozygouses influence the value of the character 
 * one in a postive and the other in a negative way.
 * @author <a href="mailto:arnaud.verbaere@univ-pau.fr">A Verbaere</a>
 */

public String Nom;
/** String feature Nom is the name of the locus.*/
public String Allele1;
/** feature Allele1 is a string for the first allele name.*/
public String Allele2;
/** Allele2 is a string for the second allele name.*/
public double fA1;
/** feature fA1 is a real number for the fitness of the AA homozygous.*/
public double fAa;
/** feature fAa is the fitness of the Aa heterozygous.*/
public double fA2;
/** feature fA2 is the fitness of the aa homozygous.*/


public static void main(String[] args) 
{
}

public void DonnerUnNom(String NomLocus){
Nom=NomLocus;
}

public void DonnerDesNoms(String NomAllele1, String NomAllele2)
/** to give a name to the alleles.*/
{
Allele1=NomAllele1;
Allele2=NomAllele2;
}

public void Initialiser(double Nb1, double Nb2, double Nb3)
/** to initialize the fA1, FAa and fA2 features*/
{
fA1=Nb1;
fAa=Nb2;
fA2=Nb3;
}

}

--=====================_41953479==_
Content-Type: text/plain; charset="us-ascii"; format=flowed


--=====================_41953479==_--