解决方案
通过指定samtools view 的-f /-F/-G参数的FLAGS即可愉快的从bam中提取预期的reads
-f /-F/-G参数介绍
-f FLAG, --require-flags FLAG
Only output alignments with all bits set in FLAG present in the FLAG field. FLAG can be specified in hex by beginning with `0x' (i.e. /^0x[0-9A-F]+/), in octal by beginning with `0' (i.e. /^0[0-7]+/), as a decimal number not beginning with '0' or as a comma-separated list of flag names.
-F FLAG, --excl-flags FLAG, --exclude-flags FLAG
Do not output alignments with any bits set in FLAG present in the FLAG field. FLAG can be specified in hex by beginning with `0x' (i.e. /^0x[0-9A-F]+/), in octal by beginning with `0' (i.e. /^0[0-7]+/), as a decimal number not beginning with '0'