Basic Samtools
Count number of records per reference in bamfile
samtools idxstats thing.bamConvert sam into bam (and back again)
Samtools can be used to convert between sam and bam:
-bindicates that the input file will be in BAM format-Sindicates that the stdout should be in SAM format
samtools view -sB thing.bam > thing.samAnd to convert between sam and bam:
samtools view thing.sam > thing.bam
samtools sort thing.bam thing
samtools index thing.bamThis will produce a sorted, indexed bam. This will create the files thing.bam and thing.bam.bai. To use a bam you must have an index file.