Class GeneLocus
java.lang.Object
com.hexagram2021.chromosomelib.common.gene_locus.GeneLocus
- Direct Known Subclasses:
GeneLocus.HomologousGeneLocus,GeneLocus.LeftGeneLocus,GeneLocus.RightGeneLocus
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionnet.minecraft.core.Holder<Chromosome>The chromosome that this locus belongs to.net.minecraft.core.HolderSet<Gene>The allele located at this locus.final doubleThe possibility of this locus to cross over.final doubleThe possibility of this locus to mutate. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedGeneLocus(double possibilityOfMutation, double possibilityOfCrossingOver) -
Method Summary
Modifier and TypeMethodDescriptionstatic net.minecraft.core.Holder<Gene>getRandomGene(net.minecraft.core.Holder<GeneLocus> geneLocus, IWeightedGeneList.Context context) Get a random gene from the gene locus.homologous(int index, double possibilityOfMutation, double possibilityOfCrossingOver) Create a gene locus that is homologous to both chromosomes (e.g.homologous(int leftIndex, int rightIndex, double possibilityOfMutation, double possibilityOfCrossingOver) Create a gene locus that is homologous to both chromosomes, but is at different position of them (e.g.abstract intindex(ChromosomeType chromosomeType) static GeneLocus.LeftGeneLocusleft(int index, double possibilityOfMutation, double possibilityOfCrossingOver) Create a gene locus only in the left chromosome (e.g.static GeneLocus.RightGeneLocusright(int index, double possibilityOfMutation, double possibilityOfCrossingOver) Create a gene locus only in the right chromosome (e.g.static voidsetGeneFrequency(Map<net.minecraft.core.Holder<GeneLocus>, IWeightedGeneList> geneFrequency)
-
Field Details
-
chromosome
The chromosome that this locus belongs to. -
genes
The allele located at this locus. -
possibilityOfMutation
public final double possibilityOfMutationThe possibility of this locus to mutate. -
possibilityOfCrossingOver
public final double possibilityOfCrossingOverThe possibility of this locus to cross over.
-
-
Constructor Details
-
GeneLocus
protected GeneLocus(double possibilityOfMutation, double possibilityOfCrossingOver)
-
-
Method Details
-
index
- Parameters:
chromosomeType- left or right.
-
left
public static GeneLocus.LeftGeneLocus left(int index, double possibilityOfMutation, double possibilityOfCrossingOver) Create a gene locus only in the left chromosome (e.g. X sex chromosome, Z sex chromosome).- Parameters:
index- the index of this locus in the chromosome.possibilityOfMutation- the possibility of this locus to mutate.possibilityOfCrossingOver- the possibility of this locus to cross over.- Returns:
- the gene locus.
-
right
public static GeneLocus.RightGeneLocus right(int index, double possibilityOfMutation, double possibilityOfCrossingOver) Create a gene locus only in the right chromosome (e.g. Y sex chromosome, W sex chromosome).- Parameters:
index- the index of this locus in the chromosome.possibilityOfMutation- the possibility of this locus to mutate.possibilityOfCrossingOver- the possibility of this locus to cross over.- Returns:
- the gene locus.
-
homologous
public static GeneLocus.HomologousGeneLocus homologous(int index, double possibilityOfMutation, double possibilityOfCrossingOver) Create a gene locus that is homologous to both chromosomes (e.g. most autosomes).- Parameters:
index- the index of this locus in the chromosome.possibilityOfMutation- the possibility of this locus to mutate.possibilityOfCrossingOver- the possibility of this locus to cross over.- Returns:
- the gene locus.
-
homologous
public static GeneLocus.HomologousGeneLocus homologous(int leftIndex, int rightIndex, double possibilityOfMutation, double possibilityOfCrossingOver) Create a gene locus that is homologous to both chromosomes, but is at different position of them (e.g. homologous segments of sex chromosomes).- Parameters:
leftIndex- the left index of this locus in the chromosome.rightIndex- the right index of this locus in the chromosome.possibilityOfMutation- the possibility of this locus to mutate.possibilityOfCrossingOver- the possibility of this locus to cross over.- Returns:
- the gene locus.
-
setGeneFrequency
@Internal public static void setGeneFrequency(Map<net.minecraft.core.Holder<GeneLocus>, IWeightedGeneList> geneFrequency) -
getRandomGene
public static net.minecraft.core.Holder<Gene> getRandomGene(net.minecraft.core.Holder<GeneLocus> geneLocus, IWeightedGeneList.Context context) Get a random gene from the gene locus.- Parameters:
geneLocus- the gene locus.- Returns:
- a random gene from the gene locus.
-