Sam/Bam Manipulation

bamCoverage
Function: This tool generates a bigWig or bedGraph file of fragment or read coverages.
Usage: bamCoverage [options] -b reads.bam -o coverage.bw
Supported input format: BAM
bamToBed
Function: bedtools bamtobed is a conversion utility that converts sequence alignments in BAM format into BED, BED12, and/or BEDPE records.
Usage: bamToBed [OPTIONS] -i <BAM>
infer_experiment.py
Function: “guess” how RNA-seq sequencing were configured, particulary how reads were stranded for strand-specific RNA-seq data
Usage: infer_experiment.py -r gene_annotation.bed -i input.bam [options]
samtools view
Function: View, convert format, or filter (with different criteria) alignments.
Usage: samtools view [options] in.sam|in.bam|in.cram [region...]
Supported input format: BAM, CRAM, SAM
samtools merge
Function: Merge multiple sorted alignment files, producing a single sorted output file that contains all the input records and maintains the existing sort order.
Usage: samtools merge [options] out.bam in1.bam ... inN.bam
Supported input format: BAM
bam2wig.py
Function: Convert BAM file into wig/bigWig format.
Usage: bam2wig.py -s chrom.sizes -i sample.bam -o out [options]
samtools addreplacerg
Function: Adds or replaces read group tags in a file.
Usage: samtools addreplacerg [-r rg line | -R rg ID] [-m mode] [-l level] [-o out.bam] <input.bam>
Supported input format: BAM
java -jar picard.jar
Function: Validates a SAM or BAM file.
Usage: java -jar picard.jar ValidateSamFile I=input.bam MODE=SUMMARY
bedtools bamtobed
Function: Convert sequence alignments in BAM format into BED, BED12, and/or BEDPE records
Usage: bedtools bamtobed [OPTIONS] -i <BAM>
Supported input format: BAM
bedtools bamtofastq
Function: Extract FASTQ records from sequence alignments in BAM format.
Usage: bedtools bamtofastq [OPTIONS] -i <BAM> -fq <FASTQ>
Supported input format: BAM
samtools stats
Function: samtools stats collects statistics from BAM files and outputs in a text format. The output can be visualized graphically using plot-bamstats.
Usage: samtools stats [options] in.sam|in.bam|in.cram [region...]
Supported input format: BAM, CRAM, SAM
bamtools
Function: The command bamtools split splits BAM file on user-specified property and creates a new BAM output file for each value found. In the given example, an output file input_alignments.MAPPED.bam is produced after -mapped split option is specified. Beside mapped, the split option can be: -paired, -reference, or -tag <tag_name>.
Usage: bamtools split -in input_alignments.bam -mapped
samtools bedcov
Function: Reports the total read base count (i.e. the sum of per base read depths) for each genomic region specified in the supplied BED file.
Usage: samtools bedcov [INPUT BED] [INPUT BAM1] ... [INPUT BAMn] > [OUTPUT]
Supported input format: BAM
samtools sort
Function: Converts SAM dataset into its binary, BAM.
Usage: samtools sort -O bam -o sorted_input.bam [INPUT SAM]
samtools fixmate
Function: Fill in information (insert size, cigar, mapq) about paired end reads onto the corresponding other read. It also has options to remove secondary/unmapped alignments and recalculate whether reads are proper pairs.
Usage: samtools fixmate [-rpc] [-O format] in.nameSrt.bam out.bam
Supported input format: BAM