Sam/Bam Manipulation

java -jar picard.jar
Function: Asserts the provided gzip file's (e.g., BAM) last block is well-formed; RC 100 otherwise
Usage: java -jar picard.jar CheckTerminatorBlock
java -jar picard.jar
Function: Prints a SAM or BAM file to the screen.
Usage: java -jar picard.jar ViewSam
java -jar picard.jar
Function: Adds comments to the header of a BAM file.This tool makes a copy of the input bam file, with a modified header that includes the comments specified at the command line (prefixed by @CO). Use double quotes to wrap comments that include whitespace or special characters. Note that this tool cannot be run on SAM files.
Usage: java -jar picard.jar AddCommentsToBam I=input.bam O=modified_bam.bam C=comment_1 C="comment 2"
samtools idxstats
Function: Retrieve and print stats in the index file corresponding to the input file. Before calling idxstats, the input BAM file must be indexed by samtools index.
Usage: samtools idxstats aln.sorted.bam
java -jar picard.jar
Function: Generates a BAM index ".bai" file. This tool creates an index file for the input BAM that allows fast look-up of data in a BAM file, lke an index on a database. Note that this tool cannot be run on SAM files, and that the input BAM file must be sorted in coordinate order.
Usage: java -jar picard.jar BuildBamIndex I=input.bam
samtools fasta
Function: Converts a BAM or CRAM into either FASTQ or FASTA format depending on the command invoked.
Usage: samtools fasta [options] in.bam
java -jar picard.jar
Function: DEPRECATED: Use CollectHsMetrics instead. Calculates a set of Hybrid Selection specific metrics from an aligned SAMor BAM file. If a reference sequence is provided, AT/GC dropout metrics will be calculated, and the PER_TARGET_COVERAGE option can be used to output GC and mean coverage information for every target.
Usage: java -jar picard.jar CalculateHsMetrics
java -jar picard.jar
Function: Splits SNPs and INDELs into separate files. This tool reads in a VCF or BCF file and writes out the SNPs and INDELs it contains to separate files. The headers of the two output files will be identical and index files will be created for both outputs. If records other than SNPs or INDELs are present, set the STRICT option to "false", otherwise the tool will raise an exception and quit.
Usage: java -jar picard.jar SplitVcfs I=input.vcf SNP_OUTPUT=snp.vcf INDEL_OUTPUT=indel.vcf STRICT=false
bamtools
Function: Print header from BAM file(s)
Usage: bamtools header -in input_alignments.bam -out output_alignments_header.txt
java -jar picard.jar
Function: Collects metrics from reduced representation bisulfite sequencing (Rrbs) data.
Usage: java -jar picard.jar CollectRrbsMetrics R=reference_sequence.fasta I=input.bam M=basename_for_metrics_files
read_quality.py
Function: According to SAM specification, if Q is the character to represent “base calling quality” in SAM file, then Phred Quality Score = ord(Q) - 33. Here ord() is python function that returns an integer representing the Unicode code point of the character when the argument is a unicode object, for example, ord(‘a’) returns 97. Phred quality score is widely used to measure “reliability” of base-calling, for example, phred quality score of 20 means there is 1/100 chance that the base-calling is wrong, phred quality score of 30 means there is 1/1000 chance that the base-calling is wrong. In general: Phred quality score = -10xlog(10)P, here P is probability that base-calling is wrong.
Usage: read_quality.py -i Pairend_nonStrandSpecific_36mer_Human_hg19.bam -o output
java -jar picard.jar
Function: Collects per-sample and aggregate (spanning all samples) metrics from the provided VCF file.
Usage: java -jar picard.jar CollectVariantCallingMetrics
java -jar picard.jar
Function: Cleans the provided SAM/BAM, soft-clipping beyond-end-of-reference alignments and setting MAPQ to 0 for unmapped reads
Usage: java -jar picard.jar CleanSam
bamtools
Function: filters BAM file(s)
Usage: bamtools filter -in <BAM file> -out <BAM file> -length 100
java -jar picard.jar
Function: Compare two metrics files.This tool compares the metrics and histograms generated from metric tools to determine if the generated results are identical. This tool is useful to test and compare outputs when code changes are implemented. It is not meant for use by end-users of this toolkit. The tool's output simply indicates whether two metrics files are equal or not equal.
Usage: java -jar picard.jar CompareMetrics metricfile1.txt metricfile2.txt