use of org.dash.valid.LocusComparator 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();
}
use of org.dash.valid.LocusComparator in project ImmunogeneticDataTools by nmdp-bioinformatics.
the class MultiLocusHaplotype method getFullHaplotypeString.
@Override
public String getFullHaplotypeString() {
StringBuffer fullValue = new StringBuffer();
Set<Locus> loci = new LocusSet(new LocusComparator());
if (this.linkage != null) {
Haplotype haplotype = linkage.getHaplotype();
loci.addAll(haplotype.getLoci());
for (Locus locus : loci) {
for (String allele : haplotype.getAlleles(locus)) {
fullValue.append(allele);
fullValue.append(GLStringConstants.ALLELE_AMBIGUITY_DELIMITER);
}
fullValue.replace(fullValue.length() - 1, fullValue.length(), GLStringConstants.GENE_PHASE_DELIMITER);
}
}
if (fullValue.length() > 0) {
return fullValue.substring(0, fullValue.length() - 1);
}
return fullValue.toString();
}
use of org.dash.valid.LocusComparator 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);
}
Aggregations