This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Removing Human Reads From Metagenome BAM File

So I have metagenome bam files which contain reads for both human and bacteria. I would like to remove all the human reads so I can focus on the bacterial reads. Has anyone been able to remove human reads from their RNA-seq data using samtools or any other software?

rna-seq

You have it in a bam file, meaning it's already aligned? To what?

It was aligned to a metagenome database for human and bacteria.

2 answers

Align your reads to the human genome first, then extract all the unmapped reads to work with further. The unmapped reads will have all your bacteria (as well as other non-human things). Extracting unmapped paired end from an alignment - C: Extracting unmapped paired end from an alignment

This sounds like a job for BBsplit

Agree with @WouterDeCoster, BBSplit can be used, although it is very slow. Here is an example of it Tool to separate human and mouse rna seq reads from one of my posts.

You can probably use seal.sh from BBmap itself which is very fast. The example of Seal.sh is in the above link.

Log in to answer this question.