We did an alignment with BWA and have 4 BAM files. How can I filter only mitochondria reads with Bowtie ?
We did an alignment with BWA and have 4 BAM files. How can I filter only mitochondria reads with Bowtie ?
EDIT:
You should read the SAM format specification. The 3rd column tells the name of your chromosome in the reference. If ChrM
is your mitochondrial chromosome name, and you want to merge filtered multiple bam (with corresponding .bai files available) files, then you could do:
samtools merge -r -h file1.bam -R ChrM ChrM_merged.bam *.bam
OLD REPLY:
samtools view my_file.bam | grep "ChrM" > mitochondria_alone.txt
samtools view decodes the binary sam file (bam file) for you and displays on screen. I write here .txt
because, for it to be a sam format, you should have the header as well which you can obtain by
samtools view -H my_file.bam
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Are you working with BWA or bowtie?
I'm working with Bowtie :)