Annotator now buffers indel calls (prevents double-output from double-calls to map)
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3413 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
4e834b5e35
commit
7fb3f2d3eb
|
|
@ -82,6 +82,8 @@ public class VariantAnnotator extends LocusWalker<Integer, Integer> {
|
||||||
|
|
||||||
private VariantAnnotatorEngine engine;
|
private VariantAnnotatorEngine engine;
|
||||||
|
|
||||||
|
private Collection<VariantContext> indelBufferContext;
|
||||||
|
|
||||||
|
|
||||||
private void listAnnotationsAndExit() {
|
private void listAnnotationsAndExit() {
|
||||||
List<Class<? extends InfoFieldAnnotation>> infoAnnotationClasses = PackageUtils.getClassesImplementingInterface(InfoFieldAnnotation.class);
|
List<Class<? extends InfoFieldAnnotation>> infoAnnotationClasses = PackageUtils.getClassesImplementingInterface(InfoFieldAnnotation.class);
|
||||||
|
|
@ -139,6 +141,10 @@ public class VariantAnnotator extends LocusWalker<Integer, Integer> {
|
||||||
vcfWriter = new VCFWriter(out);
|
vcfWriter = new VCFWriter(out);
|
||||||
VCFHeader vcfHeader = new VCFHeader(hInfo, samples);
|
VCFHeader vcfHeader = new VCFHeader(hInfo, samples);
|
||||||
vcfWriter.writeHeader(vcfHeader);
|
vcfWriter.writeHeader(vcfHeader);
|
||||||
|
|
||||||
|
if ( indelsOnly ) {
|
||||||
|
indelBufferContext = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -199,9 +205,22 @@ public class VariantAnnotator extends LocusWalker<Integer, Integer> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( variant instanceof VCFRecord) {
|
if ( ! indelsOnly ) {
|
||||||
for(VariantContext annotatedVC : annotatedVCs ) {
|
|
||||||
|
if ( variant instanceof VCFRecord ) {
|
||||||
|
for(VariantContext annotatedVC : annotatedVCs ) {
|
||||||
vcfWriter.addRecord(VariantContextAdaptors.toVCF(annotatedVC, ref.getBase()));
|
vcfWriter.addRecord(VariantContextAdaptors.toVCF(annotatedVC, ref.getBase()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// check to see if the buffered context is different (in location) this context
|
||||||
|
if ( indelBufferContext != null && ! indelBufferContext.iterator().next().getLocation().equals(annotatedVCs.iterator().next().getLocation()) ) {
|
||||||
|
for(VariantContext annotatedVC : indelBufferContext ) {
|
||||||
|
vcfWriter.addRecord(VariantContextAdaptors.toVCF(annotatedVC, ref.getBase()));
|
||||||
|
}
|
||||||
|
indelBufferContext = annotatedVCs;
|
||||||
|
} else {
|
||||||
|
indelBufferContext = annotatedVCs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue