# Is there a sam flag for all&none of the reads?

a. Is there a SAM flag that specifies all reads? b. Is there a SAM flag that specifies none of the reads?

So that if I run samtools view -f (a) -F (b) the result will be all reads of the file (as if omitting the specification) ?

Instead of doing this kind of tweaking I would write my script in a way that these options are passed as strings that can be empty. Something like:

#/ dummy syntax just for illustration:
if(you_want_filtering){
filter_f='-f something'
filter_F='-F something_else'
} else {
filter_f=filter_F=''
}

samtools view (...) $${filter_f}$${filter_F}


So if you want all reads then make these strings empty. That is far more generic than your idea because it can well be that the flag values you need do not exist.

• This is the proper approach and I'll add that you can't specify all reads using -f unless all of the reads happen to have a given flag set (or all not have a particular flag set). The best you could do was exclude a flag of 4 to ensure only mapped reads. Oct 12 '21 at 20:25