Question: Extract reads from BAM file
gravatar for Juan Ledesma
24 months ago by
United Kingdom
Juan Ledesma0 wrote:

Hi I have a BAM file with all the reads aligned to the reference sequence that I used to map them.

I would like to extract all the reads from the BAM file in order to get the nucleotide sequence aligning to the reference sequence for every single read.

If I use bam to sam tool, I will get the original sequence for each read, including regions that need be modified to map properly to the reference.

Does anyone have any clue about how to do it on Galaxy?


reads bam • 2.1k views
ADD COMMENTlink modified 24 months ago by Jennifer Hillman Jackson25k • written 24 months ago by Juan Ledesma0
gravatar for Jennifer Hillman Jackson
24 months ago by
United States
Jennifer Hillman Jackson25k wrote:


Picard's SamToFastq will also extract reads. That tool as wrapped has filtering options or you can pre-filter with other tools in this group. For example: filter for reads that map without any mismatches. Note that this tool does extract the entire read unless clipping is specified, but that is more about removing adaptor regions that are tagged.

In this post, a script was linked that extracts reads in a slightly different way. It extracts sequences with soft-clipped ends excluded.

If others know of alternate tools, please also post. Nearly any tool can be wrapped for Galaxy (including the one in the link above).

This wasn't clear in your question, but you are looking for internal differences between your reads and the reference, variant detection analysis would be appropriate.

Best, Jen, Galaxy team

ADD COMMENTlink written 24 months ago by Jennifer Hillman Jackson25k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 169 users visited in the last hour