-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added -Dsanitycheck.dumpIterators option that dumps out the records f…
…or almost all the assembly iterators. Useful for isolating where non-determinism gets introduced
- Loading branch information
Daniel Cameron
committed
Feb 4, 2022
1 parent
d718998
commit 92cb449
Showing
8 changed files
with
194 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
|
||
for f1 in DebugSpammingIterator$1.Worker*.log ; do | ||
f2=${f1/tor$1/tor$2} | ||
# let truncated files still be happy | ||
lines1=$(cat $f1 | wc -l) | ||
lines2=$(cat $f2 | wc -l) | ||
lines=$lines2 | ||
if [[ $lines1 -lt $lines2 ]] ; then | ||
lines=$lines1 | ||
fi | ||
for filter in \ | ||
"SAMEvidenceSource.iterator().rawiterator" \ | ||
"SAMEvidenceSource.shouldFilterPreTransform" \ | ||
"SAMEvidenceSource.transform" \ | ||
"SAMEvidenceSource.iterator(QueryInterval[])" \ | ||
"SAMEvidenceSource.shouldFilter(SAMRecord)" \ | ||
"SAMEvidenceSource.shouldFilter(DirectedEvidence)" \ | ||
"asEvidence" \ | ||
"SAMEvidenceSource.iterator(QueryInterval[]).filter" \ | ||
"mergedIterator" \ | ||
"PositionalAssembler.evidenceIt" \ | ||
"PositionalAssembler.SupportNodeIterator" \ | ||
"PositionalAssembler.AggregateNodeIterator" \ | ||
"PositionalAssembler.PathNodeIterator" \ | ||
"AssemblyEvidenceSource.assembler" \ | ||
; do | ||
(diff --speed-large-files -q \ | ||
<(head -$lines $f1 | grep -F "$filter") \ | ||
<(head -$lines $f2 | grep -F "$filter") >/dev/null \ | ||
&& echo "---------------IDENTICAL $filter $f1") || \ | ||
echo "----------NOT--IDENTICAL $filter $f1" | ||
diff --speed-large-files\ | ||
<(head -$lines $f1 | grep -F "$filter") \ | ||
<(head -$lines $f2 | grep -F "$filter") | head -2 | ||
done | ||
done | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
src/main/java/au/edu/wehi/idsv/util/DebugSpammingIterator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package au.edu.wehi.idsv.util; | ||
|
||
import htsjdk.samtools.util.RuntimeIOException; | ||
|
||
import java.io.File; | ||
import java.io.FileNotFoundException; | ||
import java.io.PrintWriter; | ||
import java.util.HashMap; | ||
import java.util.Iterator; | ||
|
||
public class DebugSpammingIterator<T> implements Iterator<T> { | ||
private static final int FLUSH_INTERVAL = 1024; | ||
private static final HashMap<String, PrintWriter> out = new HashMap<>(); | ||
private final Iterator<T> underlying; | ||
private final long maxRecords; | ||
private final String id; | ||
private long records = 0; | ||
public DebugSpammingIterator(Iterator<T> underlying, String id) { | ||
this(underlying, id, 1024 * 1024 * 1024); | ||
} | ||
public DebugSpammingIterator(Iterator<T> underlying, String id, long maxRecords) { | ||
this.underlying = underlying; | ||
this.id = id; | ||
this.maxRecords = maxRecords; | ||
} | ||
@Override | ||
public boolean hasNext() { | ||
return underlying.hasNext(); | ||
} | ||
|
||
@Override | ||
public T next() { | ||
T r = underlying.next(); | ||
String threadName = Thread.currentThread().getName(); | ||
records++; | ||
if (records < maxRecords) { | ||
if (!out.containsKey(threadName)) { | ||
int i = 1; | ||
while (new File("DebugSpammingIterator" + i + "." + threadName + ".log").exists()) { | ||
i++; | ||
} | ||
try { | ||
out.put(threadName, new PrintWriter(new File("DebugSpammingIterator" + i + "." + threadName + ".log"))); | ||
} catch (FileNotFoundException e) { | ||
throw new RuntimeIOException(e); | ||
} | ||
} | ||
String msg = String.format("%s\t%s\t%s\n", Thread.currentThread().getName(), id, r); | ||
out.get(threadName).write(msg); | ||
} else if (records == maxRecords || records % FLUSH_INTERVAL == 0) { | ||
synchronized (out) { | ||
out.get(threadName).flush(); | ||
} | ||
} | ||
return r; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters