Search in sources :

Example 1 with Genotype

use of org.nmdp.gl.Genotype in project ImmunogeneticDataTools by nmdp-bioinformatics.

the class LinkageDisequilibriumGenotypeList method decomposeMug.

private void decomposeMug() {
    String locusVal = null;
    Locus locus = null;
    HashMap<String, Locus> locusMap = new HashMap<String, Locus>();
    List<GenotypeList> genotypeLists = mug.getGenotypeLists();
    for (GenotypeList gl : genotypeLists) {
        List<Genotype> genotypes = gl.getGenotypes();
        for (Genotype genotype : genotypes) {
            List<Haplotype> haplotypes = genotype.getHaplotypes();
            for (Haplotype haplotype : haplotypes) {
                List<AlleleList> alleleLists = haplotype.getAlleleLists();
                for (AlleleList alleleList : alleleLists) {
                    List<Allele> alleles = alleleList.getAlleles();
                    List<String> alleleStrings = new ArrayList<String>();
                    for (Allele allele : alleles) {
                        alleleStrings.add(allele.getGlstring());
                        locusVal = allele.getLocus().toString();
                    }
                    if (locusMap.containsKey(locusVal)) {
                        locus = locusMap.get(locusVal);
                    } else {
                        locus = Locus.normalizeLocus(Locus.lookup(locusVal));
                        locusMap.put(locusVal, locus);
                    }
                    setAlleles(locus, alleleStrings);
                }
            }
        }
    }
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) MultilocusUnphasedGenotype(org.nmdp.gl.MultilocusUnphasedGenotype) Genotype(org.nmdp.gl.Genotype) AlleleList(org.nmdp.gl.AlleleList) GenotypeList(org.nmdp.gl.GenotypeList) Allele(org.nmdp.gl.Allele) Locus(org.dash.valid.Locus) MultiLocusHaplotype(org.dash.valid.gl.haplo.MultiLocusHaplotype) SingleLocusHaplotype(org.dash.valid.gl.haplo.SingleLocusHaplotype) Haplotype(org.nmdp.gl.Haplotype)

Aggregations

ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Locus (org.dash.valid.Locus)1 MultiLocusHaplotype (org.dash.valid.gl.haplo.MultiLocusHaplotype)1 SingleLocusHaplotype (org.dash.valid.gl.haplo.SingleLocusHaplotype)1 Allele (org.nmdp.gl.Allele)1 AlleleList (org.nmdp.gl.AlleleList)1 Genotype (org.nmdp.gl.Genotype)1 GenotypeList (org.nmdp.gl.GenotypeList)1 Haplotype (org.nmdp.gl.Haplotype)1 MultilocusUnphasedGenotype (org.nmdp.gl.MultilocusUnphasedGenotype)1