CountBasesWalker -- a quick QC walker.

This commit is contained in:
Mauricio Carneiro 2012-04-23 17:24:22 -04:00
parent e440d0ce69
commit 82b4798913
1 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,51 @@
package org.broadinstitute.sting.gatk.walkers.qc;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.DataSource;
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
import org.broadinstitute.sting.gatk.walkers.Requires;
import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
/**
* Walks over the input data set, calculating the number of reads seen for diagnostic purposes.
*
* <p>
* Can also count the number of reads matching a given criterion using read filters (see the
* --read-filter command line argument). Simplest example of a read-backed analysis.
*
*
* <h2>Input</h2>
* <p>
* One or more BAM files.
* </p>
*
* <h2>Output</h2>
* <p>
* Number of reads seen.
* </p>
*
* <h2>Examples</h2>
* <pre>
* java -Xmx2g -jar GenomeAnalysisTK.jar \
* -R ref.fasta \
* -T CountReads \
* -o output.txt \
* -I input.bam \
* [-L input.intervals]
* </pre>
*
*/
@Requires({DataSource.READS, DataSource.REFERENCE})
public class CountBasesWalker extends ReadWalker<Integer, Long> {
public Integer map(ReferenceContext ref, GATKSAMRecord read, ReadMetaDataTracker tracker) {
return read.getReadLength();
}
public Long reduceInit() { return 0L; }
public Long reduce(Integer value, Long sum) {
return (long) value + sum;
}
}