Merge pull request #1460 from broadinstitute/rhl_rank_sum_test_del_return

Make getElementForRead() in RankSumTest robust
This commit is contained in:
Ron Levine 2016-08-23 16:36:30 -04:00 committed by GitHub
commit 53e1d42d28
6 changed files with 11 additions and 8 deletions

View File

@ -278,7 +278,7 @@ public abstract class AS_RankSumTest extends RankSumTest implements ReducibleAnn
if ( isUsableRead(read, refLoc) ) {
final Double value = getElementForRead(read, refLoc, a);
// Bypass read if the clipping goal is not reached or the refloc is inside a spanning deletion
if ( value == null || value < 0.0 )
if ( value == null || value == INVALID_ELEMENT_FROM_READ )
continue;
if(perAlleleValues.containsKey(a.getMostLikelyAllele()))

View File

@ -102,10 +102,13 @@ public class AS_ReadPosRankSumTest extends AS_RankSumTest implements AS_Standard
if ( offset == ReadUtils.CLIPPING_GOAL_NOT_REACHED )
return null;
// If the offset inside a deletion, it does not lie on a read.
if ( AlignmentUtils.isInsideDeletion(read.getCigar(), offset) ) {
return INVALID_ELEMENT_FROM_READ;
}
int readPos = AlignmentUtils.calcAlignmentByteArrayOffset(read.getCigar(), offset, false, 0, 0);
final int numAlignedBases = AlignmentUtils.getNumAlignedBasesCountingSoftClips( read );
// Note: For a spanning deletion, readPos is at the upstream end of the deletion and is greater than numAlignedBases (which does not include deletions).
// Hence, the resulting readPos will have a negative value.
if (readPos > numAlignedBases / 2)
readPos = numAlignedBases - (readPos + 1);
return (double)readPos;

View File

@ -76,7 +76,7 @@ import java.util.*;
//TODO: will eventually implement ReducibleAnnotation in order to preserve accuracy for CombineGVCFs and GenotypeGVCFs -- see RMSAnnotation.java for an example of an abstract ReducibleAnnotation
public abstract class RankSumTest extends InfoFieldAnnotation implements ActiveRegionBasedAnnotation {
static final boolean DEBUG = false;
protected static double INVALID_READ_POSITION = -1; // No mapping to a read position
protected static double INVALID_ELEMENT_FROM_READ = Double.NEGATIVE_INFINITY;
public Map<String, Object> annotate(final RefMetaDataTracker tracker,
final AnnotatorCompatible walker,
@ -185,7 +185,7 @@ public abstract class RankSumTest extends InfoFieldAnnotation implements ActiveR
if ( isUsableRead(read, refLoc) ) {
final Double value = getElementForRead(read, refLoc, a);
// Bypass read if the clipping goal is not reached or the refloc is inside a spanning deletion
if ( value == null || value == INVALID_READ_POSITION )
if ( value == null || value == INVALID_ELEMENT_FROM_READ )
continue;
if ( a.getMostLikelyAllele().isReference() )

View File

@ -106,7 +106,7 @@ public class ReadPosRankSumTest extends RankSumTest implements StandardAnnotatio
// If the offset inside a deletion, it does not lie on a read.
if ( AlignmentUtils.isInsideDeletion(read.getCigar(), offset) ) {
return INVALID_READ_POSITION;
return INVALID_ELEMENT_FROM_READ;
}
int readPos = AlignmentUtils.calcAlignmentByteArrayOffset( read.getCigar(), offset, false, 0, 0 );

View File

@ -72,7 +72,7 @@ public class HaplotypeCallerComplexAndSymbolicVariantsIntegrationTest extends Wa
@Test
public void testHaplotypeCallerMultiSampleComplex1() {
HCTestComplexVariants(privateTestDir + "AFR.complex.variants.bam", "", "86528820f8c102c712d9562b83204c05");
HCTestComplexVariants(privateTestDir + "AFR.complex.variants.bam", "", "b01df95864808dc67295efc6db37983d");
}
private void HCTestSymbolicVariants(String bam, String args, String md5) {

View File

@ -458,7 +458,7 @@ public class HaplotypeCallerGVCFIntegrationTest extends WalkerTest {
public void testHaplotypeCallerGVCSpanDel() {
final String commandLine = String.format("-T HaplotypeCaller -R %s -I %s -L 1:26357667 -ERC GVCF --no_cmdline_in_header -A AS_ReadPosRankSumTest -A ReadPosRankSumTest -variant_index_type %s -variant_index_parameter %d",
b37KGReference, privateTestDir + "NexPond-377866-1:26357600-26357700.bam", GATKVCFUtils.DEFAULT_GVCF_INDEX_TYPE, GATKVCFUtils.DEFAULT_GVCF_INDEX_PARAMETER);
final WalkerTestSpec spec = new WalkerTestSpec(commandLine + " -o %s", Arrays.asList("93bc22340e6a4b01a7b96e5a3a12dfc3"));
final WalkerTestSpec spec = new WalkerTestSpec(commandLine + " -o %s", Arrays.asList("b8f0bb74bc099a8f78d600d88861e1b6"));
spec.disableShadowBCF();
executeTest("testHaplotypeCallerGVCSpanDel", spec);
}