Handle null VCs (which can arise when indels are present in the file)

This commit is contained in:
Eric Banks 2012-04-23 10:30:00 -04:00
parent adad76b36f
commit 2761da975e
1 changed files with 49 additions and 44 deletions

View File

@ -744,11 +744,16 @@ public class PhaseByTransmission extends RodWalker<HashMap<Byte,Integer>, HashMa
String mvfLine; String mvfLine;
if (tracker != null) { if (tracker == null)
VariantContext vc = tracker.getFirstValue(variantCollection.variants, context.getLocation()); return metricsCounters;
VariantContextBuilder builder = new VariantContextBuilder(vc);
GenotypesContext genotypesContext = GenotypesContext.copy(vc.getGenotypes()); final VariantContext vc = tracker.getFirstValue(variantCollection.variants, context.getLocation());
if (vc == null)
return metricsCounters;
final VariantContextBuilder builder = new VariantContextBuilder(vc);
final GenotypesContext genotypesContext = GenotypesContext.copy(vc.getGenotypes());
for (Sample sample : trios) { for (Sample sample : trios) {
Genotype mother = vc.getGenotype(sample.getMaternalID()); Genotype mother = vc.getGenotype(sample.getMaternalID());
Genotype father = vc.getGenotype(sample.getPaternalID()); Genotype father = vc.getGenotype(sample.getPaternalID());
@ -799,7 +804,7 @@ public class PhaseByTransmission extends RodWalker<HashMap<Byte,Integer>, HashMa
builder.genotypes(genotypesContext); builder.genotypes(genotypesContext);
vcfWriter.add(builder.make()); vcfWriter.add(builder.make());
}
return metricsCounters; return metricsCounters;
} }