Phase 2: after hours of testing, confirming that constrained mode looks good so moving the integration tests over to use it. Some cleanup. More cleanup coming in Phase 3.
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@5298 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
c59c8b9872
commit
93888e570b
|
|
@ -539,10 +539,6 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
|
|||
indelRodsSeen.clear();
|
||||
|
||||
emitReadLists();
|
||||
// why was this different than the other emits?
|
||||
// // merge the two sets for emission
|
||||
// readsNotToClean.addAll(readsToClean.getReads());
|
||||
// emit(readsNotToClean);
|
||||
}
|
||||
|
||||
if ( OUT_INDELS != null ) {
|
||||
|
|
|
|||
|
|
@ -76,7 +76,6 @@ import java.util.*;
|
|||
public class ConstrainedMateFixingSAMFileWriter implements SAMFileWriter {
|
||||
final protected static Logger logger = Logger.getLogger(ConstrainedMateFixingSAMFileWriter.class);
|
||||
private final static boolean DEBUG = false;
|
||||
private final static boolean PRINT_COUNTER = true;
|
||||
|
||||
/** How often do we check whether we want to emit reads? */
|
||||
private final static int EMIT_FREQUENCY = 1000;
|
||||
|
|
@ -90,18 +89,6 @@ public class ConstrainedMateFixingSAMFileWriter implements SAMFileWriter {
|
|||
/** how we order our SAM records */
|
||||
private final SAMRecordComparator comparer = new SAMRecordCoordinateComparator();
|
||||
|
||||
// todo -- remove test comparer
|
||||
// private static class MySAMRecordCoordinateComparator extends SAMRecordCoordinateComparator {
|
||||
// @Override
|
||||
// public int compare(final SAMRecord samRecord1, final SAMRecord samRecord2) {
|
||||
// int cmp = super.fileOrderCompare(samRecord1, samRecord2);
|
||||
// int cmpPos = new Integer(samRecord1.getAlignmentStart()).compareTo(samRecord2.getAlignmentStart());
|
||||
// if ( Math.signum(cmp) != Math.signum(cmpPos) )
|
||||
// logger.info(String.format("Comparing %d to %d => %d cmp and %d cmpPos",
|
||||
// samRecord1.getAlignmentStart(), samRecord2.getAlignmentStart(), cmp, cmpPos));
|
||||
// return cmp;
|
||||
// }
|
||||
// }
|
||||
|
||||
/** The place where we ultimately write out our records */
|
||||
final SAMFileWriter finalDestination;
|
||||
|
|
@ -149,7 +136,6 @@ public class ConstrainedMateFixingSAMFileWriter implements SAMFileWriter {
|
|||
* Retrieves the header to use when creating the new SAM file.
|
||||
* @return header to use when creating the new SAM file.
|
||||
*/
|
||||
@Override
|
||||
public SAMFileHeader getFileHeader() {
|
||||
return finalDestination.getFileHeader();
|
||||
}
|
||||
|
|
@ -189,14 +175,9 @@ public class ConstrainedMateFixingSAMFileWriter implements SAMFileWriter {
|
|||
/**
|
||||
* @{inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void addAlignment( SAMRecord newRead ) {
|
||||
if ( DEBUG ) logger.info("New read pos " + newRead.getAlignmentStart());
|
||||
|
||||
// if ( newRead.getReadName().equals("ERR019492.23181457") )
|
||||
// logger.warn("foo");
|
||||
|
||||
|
||||
// fix mates, as needed
|
||||
// Since setMateInfo can move reads, we potentially need to remove the mate, and requeue
|
||||
// it to ensure proper sorting
|
||||
|
|
@ -209,7 +190,7 @@ public class ConstrainedMateFixingSAMFileWriter implements SAMFileWriter {
|
|||
// to be next-to newRead, so needs to be reinserted into the waitingReads queue
|
||||
// note -- this must be called before the setMateInfo call below
|
||||
if ( ! waitingReads.remove(mate) )
|
||||
throw new ReviewedStingException("BUG: remove of mate failed at " + mate);
|
||||
throw new ReviewedStingException("BUG: removal of mate failed at " + mate);
|
||||
}
|
||||
|
||||
// we've already seen our mate -- set the mate info and remove it from the map
|
||||
|
|
@ -222,28 +203,18 @@ public class ConstrainedMateFixingSAMFileWriter implements SAMFileWriter {
|
|||
}
|
||||
|
||||
waitingReads.add(newRead);
|
||||
// logger.warn("GATKSamRecord newRead.equals(newread) = " + newRead.equals(newRead));
|
||||
// if ( ! waitingReads.remove(newRead) )
|
||||
// throw new ReviewedStingException("BUG: remove of failed at " + newRead);
|
||||
// waitingReads.add(newRead);
|
||||
maxReadsInQueue = Math.max(maxReadsInQueue, waitingReads.size());
|
||||
|
||||
if ( PRINT_COUNTER && counter++ % 10000 == 0 )
|
||||
logger.warn("Reads in queue " + waitingReads.size() + " max " + maxReadsInQueue);
|
||||
|
||||
if ( counter % EMIT_FREQUENCY == 0 ) {
|
||||
if ( ++counter % EMIT_FREQUENCY == 0 ) {
|
||||
//verifyOrdering();
|
||||
while ( ! waitingReads.isEmpty() ) { // there's something in the queue
|
||||
SAMRecord read = waitingReads.peek();
|
||||
//logger.info("Examining read at " + read.getAlignmentStart());
|
||||
|
||||
if ( noReadCanMoveBefore(read.getAlignmentStart(), newRead) &&
|
||||
(iSizeTooBigToMove(read) // we won't try to move such a read
|
||||
|| ! read.getReadPairedFlag() // we're not a paired read
|
||||
|| read.getReadUnmappedFlag() && read.getMateUnmappedFlag() // both reads are unmapped
|
||||
|| noReadCanMoveBefore(read.getMateAlignmentStart(), newRead ) ) ) { // we're already past where the mate started
|
||||
// if ( read.getReadName().equals("20FUKAAXX100202:2:64:2458:35096") )
|
||||
// logger.warn("foo");
|
||||
|
||||
// remove reads from the map that we have emitted -- useful for case where the mate never showed up
|
||||
forMateMatching.remove(read.getReadName());
|
||||
|
|
@ -282,7 +253,6 @@ public class ConstrainedMateFixingSAMFileWriter implements SAMFileWriter {
|
|||
/**
|
||||
* @{inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void close() {
|
||||
// write out all of the remaining reads
|
||||
while ( ! waitingReads.isEmpty() ) { // there's something in the queue
|
||||
|
|
|
|||
|
|
@ -12,12 +12,12 @@ public class IndelRealignerIntegrationTest extends WalkerTest {
|
|||
private static final String mainTestBam = validationDataLocation + "indelRealignerTest.pilot1.ceu.bam";
|
||||
private static final String mainTestIntervals = validationDataLocation + "indelRealignerTest.pilot1.ceu.intervals";
|
||||
private static final String knownIndels = validationDataLocation + "indelRealignerTest.pilot1.ceu.vcf";
|
||||
private static final String baseCommandPrefix = "-T IndelRealigner -noPG -R " + b36KGReference + " -I " + mainTestBam + " -targetIntervals " + mainTestIntervals + " -compress 0 -L 20:49,500-55,500 --sortInCoordinateOrderEvenThoughItIsHighlyUnsafe ";
|
||||
private static final String baseCommandPrefix = "--constrainMovement -T IndelRealigner -noPG -R " + b36KGReference + " -I " + mainTestBam + " -targetIntervals " + mainTestIntervals + " -compress 0 -L 20:49,500-55,500 --sortInCoordinateOrderEvenThoughItIsHighlyUnsafe ";
|
||||
private static final String baseCommand = baseCommandPrefix + "-o %s ";
|
||||
|
||||
@Test
|
||||
public void testDefaults() {
|
||||
String md5 = "20ff8b76d834a8aaca46405e8328d258";
|
||||
String md5 = "282070822dc5495eb20dad157d827133";
|
||||
|
||||
WalkerTestSpec spec1 = new WalkerTestSpec(
|
||||
baseCommand,
|
||||
|
|
@ -52,8 +52,8 @@ public class IndelRealignerIntegrationTest extends WalkerTest {
|
|||
@Test
|
||||
public void testLods() {
|
||||
HashMap<String, String> e = new HashMap<String, String>();
|
||||
e.put( "-LOD 60", "20ff8b76d834a8aaca46405e8328d258" );
|
||||
e.put( "-LOD 1", "39862f48d9eaaf841ca4a0d2c05c4187" );
|
||||
e.put( "-LOD 60", "282070822dc5495eb20dad157d827133" );
|
||||
e.put( "-LOD 1", "c98d699d94f01bd0089f12646c764dfc" );
|
||||
|
||||
for ( Map.Entry<String, String> entry : e.entrySet() ) {
|
||||
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
|
||||
|
|
@ -69,13 +69,13 @@ public class IndelRealignerIntegrationTest extends WalkerTest {
|
|||
WalkerTestSpec spec1 = new WalkerTestSpec(
|
||||
baseCommand + "-knownsOnly -B:indels,vcf " + knownIndels,
|
||||
1,
|
||||
Arrays.asList("1218d3c8fbd50581af5815938d6c0070"));
|
||||
Arrays.asList("36644c80f5e7b7c8679c0485ef681cd8"));
|
||||
executeTest("realigner known indels only from VCF", spec1);
|
||||
|
||||
WalkerTestSpec spec2 = new WalkerTestSpec(
|
||||
baseCommand + "-knownsOnly -D " + GATKDataLocation + "dbsnp_129_b36.rod",
|
||||
1,
|
||||
Arrays.asList("848740b201adc5c45bf82384c1f19d4d"));
|
||||
Arrays.asList("eab2cce434435da7dabb0926101c5586"));
|
||||
executeTest("realigner known indels only from dbsnp", spec2);
|
||||
}
|
||||
|
||||
|
|
@ -84,16 +84,16 @@ public class IndelRealignerIntegrationTest extends WalkerTest {
|
|||
WalkerTestSpec spec = new WalkerTestSpec(
|
||||
baseCommand + "--noOriginalAlignmentTags",
|
||||
1,
|
||||
Arrays.asList("00e009c97905f4fa89e3102261a1fd57"));
|
||||
Arrays.asList("00ecb9df5afe3e9d61a75a2d019cb425"));
|
||||
executeTest("realigner no output tags", spec);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLongRun() {
|
||||
WalkerTestSpec spec = new WalkerTestSpec(
|
||||
"-T IndelRealigner -noPG -R " + b36KGReference + " -I " + validationDataLocation + "NA12878.chrom1.SLX.SRP000032.2009_06.bam -L 1:10,000,000-11,000,000 -targetIntervals " + validationDataLocation + "indelRealignerTest.NA12878.chrom1.intervals -compress 0 --sortInCoordinateOrderEvenThoughItIsHighlyUnsafe -o %s",
|
||||
"--constrainMovement -T IndelRealigner -noPG -R " + b36KGReference + " -I " + validationDataLocation + "NA12878.chrom1.SLX.SRP000032.2009_06.bam -L 1:10,000,000-11,000,000 -targetIntervals " + validationDataLocation + "indelRealignerTest.NA12878.chrom1.intervals -compress 0 --sortInCoordinateOrderEvenThoughItIsHighlyUnsafe -o %s",
|
||||
1,
|
||||
Arrays.asList(""));
|
||||
Arrays.asList("be859f9a98d738becee0526887cae42e"));
|
||||
executeTest("realigner long run", spec);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue