Added argument to avoid writing 0 over all uncovered contigs, so you can just plot chrX, for example

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@5609 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
depristo 2011-04-10 13:50:21 +00:00
parent de4eaa455e
commit 13c5f3322d
1 changed files with 11 additions and 6 deletions

View File

@ -46,7 +46,10 @@ public class CoarseCoverageWalker extends ReadWalker<Integer,Integer> {
@Argument(fullName="granularity", shortName="G", doc="Granularity", required=true)
public Integer N;
@Argument(fullName="dontZeroMissingContigs", shortName="Z", doc="If provided, we won't emit 0 counts for all sites on contigs skipped", required=true)
public boolean dontZeroMissingContigs;
private int chunkStart = 1; // start of the current chunk we are counting reads for
private int contig = 0; // current contig we are on
private int count = 0; // number of reads overlapping with the current chunk
@ -73,11 +76,13 @@ public class CoarseCoverageWalker extends ReadWalker<Integer,Integer> {
count = 0;
// if we skipped one or more contigs completely, make sure we print 0 counts over all of them:
for ( contig++ ; contig < read.getReferenceIndex() ; contig++) {
int contigSize = read.getHeader().getSequence(contig).getSequenceLength();
for ( int k = 1 ; k < contigSize ; k+=N ) out.println(zeroString);
}
// by now we scrolled to the right contig
for ( contig++ ; contig < read.getReferenceIndex() ; contig++) {
if ( ! dontZeroMissingContigs ) {
int contigSize = read.getHeader().getSequence(contig).getSequenceLength();
for ( int k = 1 ; k < contigSize ; k+=N ) out.println(zeroString);
}
}
// by now we scrolled to the right contig
chunkStart = 1; // reset chunk start
}