use of org.dash.valid.LinkageElementsSet in project ImmunogeneticDataTools by nmdp-bioinformatics.
the class LinkageElementsMapTest method test.
@Test
public void test() {
List<FrequencyByRace> frequenciesByRace = new ArrayList<FrequencyByRace>();
FrequencyByRace freq = new FrequencyByRace(new Double(.2), "1", "AAFA");
frequenciesByRace.add(freq);
HashMap<Locus, List<String>> hlaElementMap = new HashMap<Locus, List<String>>();
List<String> val = new ArrayList<String>();
val.add("HLA-B*07:01");
hlaElementMap.put(Locus.HLA_B, val);
val = new ArrayList<String>();
val.add("HLA-C*01:01");
hlaElementMap.put(Locus.HLA_C, val);
DisequilibriumElementByRace element1 = new DisequilibriumElementByRace(hlaElementMap, frequenciesByRace);
frequenciesByRace = new ArrayList<FrequencyByRace>();
freq = new FrequencyByRace(new Double(.3), "2", "CAU");
frequenciesByRace.add(freq);
freq = new FrequencyByRace(new Double(.4), "3", "API");
frequenciesByRace.add(freq);
hlaElementMap = new HashMap<Locus, List<String>>();
val = new ArrayList<String>();
val.add("HLA-B*52:01");
hlaElementMap.put(Locus.HLA_B, val);
val = new ArrayList<String>();
val.add("HLA-C*04:01");
hlaElementMap.put(Locus.HLA_C, val);
DisequilibriumElementByRace element2 = new DisequilibriumElementByRace(hlaElementMap, frequenciesByRace);
Set<DetectedDisequilibriumElement> set = new LinkageElementsSet(new DisequilibriumElementComparator());
set.add(new DetectedDisequilibriumElement(element1));
set.add(new DetectedDisequilibriumElement(element2));
int idx = 0;
for (DetectedDisequilibriumElement obj : set) {
if (idx == 0) {
assertTrue(obj.getDisequilibriumElement().equals(element2));
} else {
assertTrue(obj.getDisequilibriumElement().equals(element1));
}
idx++;
}
}
Aggregations