Added function to get founders IDs in SampleDB
Signed-off-by: Eric Banks <ebanks@broadinstitute.org>
This commit is contained in:
parent
120deaa010
commit
19d5213d5a
|
|
@ -235,4 +235,14 @@ public class SampleDB {
|
|||
}
|
||||
return children;
|
||||
}
|
||||
|
||||
public Set<String> getFounderIds(){
|
||||
Set<String> founders = new HashSet<String>();
|
||||
for(Sample sample : getSamples()){
|
||||
if(sample.getParents().size()<1)
|
||||
founders.add(sample.getID());
|
||||
|
||||
}
|
||||
return founders;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -200,6 +200,13 @@ public class SampleDBUnitTest extends BaseTest {
|
|||
Assert.assertEquals(db.getChildrenWithParents(true), new HashSet<Sample>(Arrays.asList(new Sample("kid", "fam1", "dad", "mom", Gender.MALE, Affection.AFFECTED))));
|
||||
}
|
||||
|
||||
@Test()
|
||||
public void testGetFounderIds(){
|
||||
builder.addSamplesFromPedigreeStrings(Arrays.asList(testPEDMultipleFamilies2));
|
||||
SampleDB db = builder.getFinalSampleDB();
|
||||
Assert.assertEquals(db.getFounderIds(), new HashSet<String>(Arrays.asList("dad","mom","dad2","mom2","dad4")));
|
||||
}
|
||||
|
||||
@Test()
|
||||
public void loadFamilyIDs() {
|
||||
builder.addSamplesFromPedigreeStrings(Arrays.asList(testPEDMultipleFamilies));
|
||||
|
|
|
|||
Loading…
Reference in New Issue