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
CAACATAAATTTGGCACACAAATAGTTCTCCATTAACCCTTTTAGTAAAAAGAGTAGAATCTATTTTCCAATTTCAAAGCCTTTTTCAATGAGGAACTTGGTTAAGCATTTATAGATCGGAAGAGCGTCGTGTAGGGAAAGAGTGTAGAT
CCCFFFFFHHHHHJJHJJJJJJHIIHIJJJJJJJJJJJJJJJJJJHIIJJHIIIBBFHIIJJJJJJJJJJIJJJJJJJHIHHHHHFFFFFFEEEEDDDDDDDDDDCDDCDDEFEDDEDDDDDBDDDB@BDBDACDDBCDDDDC
>C>BCDA YT:Z:UP
SRR1170581.75025193 133 6B_concat 1073997887 0 * = 1073997887 0
AGGGTAGTAGCATTGCCCCTTCTCTCTTTTTCTCTCATTTTTTTGTTTTATCTTTTTTTGGGGGGGCCCTCTATTTTTTTGGCCTCTTTTTTTTCGTCCGGAGTCTCAACCCGACTTGTGGGGGAATCATAGTCTCCATCATCCTTTCCT
BBCFDDFFHHHHHJJJJJJJJIIIJJJJJJJIIIJJGIIJJJJJJJJJJGFHIJJJJJHFFDDDDDDDDDDDCDEEEDDDD@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
Samtools-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/samtools-help

Reply via email to