An example script pileup.py is installed with this module.
This script will generate an output that is similar to samtools pileup with the addition of several optional columns that summarize
counts for individual nucleotides (ACTGN) and deletions with respect to the reference (-). This script leverages the Sam.gapped() and
Sam.parse_md() methods to reconstruct position-specific counts from SAM alignment records.
$ pileup.py -h
usage: pileup [-h] [--version] [-c] [-i STATS] bam pileup
generate a simple pileup-like file from a sorted/indexed BAM file
positional arguments:
bam sorted/indexed BAM file
pileup pileup output file
optional arguments:
-h, --help show this help message and exit
--version show program's version number and exit
-c, --counts display counts for A/C/T/G/N/- separately (default: False)
-i STATS, --stats STATS
tabulate mismatches to output file
Simple SAM parsing
Requiring no external dependencies (except a samtools installation for BAM reading)
Installation
pip install simplesamUsage
For complete module documentation visit ReadTheDocs.
Quickstart
Read from SAM/BAM files
Access alignments using an iterator interface
Read the SAM sequence header structure
Write SAM files from
SamobjectsWrite SAM files from
Samobjects to stdout (allowssamtools viewcompression)Example scripts
An example script
pileup.pyis installed with this module. This script will generate an output that is similar tosamtools pileupwith the addition of several optional columns that summarize counts for individual nucleotides (ACTGN) and deletions with respect to the reference (-). This script leverages theSam.gapped()andSam.parse_md()methods to reconstruct position-specific counts from SAM alignment records.