I'm trying to combine outputs from various view queries each with its own criteria into one bam file. From my bash script:
samtools view -b -F 12 -f 50 $bam_file > $bam_inconsistent # Wrong orientation -/- samtools view -b -F 60 -f 2 $bam_file >> $bam_inconsistent # Wrong orientation +/+ samtools view -b -F 14 $bam_file >> $bam_inconsistent # Wrong insert size
Unfortunately only the first command seems to take effect.How can I fix this? Thank you.
(BTW, if there's an easier way to accomplish what I want, I'm open to any suggestion, although I would still like to understand why the above doesn't work.) Thank you.
Edit: I've found out why this doesn't work. A binary cannot be appended. Looks like I'll have to use sam output and convert back to bam.