Hi there, I am trying to run an analysis on a group of bam files but first I want to remove the non-chromosomal regions (including MT/KN/KZ regions) and keep info for chr 1-25 (zebrafish model). I am using samtools view after looking through many suggestions however, even when I run this command, I checked the header of the new filtered output bam and it still contains these regions that I am not interested in.
samtools view -@ 50 -b -o Ctrl-01_MD_filtered.bam Ctrl-01_MD.bam 1 10 11 12 13 14 15 16 17 18 19 2 20 21 22 23 24 25 3 4 5 6 7 8 9
Note: The reference I am using does not contain "chr" prefix. Also, I double checked that my bam files are sorted so I've ruled that out as a possible issue. Using Samtools v. 1.18
Has anyone encountered this issue before or been able to use successfully?
do a count of the alignments to verify that the a region is removed:
or do an
idxstats
to see counts to all chromosomes