All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.broadinstitute.hellbender.tools.CountBases Maven / Gradle / Ivy

The newest version!
package org.broadinstitute.hellbender.tools;

import org.broadinstitute.barclay.argparser.ArgumentCollection;
import org.broadinstitute.barclay.argparser.CommandLineProgramProperties;
import org.broadinstitute.barclay.argparser.WorkflowProperties;
import org.broadinstitute.barclay.help.DocumentedFeature;
import org.broadinstitute.hellbender.cmdline.argumentcollections.OptionalTextOutputArgumentCollection;
import org.broadinstitute.hellbender.cmdline.programgroups.CoverageAnalysisProgramGroup;
import org.broadinstitute.hellbender.engine.FeatureContext;
import org.broadinstitute.hellbender.engine.ReadWalker;
import org.broadinstitute.hellbender.engine.ReferenceContext;
import org.broadinstitute.hellbender.utils.read.GATKRead;

/**
 * Count and print to standard output (and optionally to a file) the total number of bases in a SAM/BAM/CRAM file
 *
 * 

Input

*
    *
  • A single BAM file
  • *
* *

Example

* *
 *   gatk CountBases \
 *     -I input_reads.bam
 * 
*/ @DocumentedFeature @CommandLineProgramProperties( summary = "Count and print to standard output (and optionally to a file) the total number of bases in a SAM/BAM/CRAM file", oneLineSummary = "Count bases in a SAM/BAM/CRAM file", programGroup = CoverageAnalysisProgramGroup.class ) @WorkflowProperties public final class CountBases extends ReadWalker { private long count = 0; @ArgumentCollection final public OptionalTextOutputArgumentCollection out = new OptionalTextOutputArgumentCollection(); @Override public void apply( GATKRead read, ReferenceContext referenceContext, FeatureContext featureContext ) { count += read.getLength(); } @Override public Object onTraversalSuccess() { out.print(count); return count; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy