mkab 0 Light Poster

Hello everyone. I need some help on a java project. I'm to develop a human genetic(family) tree.

This is the subject:

Each human cell contains 23 pairs of chromosomes numbered from 1 to 22,and a pair of sex chromosomes: XX in females and XY in man. During fertilization, the 22 chromosomes + (X or Y) of the man merges with the 22 + X chromosome of the woman. This results in 22 pairs of chromosomes + (X or Y) in the cell that will form the future baby.
The 23rd chromosome transmitted by the father (an X or Y) will determine the sex of the child (XX for a girl, XY for a boy).

Each chromosome carries many genes (encoding almost everything, a characteristic morphological, physiological, behavioral). Due to pairs of chromosomes, the genetic information is duplicated (except for parts of the sex chromosomes). Each copy of a gene is called an allele. *So that means for example, if the a gene is responsible for the color of an eye, then the allele is blue*.

The genetic information expressed as a consequence of the combined expression of alleles being present. A dominant allele is always expressed in the genome of its bearer. However, if information from one allele is not expressed
when a dominant allele of the same gene is present, it is a recessive allele. The peculiarity of the recessive allele of a gene is that it can be present in the genome and transmitted over several generations without it is expressed in the phenotype
its bearers. If there is no dominant allele, two copies of the gene have the same recessive allele (homozygous recessive) then the recessive character is expressed.
Through the use of family tree, it is possible to determine the expression of a gene within a family.

The program should be able to do the following:

-generate a simplified version relied on 23 chromosomes and allow the user to place genes on chromosomes then simulate replication, mitosis, meiosis and fusion of the chromosomes and display the locations of genes on the resulting cells.

-allow to draw genealogical trees and deduced probabilities (or certainty) on the expression of genes on a person's family tree.


So far so good i've created a class Gene and a class Chromosomes.
Next, i thought about creating a class "Parent" for example and creating 23 chromosomes in it. But before doing that i want to make the 23rd chromosome different for a man/woman. Then simulates replication, crossovers, mitosis etc..
I dont know if i'm on the right track. I also don't know how to specify that a particular allele is recessive or dominant. For the moment my classes only act in a random manner(well because i made them do).

PS: I attached a file that contains the theme of the project but it's in french. I thought it might be of some help since it contains some drawings. Sorry if the post is long.

Thanks

Class Gene

/**
 * 
 */
package project_try;

import java.util.Random;

/**
 * @author mkab
 * @version 1.0
 */
public class Gene {
	
	private String allele;
	
	public Gene(){
	}
	public Gene(String allele){
		this.allele = allele;
	}
	
	/**
	 * radomly selects a trait from trait1 or trait2 and returns a new Gene with that trait
	 * @param trait1
	 * @param trait2
	 * @return 
	 * @return a new Gene
	 */
	public Gene randomAllele(String trait1, String trait2){
	String allele = null;
	Random rand = new Random();
	int i = rand.nextInt(2);// generate between 0 and 2: only 2 possibilities: 0 or 1
	switch(i){
	case 0:
		allele = trait1;
		break;
	case 1:
		allele = trait2;
		break;
	}
	//this.setAllele(allele);
	return new Gene(allele);
}

	/**
	 * @param allele the allele to set
	 */
	public void setAllele(String allele) {
		this.allele = allele;
	}

	/**
	 * @return the allele
	 */
	public String getAllele() {
		return allele;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "Gene [allele=" + allele +"]";
	}
}

Class Chromosome

/**
 * 
 */
package project_try;

import java.util.ArrayList;

/**
 * Class that creates a chromosome
 * @author mkab
 * @version 1.0
 */
public class Chromosome implements Cloneable {

	/**
	 * 
	 */
	private ArrayList<Gene> genes;// the user can put as mant genes as possible on the chromosome
	String trait1, trait2;// traits of an allele

	public Chromosome(){

	}
	public Chromosome(String trait1, String trait2) {
		genes = new ArrayList<Gene>();
		this.trait1 = trait1;
		this.trait2 = trait2;
	}

	public Chromosome(String trait1) {
		genes = new ArrayList<Gene>();
		this.trait1 = trait1;
	}

	public void placeGene(){
		genes.add(new Gene().randomAllele(trait1, trait2));
		/*for(int i =0; i< genes.size(); i++){
			genes[i] = new Gene().getRandomAllele(trait1, trait2);
		}*/
	}

	/**
	 * for the replication of a chromosome
	 */
	@Override
	public Object clone()throws CloneNotSupportedException{
		Chromosome c;
		c = (Chromosome) super.clone();
		return c;
	}
	/**
	 * @return the genes
	 */
	public ArrayList<Gene> getGenes() {
		return genes;
	}

	/**
	 * @param genes the genes to set
	 */
	public void setGenes(ArrayList<Gene> genes) {
		this.genes = genes;
	}

	/**
	 * @return the trait1
	 */
	public String getTrait1() {
		return trait1;
	}

	/**
	 * @param trait1 the trait1 to set
	 */
	public void setTrait1(String trait1) {
		this.trait1 = trait1;
	}

	/**
	 * @return the trait2
	 */
	public String getTrait2() {
		return trait2;
	}

	/**
	 * @param trait2 the trait2 to set
	 */
	public void setTrait2(String trait2) {
		this.trait2 = trait2;
	}
        /* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "Chromosome [genes=" + genes + ", trait1=" + trait1
		+ ", trait2=" + trait2 + "]";
	}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.