This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Examples/Exercises on SAMtools operating on BAM format

Hello, i'm new in bioinformatics. Actually i'm studying what are the functions implemented by the SAMtools on the BAM format. To do this i'm studying functions from http://www.htslib.org/doc/samtools.html My goal is to understand and be able to use all the functions with the relative options (view, sort, ...)

So I have two questions to ask you:

1 - you have some material with many examples or exercises concerning these SAMtools functions to be used on the BAM

2 - someone kindly could make me a list of the most important functions: for example I imagine that view is very important, like the sort function. So to make me a sort of list with the main functions used

bam samtools

Hi Pierre thanks to your answer.

I have another question what is the difference between sort and index?

http://www.htslib.org/doc/samtools.html

samtools sort : Sort alignments by leftmost coordinates, or by read name

samtools index: Index a coordinate-sorted BAM or CRAM file for fast random access. This index is needed when region arguments are used to limit samtools view and similar commands to particular regions of interest.

sort generates a bamfile that is either sorted by mapping coordinates (RNAME and POS, fields 3 and 4; default behaviour), by read name or by tags. index will then generate an index file, that contains information where in the bamfile you can find reads that map to a certain reference sequence. This is needed for random access, so that software like genome browsers can directly access specific regions without having to read through the whole bamfile. Index requires a bamfile to be sorted by coordinate.

edit: boo, too late...

1 answer

you have some material with many examples or exercises concerning these SAMtools functions to be used on the BAM

toy* files under https://github.com/samtools/samtools/tree/develop/examples

convert to bam, sort, index, etc...

most important functions

samtools view samtools sort samtools index samtools faidx

imho

Log in to answer this question.