I'm filtering my sam file using the following command:
samtools view -Sb -f 2 -F 256
after doing some research I think I've figured out what the flags mean (correct me if I'm wrong).
-f 2
is keeping only reads that are "properly aligned according to the aligner"
-F 256
is discarding "secondary alignments"
- I'm not really sure what "properly aligned" entails but is it maybe too stringent? Typically I've seen people use only
-F 4
to discard unmapped reads. - If I'm correct a secondary alignment is a second tier alignment in which the read that matches with a lesser score than some other read. If so, is discarding this reasonable or again too stringent?
I'm new to this so I'd really value some input on how to select these two flags. I've seen a wide variety/combinations of them used. My reads are paired end ones from WGS studies in yeast and E. coli and I'm using them to call SNPs/indels using freebayes.
Thank you
What do you actually want to do with the resulting BAM files? It's quite possible that you don't need to do any filtering at all.
Ah forgot to mention. I'm using the bam for SNP calling using freebayes