Search in sources :

Example 1 with LocusSet

use of org.dash.valid.LocusSet in project ImmunogeneticDataTools by nmdp-bioinformatics.

the class DetectedDisequilibriumElement method toString.

public String toString() {
    StringBuffer sb = new StringBuffer();
    Set<Locus> loci = new LocusSet(new LocusComparator());
    loci.addAll(getDisequilibriumElement().getLoci());
    for (Locus locus : loci) {
        // sb.append(locus.getShortName() + " Locus: " + getDisequilibriumElement().getHlaElement(locus) + GLStringConstants.NEWLINE);
        if (getDisequilibriumElement().getHlaElement(locus).size() == 1) {
            sb.append(getDisequilibriumElement().getHlaElement(locus).get(0));
        } else {
            sb.append(getDisequilibriumElement().getHlaElement(locus));
        }
        sb.append(GLStringConstants.GENE_PHASE_DELIMITER);
    }
    return sb.substring(0, sb.length() - 1) + GLStringConstants.NEWLINE + ((CoreDisequilibriumElement) getDisequilibriumElement()).getFrequencyInfo();
}
Also used : LocusSet(org.dash.valid.LocusSet) LocusComparator(org.dash.valid.LocusComparator) Locus(org.dash.valid.Locus)

Example 2 with LocusSet

use of org.dash.valid.LocusSet in project ImmunogeneticDataTools by nmdp-bioinformatics.

the class MultiLocusHaplotype method getHaplotypeString.

@Override
public String getHaplotypeString() {
    StringBuffer sb = new StringBuffer();
    Set<Locus> keySet = getAlleleMap().keySet();
    Set<Locus> loci = new LocusSet(new LocusComparator());
    loci.addAll(keySet);
    if (this.linkage != null) {
        for (Locus locus : loci) {
            // TODO:  Make less clumsy to get rid of brackets?
            if (linkage.getDisequilibriumElement().getHlaElement(locus).size() == 1) {
                sb.append(linkage.getDisequilibriumElement().getHlaElement(locus).get(0));
            } else {
                sb.append(linkage.getDisequilibriumElement().getHlaElement(locus));
            }
            sb.append(GLStringConstants.GENE_PHASE_DELIMITER);
        }
    } else {
        for (Locus locus : loci) {
            sb.append(getAlleles(locus));
            sb.append(GLStringConstants.GENE_DELIMITER);
        }
    }
    return sb.substring(0, sb.length() - 1);
}
Also used : LocusSet(org.dash.valid.LocusSet) LocusComparator(org.dash.valid.LocusComparator) Locus(org.dash.valid.Locus)

Aggregations

Locus (org.dash.valid.Locus)2 LocusComparator (org.dash.valid.LocusComparator)2 LocusSet (org.dash.valid.LocusSet)2