Fix to only consider the samples that are both in the PED file and in the VCF file

This commit is contained in:
Menachem Fromer 2013-05-06 13:52:14 -04:00
parent 09995b6900
commit 13240588cf
1 changed files with 4 additions and 4 deletions

View File

@ -450,9 +450,9 @@ public class PhaseByTransmission extends RodWalker<HashMap<Byte,Integer>, HashMa
Set<String> vcfSamples = SampleUtils.getSampleList(vcfRods, GATKVariantContextUtils.GenotypeMergeType.REQUIRE_UNIQUE); Set<String> vcfSamples = SampleUtils.getSampleList(vcfRods, GATKVariantContextUtils.GenotypeMergeType.REQUIRE_UNIQUE);
//Get the trios from the families passed as ped //Get the trios from the families passed as ped
setTrios(); setTrios(vcfSamples);
if(trios.size()<1) if(trios.size()<1)
throw new UserException.BadInput("No PED file passed or no trios found in PED file. Aborted."); throw new UserException.BadInput("No PED file passed or no *non-skipped* trios found in PED file. Aborted.");
Set<VCFHeaderLine> headerLines = new HashSet<VCFHeaderLine>(); Set<VCFHeaderLine> headerLines = new HashSet<VCFHeaderLine>();
@ -471,9 +471,9 @@ public class PhaseByTransmission extends RodWalker<HashMap<Byte,Integer>, HashMa
/** /**
* Select trios and parent/child pairs only * Select trios and parent/child pairs only
*/ */
private void setTrios(){ private void setTrios(Set<String> vcfSamples){
Map<String,Set<Sample>> families = this.getSampleDB().getFamilies(); Map<String,Set<Sample>> families = this.getSampleDB().getFamilies(vcfSamples);
Set<Sample> family; Set<Sample> family;
ArrayList<Sample> parents; ArrayList<Sample> parents;
for(Map.Entry<String,Set<Sample>> familyEntry : families.entrySet()){ for(Map.Entry<String,Set<Sample>> familyEntry : families.entrySet()){