Question: How Can I Sort Bam/Sam File By Read Names?
0
gravatar for Carlos Borroto
6.7 years ago by
Washington Metropolitan Area
Carlos Borroto390 wrote:
Hi, I need to sort a BAM file by read names, I was wondering if this is possible with a tool included in Galaxy? I know any BAM file produced inside Galaxy will be sorted by coordinates, but I couldn't find an option to change this to queryname in any tool. Picard has the tool SortSam[1], perfect for this task, but it doesn't seem to be included at the moment. Is there any other option currently included? Are there any plans to include one? [1]http://picard.sourceforge.net/command-line-overview.shtml#SortSam Thanks, Carlos
galaxy • 2.3k views
ADD COMMENTlink modified 6.7 years ago by Jennifer Hillman Jackson25k • written 6.7 years ago by Carlos Borroto390
0
gravatar for Jennifer Hillman Jackson
6.7 years ago by
United States
Jennifer Hillman Jackson25k wrote:
Hello Carlos, Start by converting your BAM file to SAM, with "NGS: SAM Tools -> BAM-to-SAM". It is probably best to include the header if you plan to use the SAM file in downstream tools later on. If not, you can skip the step where it is saved. Next, to save back the SAM header into a separate dataset, use "Text Manipulation -> Select first lines from a dataset". Then, to remove the header lines (to create a working file), use "Text Manipulation -> Remove beginning of a file". Finally, to sort, use "Filter and Sort -> Sort" and select the column with the query name (c1) and choose the sort options. If you plan to use with with certain data tools, you may need to convert the format to tabular. Do this by clicking on the pencil icon for the dataset, and on the 'Edit Attributes' form, change the datatype to 'tabular'. If/when you do want to use this as a SAM file again, sort the data by coordinates, and add back in the header with "Text Manipulation -> Concatenate datasets", and change the datatype back to SAM. Most tools expecting a SAM input will need this format. Best, Jen Galaxy team
ADD COMMENTlink written 6.7 years ago by Jennifer Hillman Jackson25k
Please log in to add an answer.

Help
Access

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