This is a test version of Biostars. For the public version, visit https://www.biostars.org.
.bam files to fastq including the unmapped reads

Hello,

I have tophat output (.bam) generated by tophat and I want to convert them back to fastq files. Since it was mapped using tophat, I thought that the best tool to do that will be: bam2fastx. Though, I want to refer both the mapped reads (tophat output: accepted_hits.bam) and the unmapped ones (tophat output: unmapped.bam). How can it be done?

Thanks!!

rna-seq rna-seq alignment

2 answers

You can convert accepted_hits.bam and unmapped.bam separately and then just merge the two FASTQs. It's just a text file, so the order does not matter.

If I only use the accepted reads (and afterwards turn it again to bam during the analysis) I can loose some information right? I wonder why there is no feature for doing this step backwards without loosing information...

Try bedtools bamtofastq. I have recently used this with single end reads from RNA-Seq, so not sure how well it works if you have paired-end reads.

Log in to answer this question.