Handle excess coverage in interval output

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2954 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
chartl 2010-03-08 14:40:05 +00:00
parent ca2a0266dc
commit cc6a714c09
1 changed files with 14 additions and 4 deletions

View File

@ -63,7 +63,7 @@ public class CoverageStatistics extends LocusWalker<Map<String,int[]>, CoverageA
byte minBaseQuality = 20;
@Argument(fullName = "printBaseCounts", shortName = "baseCounts", doc = "Will add base counts to per-locus output.", required = false)
boolean printBaseCounts = false;
@Argument(fullName = "omitLocusTable", shortName = "omitLocus", doc = "Will not calculate the per-sample per-depth counts of loci, which should result in speedup", required = false)
@Argument(fullName = "omitLocusTable", shortName = "omitLocusTable", doc = "Will not calculate the per-sample per-depth counts of loci, which should result in speedup", required = false)
boolean omitLocusTable = false;
@Argument(fullName = "omitIntervalStatistics", shortName = "omitIntervals", doc = "Will omit the per-interval statistics section, which should result in speedup", required = false)
boolean omitIntervals = false;
@ -372,17 +372,27 @@ public class CoverageStatistics extends LocusWalker<Map<String,int[]>, CoverageA
int median = getQuantile(stats.getHistograms().get(s),0.5);
int q1 = getQuantile(stats.getHistograms().get(s),0.25);
int q3 = getQuantile(stats.getHistograms().get(s),0.75);
targetSummary.append(bins[q1]);
targetSummary.append(formatBin(bins,q1));
targetSummary.append("\t");
targetSummary.append(bins[median]);
targetSummary.append(formatBin(bins,median));
targetSummary.append("\t");
targetSummary.append(bins[q3]);
targetSummary.append(formatBin(bins,q3));
}
output.printf("%s%n", targetSummary);
}
private String formatBin(int[] bins, int quartile) {
if ( quartile >= bins.length ) {
return String.format(">%d",bins[quartile]);
} else if ( quartile < 0 ) {
return String.format("<%d",bins[0]);
} else {
return String.format("%d",bins[quartile]);
}
}
private void printIntervalTable(PrintStream output, int[][] intervalTable, int[] cutoffs) {
output.printf("\tdepth>=%d",0);
for ( int col = 0; col < intervalTable[0].length-1; col ++ ) {