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() {
|
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());
|
readsNotToClean.addAll(readsToClean.getReads());
|
||||||
for ( SAMRecord read : ReadUtils.coordinateSortReads(readsNotToClean) )
|
ReadUtils.coordinateSortReads(readsNotToClean);
|
||||||
|
for ( SAMRecord read : readsNotToClean )
|
||||||
emit(read);
|
emit(read);
|
||||||
readsToClean.clear();
|
readsToClean.clear();
|
||||||
readsNotToClean.clear();
|
readsNotToClean.clear();
|
||||||
|
|
|
||||||
|
|
@ -216,17 +216,9 @@ public class ReadUtils {
|
||||||
* @param reads
|
* @param reads
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public final static List<SAMRecord> coordinateSortReads(Collection<SAMRecord> reads) {
|
public final static void coordinateSortReads(List<SAMRecord> reads) {
|
||||||
final int n = reads.size();
|
final SAMRecordComparator comparer = new SAMRecordCoordinateComparator();
|
||||||
|
Collections.sort(reads, comparer);
|
||||||
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 int getFirstInsertionOffset(SAMRecord read) {
|
public final static int getFirstInsertionOffset(SAMRecord read) {
|
||||||
|
|
|
||||||
|
|
@ -117,13 +117,4 @@ public class IndelRealignerIntegrationTest extends WalkerTest {
|
||||||
executeTest(String.format("realigner [%s]", entry.getKey()), spec);
|
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