By default, IndelLengthHistogram won't collapse large events into the last bin, as it produces weird looking plots

-- Updated integration tests as well
This commit is contained in:
Mark DePristo 2012-04-04 18:36:36 -04:00
parent bfad26353a
commit 76e4100d89
2 changed files with 12 additions and 5 deletions

View File

@ -53,6 +53,7 @@ public class IndelLengthHistogram extends VariantEvaluator implements StandardEv
public TreeMap<Object, Object> results; public TreeMap<Object, Object> results;
public final static int MAX_SIZE_FOR_HISTOGRAM = 10; public final static int MAX_SIZE_FOR_HISTOGRAM = 10;
private final static boolean INCLUDE_LONG_EVENTS_AT_MAX_SIZE = false;
public IndelLengthHistogram() { public IndelLengthHistogram() {
initializeCounts(MAX_SIZE_FOR_HISTOGRAM); initializeCounts(MAX_SIZE_FOR_HISTOGRAM);
@ -99,15 +100,21 @@ public class IndelLengthHistogram extends VariantEvaluator implements StandardEv
/** /**
* Update the histogram with the implied length of the indel allele between ref and alt (alt.len - ref.len). * Update the histogram with the implied length of the indel allele between ref and alt (alt.len - ref.len).
* *
* If this size is outside of MAX_SIZE_FOR_HISTOGRAM, the size is capped to MAX_SIZE_FOR_HISTOGRAM * If this size is outside of MAX_SIZE_FOR_HISTOGRAM, the size is capped to MAX_SIZE_FOR_HISTOGRAM,
* if INCLUDE_LONG_EVENTS_AT_MAX_SIZE is set.
* *
* @param ref * @param ref
* @param alt * @param alt
*/ */
public void updateLengthHistogram(final Allele ref, final Allele alt) { public void updateLengthHistogram(final Allele ref, final Allele alt) {
int len = alt.length() - ref.length(); int len = alt.length() - ref.length();
if ( INCLUDE_LONG_EVENTS_AT_MAX_SIZE ) {
if ( len > MAX_SIZE_FOR_HISTOGRAM ) len = MAX_SIZE_FOR_HISTOGRAM; if ( len > MAX_SIZE_FOR_HISTOGRAM ) len = MAX_SIZE_FOR_HISTOGRAM;
if ( len < -MAX_SIZE_FOR_HISTOGRAM ) len = -MAX_SIZE_FOR_HISTOGRAM; if ( len < -MAX_SIZE_FOR_HISTOGRAM ) len = -MAX_SIZE_FOR_HISTOGRAM;
}
if ( Math.abs(len) > MAX_SIZE_FOR_HISTOGRAM )
return;
nIndels++; nIndels++;
counts.put(len, counts.get(len) + 1); counts.put(len, counts.get(len) + 1);

View File

@ -488,7 +488,7 @@ public class VariantEvalIntegrationTest extends WalkerTest {
"-o %s" "-o %s"
), ),
1, 1,
Arrays.asList("7c01565531cf82c8c03cf042903b96cf") Arrays.asList("41a37636868a838a632559949c5216cf")
); );
executeTest("testModernVCFWithLargeIndels", spec); executeTest("testModernVCFWithLargeIndels", spec);
} }