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

On 3/26/12 10:52 AM, Carlos Borroto 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
___________________________________________________________
The Galaxy User list should be used for the discussion of
Galaxy analysis and other features on the public server
at usegalaxy.org.  Please keep all replies on the list by
using "reply all" in your mail client.  For discussion of
local Galaxy instances and the Galaxy source code, please
use the Galaxy Development list:

   http://lists.bx.psu.edu/listinfo/galaxy-dev

To manage your subscriptions to this and other Galaxy lists,
please use the interface at:

   http://lists.bx.psu.edu/
___________________________________________________________
The Galaxy User list should be used for the discussion of
Galaxy analysis and other features on the public server
at usegalaxy.org.  Please keep all replies on the list by
using "reply all" in your mail client.  For discussion of
local Galaxy instances and the Galaxy source code, please
use the Galaxy Development list:

 http://lists.bx.psu.edu/listinfo/galaxy-dev

To manage your subscriptions to this and other Galaxy lists,
please use the interface at:

 http://lists.bx.psu.edu/

Reply via email to