-Added unit test for walkers dealing with intervals for cleaning

-I also uncovered a corner case in the cleaner that for some reason was commented out but shouldn't have been.  Hooray for unit tests!



git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1553 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
ebanks 2009-09-09 02:35:17 +00:00
parent ec0f6f23c7
commit 0cc219c0df
2 changed files with 36 additions and 4 deletions

View File

@ -573,10 +573,11 @@ public class IntervalCleanerWalker extends LocusWindowWalker<Integer, Integer>
String qualStr = read.getBaseQualityString();
for (int j=0; j < readStr.length(); j++, refIdx++ ) {
// if ( refIdx < 0 || refIdx >= reference.length() ) {
// System.out.println( "Read: "+read.getRead().getReadName() + "; length = " + readStr.length() );
// System.out.println( "Ref left: "+ leftmostIndex +"; ref length=" + reference.length() + "; read alignment start: "+read.getOriginalAlignmentStart() );
// }
if ( refIdx < 0 || refIdx >= reference.length() ) {
//System.out.println( "Read: "+read.getRead().getReadName() + "; length = " + readStr.length() );
//System.out.println( "Ref left: "+ leftmostIndex +"; ref length=" + reference.length() + "; read alignment start: "+read.getOriginalAlignmentStart() );
break;
}
totalBases[refIdx] += (int)qualStr.charAt(j) - 33;
if ( Character.toUpperCase(readStr.charAt(j)) != Character.toUpperCase(reference.charAt(refIdx)) )
originalMismatchBases[refIdx] += (int)qualStr.charAt(j) - 33;

View File

@ -0,0 +1,31 @@
package org.broadinstitute.sting.gatk.walkers.indels;
import org.broadinstitute.sting.WalkerTest;
import org.junit.Test;
import java.util.Arrays;
public class IntervalsTest extends WalkerTest {
@Test
public void testIntervals() {
WalkerTest.WalkerTestSpec spec1 = new WalkerTest.WalkerTestSpec(
"-T IndelIntervals -R /broad/1KG/reference/human_b36_both.fasta -I /humgen/gsa-scr1/GATK_Data/Validation_Data/NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -L 1:10,000,000-11,000,000 -o %s",
1,
Arrays.asList("a4a795755b18f4ecdbc50975612bd819"));
executeTest("testIndelIntervals", spec1);
WalkerTest.WalkerTestSpec spec2 = new WalkerTest.WalkerTestSpec(
"-T MismatchIntervals -R /broad/1KG/reference/human_b36_both.fasta -I /humgen/gsa-scr1/GATK_Data/Validation_Data/NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -L 1:10,000,000-11,000,000 -o %s",
1,
Arrays.asList("31e8b5d4c42f2c63c08b8f6b8e10ac99"));
executeTest("testMismatchIntervals", spec2);
WalkerTest.WalkerTestSpec spec3 = new WalkerTest.WalkerTestSpec(
"-T IntervalMerger -R /broad/1KG/reference/human_b36_both.fasta -I /humgen/gsa-scr1/GATK_Data/Validation_Data/NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -L 1:10,000,000-11,000,000 -intervals /humgen/gsa-scr1/GATK_Data/Validation_Data/indelIntervals.test -intervals /humgen/gsa-scr1/GATK_Data/Validation_Data/mismatchIntervals.test -o %s",
1,
Arrays.asList("bf1f23667ef0065bbcb9754f50c2d664"));
executeTest("testMergeIntervals", spec3);
}
}