Sam/Bam Manipulation

java -jar picard.jar
Function: Converts a SAM or BAM file to FASTQ. This tool extracts read sequences and base quality scores from the input SAM/BAM file and outputs them in FASTQ format. This can be used by way of a pipe to run BWA MEM on unmapped BAM (uBAM) files efficiently.
Usage: java -jar picard.jar SamToFastq I=input.bam FASTQ=output.fastq
samtools view
Function: Converts BAM dataset to SAM
Usage: samtools view -o [OUTPUT SAM] [-h|-H] [INPUT BAM]
bamtools
Function: Create index for BAM file
Usage: bamtools index -i <BAM FILE>
java -jar picard.jar
Function: Calculate PCR-related metrics from targeted sequencing data.
Usage: java -jar picard.jar CollectTargetedPcrMetrics I=input.bam O=pcr_metrics.txt R=reference_sequence.fasta AMPLICON_INTERVALS=amplicon.interval_list TARGET_INTERVALS=targets.interval_list
java -jar picard.jar
Function: Reverts the original base qualities and adds the mate cigar tag to read-group BAMs.
Usage: java -jar picard.jar RevertOriginalBaseQualitiesAndAddMateCigar
java -jar picard.jar
Function: Converts a BED file to a Picard Interval List. This tool provides easy conversion from BED to the Picard interval_list format which is required by many Picard processing tools. Note that the coordinate system of BED files is such that the first base or position in a sequence is numbered "0", while in interval_list files it is numbered "1".BED files contain sequence data displayed in a flexible format that includes nine optional fields, in addition to three required fields within the annotation tracks. The required fields of a BED file include:
Usage: java -jar picard.jar chrom - The name of the chromosome (e.g. chr20) or scaffold (e.g. scaffold10671) chromStart - The starting position of the feature in the chromosome or scaffold. The first base in a chromosome is numbered "0" chromEnd - The ending position of the feature in the chromosome or scaffold. The chromEnd base is not included in the display of the feature. For example, the first 100 bases of a chromosome are defined as chromStart=0, chromEnd=100, and span the bases numbered 0-99.
java -jar picard.jar
Function: Merges multiple VCF or BCF files into one VCF file. Input files must be sorted by their contigs and, within contigs, by start position. The input files must have the same sample and contig lists. An index file is created and a sequence dictionary is required by default.
Usage: java -jar picard.jar MergeVcfs
java -jar picard.jar
Function: Chart the distribution of quality scores.
Usage: java -jar picard.jar QualityScoreDistribution I=input.bam O=qual_score_dist.txt CHART=qual_score_dist.pdf
java -jar picard.jar
Function: Collects hybrid-selection (HS) metrics for a SAM or BAM file. This tool takes a SAM/BAM file input and collects metrics that are specific for sequence datasets generated through hybrid-selection. Hybrid-selection (HS) is the most commonly used technique to capture exon-specific sequences for targeted sequencing experiments such as exome sequencing; for more information, please see the corresponding GATK Dictionary entry.
Usage: java -jar picard.jar CollectHsMetrics I=input.bam O=hs_metrics.txt R=reference_sequence.fasta BAIT_INTERVALS=bait.interval_list TARGET_INTERVALS=target.interval_list
java -jar picard.jar
Function: Takes a SAM or BAM file and separates all the reads into one SAM or BAM file per library name. Reads that do not have a read group specified or whose read group does not have a library name are written to a file called 'unknown.' The format (SAM or BAM) of the output files matches that of the input file.
Usage: java -jar picard.jar SplitSamByLibrary
java -jar picard.jar
Function: Collects Illumina Basecalling metrics for a sequencing run.
Usage: java -jar picard.jar CollectIlluminaBasecallingMetrics BASECALLS_DIR=/BaseCalls/ LANE=001 READ_STRUCTURE=25T8B25T INPUT=barcode_list.txt
bamtools
Function: The command bamtools resolve resolves paired-end reads. The resolving mode is required, and it can be -makeStats, -markPairs, or -twoPass.
Usage: bamtools resolve -twoPass -in input_alignments.bam -out output_alignments.bam
samtools reheader
Function: Copies header from source dataset into target dataset using samtools reheader command.
Usage: samtools reheader [-iP] in.header.sam in.bam
java -jar picard.jar
Function: Create BFQ files from a BAM file for use by the maq aligner. BFQ is a binary version of the FASTQ file format. This tool creates bfq files from a BAM file for use by the maq aligner.
Usage: java -jar picard.jar BamToBfq I=input.bam ANALYSIS_DIR=analysis_dir OUTPUT_FILE_PREFIX=output_file_1 PAIRED_RUN=false
java -jar picard.jar
Function: Not to be confused with SortSam which sorts a SAM or BAM file with a valid sequence dictionary, ReorderSam reorders reads in a SAM/BAM file to match the contig ordering in a provided reference file, as determined by exact name matching of contigs. Reads mapped to contigs absent in the new reference are dropped. Runs substantially faster if the input is an indexed BAM file.
Usage: java -jar picard.jar ReorderSam