- Moved various header line printing into a single method
- Fixed output for coverage above min depth git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2254 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
2c7cb912f0
commit
861221d046
|
|
@ -98,27 +98,7 @@ public class DepthOfCoverageWalker extends LocusWalker<DepthOfCoverageWalker.DoC
|
|||
|
||||
// build and print the per-locus header
|
||||
out.println("\nPER_LOCUS_COVERAGE_SECTION");
|
||||
StringBuilder header = new StringBuilder("location\ttotal_coverage\tcoverage_without_deletions");
|
||||
if ( excludeMAPQBelowThis > 0 ) {
|
||||
header.append("\tcoverage_atleast_MQ");
|
||||
header.append(excludeMAPQBelowThis);
|
||||
}
|
||||
if ( printBaseCounts ) {
|
||||
header.append("\tA_count\tC_count\tG_count\tT_count");
|
||||
}
|
||||
if ( byReadGroup ) {
|
||||
for ( String rg : readGroupNames ) {
|
||||
header.append("\tcoverage_for_");
|
||||
header.append(rg);
|
||||
}
|
||||
}
|
||||
if ( bySample ) {
|
||||
for ( String sample : sampleNames ) {
|
||||
header.append("\tcoverage_for_");
|
||||
header.append(sample);
|
||||
}
|
||||
}
|
||||
out.println(header.toString());
|
||||
printHeaderLine(false);
|
||||
}
|
||||
|
||||
public DoCInfo map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
|
||||
|
|
@ -217,17 +197,36 @@ public class DepthOfCoverageWalker extends LocusWalker<DepthOfCoverageWalker.DoC
|
|||
|
||||
// build and print the per-interval header
|
||||
out.println("\n\nPER_INTERVAL_COVERAGE_SECTION");
|
||||
printHeaderLine(true);
|
||||
|
||||
StringBuilder header = new StringBuilder("location\ttotal_coverage\taverage_coverage\tcoverage_without_deletions\taverage_coverage_without_deletions");
|
||||
// print all of the individual per-interval coverage data
|
||||
for ( Pair<GenomeLoc, DoCInfo> result : results )
|
||||
printDoCInfo(result.first, result.second, true);
|
||||
|
||||
// if we need to print the histogram, do so now
|
||||
if ( printHistogram )
|
||||
printHisto();
|
||||
}
|
||||
|
||||
private void printHeaderLine(boolean printAverageCoverage) {
|
||||
|
||||
StringBuilder header = new StringBuilder("location\ttotal_coverage");
|
||||
if ( printAverageCoverage )
|
||||
header.append("\taverage_coverage");
|
||||
header.append("\tcoverage_without_deletions");
|
||||
if ( printAverageCoverage )
|
||||
header.append("\taverage_coverage_without_deletions");
|
||||
if ( excludeMAPQBelowThis > 0 ) {
|
||||
header.append("\tcoverage_atleast_MQ");
|
||||
header.append(excludeMAPQBelowThis);
|
||||
header.append("\taverage_coverage_atleast_MQ");
|
||||
header.append(excludeMAPQBelowThis);
|
||||
if ( printAverageCoverage ) {
|
||||
header.append("\taverage_coverage_atleast_MQ");
|
||||
header.append(excludeMAPQBelowThis);
|
||||
}
|
||||
}
|
||||
if ( minDepthForPercentage >= 0 ) {
|
||||
if ( printAverageCoverage && minDepthForPercentage >= 0 ) {
|
||||
header.append("\tpercent_loci_covered_atleast_depth");
|
||||
header.append(minDepthForPercentage);
|
||||
header.append(minDepthForPercentage);
|
||||
}
|
||||
if ( printBaseCounts ) {
|
||||
header.append("\tA_count\tC_count\tG_count\tT_count");
|
||||
|
|
@ -245,14 +244,6 @@ public class DepthOfCoverageWalker extends LocusWalker<DepthOfCoverageWalker.DoC
|
|||
}
|
||||
}
|
||||
out.println(header.toString());
|
||||
|
||||
// print all of the individual per-interval coverage data
|
||||
for ( Pair<GenomeLoc, DoCInfo> result : results )
|
||||
printDoCInfo(result.first, result.second, true);
|
||||
|
||||
// if we need to print the histogram, do so now
|
||||
if ( printHistogram )
|
||||
printHisto();
|
||||
}
|
||||
|
||||
private void incCov(int depth) {
|
||||
|
|
@ -348,7 +339,7 @@ public class DepthOfCoverageWalker extends LocusWalker<DepthOfCoverageWalker.DoC
|
|||
}
|
||||
}
|
||||
|
||||
if ( minDepthForPercentage >= 0 ) {
|
||||
if ( printAverageCoverage && minDepthForPercentage >= 0 ) {
|
||||
sb.append("\t");
|
||||
sb.append(String.format("%.2f", ((double)info.minDepthCoveredLoci) / totalBases));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,13 +15,13 @@ public class DepthOfCoverageIntegrationTest extends WalkerTest {
|
|||
static {
|
||||
expectations.put("-minMAPQ 1", "8b73fad5cce4620907d5da2a985219d5");
|
||||
expectations.put("-minMAPQ 100", "1a959892d8ad0523dac2fb097eacb3c2");
|
||||
expectations.put("-minDepth 8", "6e8c6b6d78962d110c87ad905fa5b664");
|
||||
expectations.put("-minDepth 10", "14399e1237866540af3f1aee149030d0");
|
||||
expectations.put("-minDepth 8", "6d549e5a5c4c55420d68e0221a955a0e");
|
||||
expectations.put("-minDepth 10", "a367c894e6a48ebb107d2fe004cdfee7");
|
||||
expectations.put("-bySample", "93358437153b4d65bdff747e33de1d63");
|
||||
expectations.put("-byRG", "777e8427eb4bdad300b23800cb7b0592");
|
||||
expectations.put("-histogram", "96f15e1d9d598d48191e20ee84715d46");
|
||||
expectations.put("-bases", "baafcb2b90098cad1c5950da9e9932a6");
|
||||
expectations.put("-minMAPQ 1 -bySample -byRG -minDepth 8 -histogram -bases", "eb27297504e003ce7bb42300dfd436fe");
|
||||
expectations.put("-minMAPQ 1 -bySample -byRG -minDepth 8 -histogram -bases", "bf2094b33e0e10fc11a7216bc1097a8b");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
Loading…
Reference in New Issue