Quick update.
I just used sambamba_v0.6.4 for sorting the same file and the sorted bam
file was as expected, the unmapped reads at the end and the reads mapping
to each reference grouped by sequence and sorted by coordinates. From this,
it seems to me it was a bug in samtools sort.
Cheers,
Juan montenegro
2016-10-07 15:24 GMT+10:00 Juan Daniel Montenegro Cabrera <
[email protected]>:
> Hello,
>
> I just finished mapping illumina reads to a large reference sequence with
> bowtie2. I converted the sam output to sorted bam with this command:
>
> samtools view -bh@ 15 in.sam | samtools sort -T tmp -@ 15 -o
> out.sorted.bam -
>
> When I try to index the sorted bam file it complains:
>
> samtools index out.sorted.bam
> [E::hts_idx_push] NO_COOR reads not in a single block at the end 16 -1
> samtools index: "SORT.0.bam" is corrupted or unsorted
>
>
> when I check the last lines of the file, it effectively has mapped reads
> at the end, instead of the unmapped reads. The last 194 records in the
> sorted bam file are mapped reads and they come right after the unmapped
> reads:
>
> tail -n 195 SynOpDH_0.sam | head -n 2
> SRR1170581.75133375 141 * 0 0 * * 0 0 CAACATAAATTTGGCACACAAATAGTTCTC
> CATTAACCCTTTTAGTAAAAAGAGTAGAATCTATTTTCCAATTTCAAAGCCTTTTTCAAT
> GAGGAACTTGGTTAAGCATTTATAGATCGGAAGAGCGTCGTGTAGGGAAAGAGTGTAGAT
> CCCFFFFFHHHHHJJHJJJJJJHIIHIJJJJJJJJJJJJJJJJJJHIIJJHIIIBBFHII
> JJJJJJJJJJIJJJJJJJHIHHHHHFFFFFFEEEEDDDDDDDDDDCDDCDDEFEDDEDDD
> DDBDDDB@BDBDACDDBCDDDDC>C>BCDA YT:Z:UP
> SRR1170581.75025193 133 6B_concat 1073997887 0 * = 1073997887 0
> AGGGTAGTAGCATTGCCCCTTCTCTCTTTTTCTCTCATTTTTTTGTTTTATCTTTTTTTG
> GGGGGGCCCTCTATTTTTTTGGCCTCTTTTTTTTCGTCCGGAGTCTCAACCCGACTTGTG
> GGGGAATCATAGTCTCCATCATCCTTTCCT BBCFDDFFHHHHHJJJJJJJJIIIJJJJJJ
> JIIIJJGIIJJJJJJJJJJGFHIJJJJJHFFDDDDDDDDDDDCDEEEDDDD@CDDDDDDDDDDDCBBDBBBB@
> BCDDEDDDDD>BBDCCCDBD@9BBDDDCDDEEDDCDDDDDDDCCDCC YT:Z:UP
>
>
> In total there are 4561428 reads that map to the 6B_concat reference, but
> for some reason these 194 reads keep appearing at the end of the sorted
> file.
> Any ideas why this might be happening?
>
> Best regards,
>
> Juan Montenegro
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Samtools-help mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/samtools-help