1. Install Samtools
-
Samtools is a suite of programs for interacting with high-throughput sequencing data.
-
Download
samtools-1.9,bcftools-1.9,htslib-1.9from htslib.org -
First install
htslib-1.9 -
Unzip & go inside htslib folder in terminal and type the following.
./configure make sudo make install -
Install
samtools-1.9&bcftools-1.9using the same commands.
👉 Note:
- If there are broken packages in the system like
Albacore, it wont allow you to install new packages. - So force remove those packages using this link here.
2. Convert SAM to BAM
- To do anything meaningful with alignment data:
-
first convert the SAM to its binary counterpart, BAM format using:
samtools view -b lambda.sam > lambda.bam
-b= output format in BAM -
3. Sort the BAM
-
Current aligners produce alignments in random order with respect to their position in the reference genome.
-
It must be sorted such that the alignments occur in
genome order, using:samtools sort lambda.bam -o lambda.sorted.bam-o= output file
4. index the sorted BAM
-
Indexing is done to quickly query or extract alignments.
`samtools index lambda.sorted.bam`