Question: samtool sort error in sorting BAM files by read name
gravatar for egrossi
10 months ago by
egrossi0 wrote:


I'm trying to sort my BAM file by read names (-n) on Galaxy but it gives me this error: [bam_index_core] the alignment is not sorted: reads without coordinates prior to reads with coordinates. [bam_index_build2] fail to index the BAM file. [bam_sort_core] merging from 123 files...

Is it a problem with the tool or with my BAM file (though I tried with different ones)? Thanks!

ADD COMMENTlink modified 10 months ago by Jennifer Hillman Jackson25k • written 10 months ago by egrossi0
gravatar for Jennifer Hillman Jackson
10 months ago by
United States
Jennifer Hillman Jackson25k wrote:


Convert the data to SAM format, then queryname sort. Or, queryname sort directly with Picard's SortSAM.

Samtools can only create coordinate-sorted BAM indexes in Galaxy. Picard has a queryname sort function and that always outputs a SAM file (even when BAM is input).

The Samtools Sort tool will be modified soon. The queryname sort/BAM output should be a failed result and could be considered a bug. There will be a new datatype for BAMs with a technically "unknown" sort-state in the next release named NativeBAM (can be queryname sorted or left unsorted). Tools that require queryname sorted input will be modified to have the option to re-sort directly on the tool form (some already do, example: Htseq_count).

These changes will help avoid many usage-level errors in the future. Some discussion to clear up exactly how this will work going forward was at our Gitter channel this afternoon if you are interested.

Thanks! Jen, Galaxy team

ADD COMMENTlink modified 10 months ago • written 10 months ago by Jennifer Hillman Jackson25k

Sort by chromosomal coordinates is also showing error... it is showing error to set metadata, however size of output file is 0 bytes

ADD REPLYlink written 9 months ago by xpna01t0
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: 172 users visited in the last hour