Merged bug fix from Stable into Unstable

This commit is contained in:
Mark DePristo 2012-01-05 21:51:48 -05:00
commit dd80ffbbbe
2 changed files with 27 additions and 7 deletions

View File

@ -46,6 +46,7 @@ import java.util.*;
public class VariantSummary extends VariantEvaluator implements StandardEval {
final protected static Logger logger = Logger.getLogger(VariantSummary.class);
/** Indels with size greater than this value are tallied in the CNV column */
private final static int MAX_INDEL_LENGTH = 50;
private final static double MIN_CNV_OVERLAP = 0.5;
private VariantEvalWalker walker;
@ -196,14 +197,16 @@ public class VariantSummary extends VariantEvaluator implements StandardEval {
}
private final boolean overlapsKnownCNV(VariantContext cnv) {
final GenomeLoc loc = walker.getGenomeLocParser().createGenomeLoc(cnv, true);
IntervalTree<GenomeLoc> intervalTree = knownCNVs.get(loc.getContig());
if ( knownCNVs != null ) {
final GenomeLoc loc = walker.getGenomeLocParser().createGenomeLoc(cnv, true);
IntervalTree<GenomeLoc> intervalTree = knownCNVs.get(loc.getContig());
final Iterator<IntervalTree.Node<GenomeLoc>> nodeIt = intervalTree.overlappers(loc.getStart(), loc.getStop());
while ( nodeIt.hasNext() ) {
final double overlapP = loc.reciprocialOverlapFraction(nodeIt.next().getValue());
if ( overlapP > MIN_CNV_OVERLAP )
return true;
final Iterator<IntervalTree.Node<GenomeLoc>> nodeIt = intervalTree.overlappers(loc.getStart(), loc.getStop());
while ( nodeIt.hasNext() ) {
final double overlapP = loc.reciprocialOverlapFraction(nodeIt.next().getValue());
if ( overlapP > MIN_CNV_OVERLAP )
return true;
}
}
return false;

View File

@ -450,4 +450,21 @@ public class VariantEvalIntegrationTest extends WalkerTest {
);
executeTest("testIntervalStrat", spec);
}
@Test
public void testModernVCFWithLargeIndels() {
WalkerTestSpec spec = new WalkerTestSpec(
buildCommandLine(
"-T VariantEval",
"-R " + b37KGReference,
"-eval " + validationDataLocation + "/NA12878.HiSeq.WGS.b37_decoy.indel.recalibrated.vcf",
"-L 20",
"-D " + b37dbSNP132,
"-o %s"
),
1,
Arrays.asList("a6f8b32fa732632da13dfe3ddcc73cef")
);
executeTest("testModernVCFWithLargeIndels", spec);
}
}