This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Samtools: exclude secondary and supplementary alignments

Hello!

I have a question regarding how samtools -F handles certain flags. I have bam files from RNA-seq and wish to exclude supplementary and secondary alignments, so part of my analysis includes the following command(s):

samtools collate -@ 32 -O input.bam tmp_prefix | \
samtools fixmate -@ 32 -mu - - | \
samtools sort -@ 32 -u - | \
samtools view -@ 6 -F 256,2048 -q 20 -h - -b -o output_filtered.bam

In my output bam file I have reads with flags such as 292, which is also not a primary alignment. I assumed that by specifying 256 and 2048 these reads would also be excluded. Do I have to specify all possible flags that would indicate a not primary alignment in my script then?

Thanks :)

samtools

0 answers

No answers yet.

Log in to answer this question.