I looked around and couldn't find an example that meets my needs. I have a bam file with all the hg19 chromosomes and I want to remove the unmapped reads that are located at chrM specifically rather than an entire bam operation. I can think of splitting the bam into chromosomes and treating individually but is there a way to do this without extra steps? It is
samtools view -F 4 or
samtools view -F 12 ONLY for chrM yet the input is file is still the entire bam file and the output file is still the entire bam file with only the unwanted reads on chrM filtered out.