For Chris, to make his life easier: iterate over all VCF records passed in looking for one with an ALT allele defined instead of assuming all records have one.
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4789 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
97c94176c0
commit
bef48e7a42
|
|
@ -95,7 +95,6 @@ public class UGCallVariants extends RodWalker<VariantCallContext, Integer> {
|
||||||
if ( tracker == null )
|
if ( tracker == null )
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
|
||||||
List<VariantContext> VCs = new ArrayList<VariantContext>();
|
List<VariantContext> VCs = new ArrayList<VariantContext>();
|
||||||
for ( String name : trackNames ) {
|
for ( String name : trackNames ) {
|
||||||
Collection<VariantContext> vc = tracker.getVariantContexts(ref, name, null, context.getLocation(), true, true);
|
Collection<VariantContext> vc = tracker.getVariantContexts(ref, name, null, context.getLocation(), true, true);
|
||||||
|
|
@ -135,11 +134,19 @@ public class UGCallVariants extends RodWalker<VariantCallContext, Integer> {
|
||||||
if ( VCs.size() == 0 )
|
if ( VCs.size() == 0 )
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
VariantContext variantVC = null;
|
||||||
|
Map<String, Genotype> genotypes = new HashMap<String, Genotype>();
|
||||||
|
for ( VariantContext vc : VCs ) {
|
||||||
|
if ( variantVC == null && vc.isVariant() )
|
||||||
|
variantVC = vc;
|
||||||
|
genotypes.putAll(getGenotypesWithGLs(vc.getGenotypes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( variantVC == null ) {
|
||||||
VariantContext vc = VCs.get(0);
|
VariantContext vc = VCs.get(0);
|
||||||
Map<String, Genotype> genotypes = new HashMap<String, Genotype>(getGenotypesWithGLs(vc.getGenotypes()));
|
throw new UserException("There is no ALT allele in any of the VCF records passed in at " + vc.getChr() + ":" + vc.getStart());
|
||||||
for (int i = 1; i < VCs.size(); i++)
|
}
|
||||||
genotypes.putAll(getGenotypesWithGLs(VCs.get(i).getGenotypes()));
|
return new VariantContext("VCwithGLs", variantVC.getChr(), variantVC.getStart(), variantVC.getEnd(), variantVC.getAlleles(), genotypes, VariantContext.NO_NEG_LOG_10PERROR, null, null);
|
||||||
return new VariantContext("VCwithGLs", vc.getChr(), vc.getStart(), vc.getEnd(), vc.getAlleles(), genotypes, VariantContext.NO_NEG_LOG_10PERROR, null, null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Map<String, Genotype> getGenotypesWithGLs(Map<String, Genotype> genotypes) {
|
private static Map<String, Genotype> getGenotypesWithGLs(Map<String, Genotype> genotypes) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue