Finally found the bug that everyone is reporting on GS. Iterators on PriorityQueues aren't guaranteed to return elements in sorted order (a pretty stupid contract) - so we were passing items to the constrained writer out of order. Just do a Collections.sort instead (1 line of code). Happy father's day!
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@5476 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
9568c84af9
commit
1c95208e26
|
|
@ -402,9 +402,10 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
|
|||
}
|
||||
|
||||
private void emitReadLists() {
|
||||
// pre-merge lists with priority queue for constrained SAMFileWriter
|
||||
// pre-merge lists to sort them in preparation for constrained SAMFileWriter
|
||||
readsNotToClean.addAll(readsToClean.getReads());
|
||||
for ( SAMRecord read : ReadUtils.coordinateSortReads(readsNotToClean) )
|
||||
ReadUtils.coordinateSortReads(readsNotToClean);
|
||||
for ( SAMRecord read : readsNotToClean )
|
||||
emit(read);
|
||||
readsToClean.clear();
|
||||
readsNotToClean.clear();
|
||||
|
|
|
|||
|
|
@ -216,17 +216,9 @@ public class ReadUtils {
|
|||
* @param reads
|
||||
* @return
|
||||
*/
|
||||
public final static List<SAMRecord> coordinateSortReads(Collection<SAMRecord> reads) {
|
||||
final int n = reads.size();
|
||||
|
||||
if ( n > 0 ) {
|
||||
final SAMRecordComparator comparer = new SAMRecordCoordinateComparator();
|
||||
final Queue<SAMRecord> sorted = new PriorityQueue<SAMRecord>(reads.size(), comparer);
|
||||
sorted.addAll(reads);
|
||||
return new ArrayList<SAMRecord>(sorted);
|
||||
} else {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
public final static void coordinateSortReads(List<SAMRecord> reads) {
|
||||
final SAMRecordComparator comparer = new SAMRecordCoordinateComparator();
|
||||
Collections.sort(reads, comparer);
|
||||
}
|
||||
|
||||
public final static int getFirstInsertionOffset(SAMRecord read) {
|
||||
|
|
|
|||
|
|
@ -117,13 +117,4 @@ public class IndelRealignerIntegrationTest extends WalkerTest {
|
|||
executeTest(String.format("realigner [%s]", entry.getKey()), spec);
|
||||
}
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = { RuntimeException.class }, dependsOnMethods = { "testMaxReadsInMemory" })
|
||||
public void testFailure() {
|
||||
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
|
||||
baseCommand + "--maxReadsInMemory 1000",
|
||||
1,
|
||||
Arrays.asList(""));
|
||||
executeTest("realigner failure", spec);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue