samtools

samtools

samtools

Quick start

samtools sort -@ 30  any.sam > sorted.bam
samtools index sorted.bam
samtools tview sorted.bam Trinity.fasta -p "ID:35" -d T > result

samtools tview sorted.bam ../../2-Trinity/Trinity.fasta -p "comp0_c0_seq1:35" -d H > 123.html
*.bam file *.fasta file  -p  posation, fasta name and star posation of the fasta :

Install

wget -c https://github.com/samtools/samtools/releases/download/1.12/samtools-1.12.tar.bz2
tar -xjf samtools-1.12.tar.bz2
cd samtools-1.12
ls
./configure
make & make install

Install through conda

conda install sra-tools

Sorting by bam files

samtools sort bwa.bam -o bwa.sorted.bam > bwa.sorted.bam

Index

samtools faidx genome.fna

Depth count

samtools depth -r 2R:24687896-24687900 out.bam
2R	24687896	41
2R	24687897	41
2R	24687898	41
2R	24687899	41
2R	24687900	41

Reads counts in bam

# counting all reads
samtools view -c SAMPLE.bam
# or
samtools view SAMPLE.bam |wc
# counting only mapped reads
samtools view -c -F 260 SAMPLE.bam

Time cousts for -c and wc

-c |wc -l
0m16.497s 0m44.720s
Author

Karobben

Posted on

2020-07-28

Updated on

2024-10-31

Licensed under

Comments