This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Bowtie2 output alignments and non-alignments in same file

Hi everybody,

I'm using Bowtie2 and I'm trying to output the alignments to a SAM file and unmapped to fastq file. I know --no-unal option make sam file only contain the mapped reads; however, my fastq files will have zero content because all unmapped reads are omitted. Does anyone know any option(s) to fulfil both goals.

Thank you!

bowtie2 rna-seq

1 answer

I've revised your post to a question, as it is not a tool post. Also, Bowtie2 is not a good tool for RNA-seq since it is not splice-aware.

You can filter out unmapped reads from the sam file after the fact, and convert the filtered reads to fastq, with BBMap's reformat.sh:

reformat.sh in=reads.sam out=mapped.sam mappedonly
reformat.sh in=reads.sam out=unmapped.fq unmappedonly

Or use BBMap in the first place (which is splice aware) like this:

bbmap.sh in=reads.fq outm=mapped.sam outu=unmapped.fq ref=ref.fa maxindel=200k

Oh I'm actually on bacteria. Thank you for the BBMap one.

My mistake; for bacteria Bowtie2 is fine.

Log in to answer this question.