Entering edit mode
3 months ago
Alexandra
•
0
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 :)
You can give a single flag that contains all relevant filters. Just click here (https://broadinstitute.github.io/picard/explain-flags.html) everything you don't want, and then provide the calculated flag the
-F
.