Bioinformatics Asked by user9393 on May 19, 2021
I am doing an RNA seq analysis with mouse samples. I had my reads in several lanes, so I concatenated those fastq reads. Then I’ve mapped my reads with Hisat2 against the new version of mouse "GCA_000001635.9_GRCm39_genomic.fna".
Apparently everything works well up to here. Now I’m using samtools 1.9 to convert sam to bam, to sort those bam and create the index, just like this:
samtools view -bS ${file} > ${file}.bam
samtools sort -n ${file} -o ${file}_sorted.bam
samtools index ${file}_sorted.bam
But when indexing I get this error:
[bam_sort_core] merging from 11 files and 1 in-memory blocks…
[E::hts_idx_push] NO_COOR reads not in a single block at the end 0 -1
samtools index: failed to create index for
"CD4_1A_concat.bam_sorted.bam": No such file or directory[bam_sort_core] merging from 11 files and 1 in-memory blocks…
[E::hts_idx_push] NO_COOR reads not in a single block at the end 23 -1
samtools index: failed to create index for
"CD4_1B_concat.bam_sorted.bam": No such file or directory
[bam_sort_core] merging from 11 files and 1 in-memory blocks…
And more…
Any help would be appreciated!
This is essentially a duplicate of Samtools Index: Chromosome Blocks not Continuous but with different error messages, and a duplicate of Error given while trying to index a BAM file with Samtools Index - NO COOR?.
samtools sort -n ${file} -o ${file}_sorted.bam
These error messages also indicate that the reads are not sorted by coordinate — in particular, that the unplaced unmapped reads with RNAME *
are not all together at the end of the file.
This is because samtools sort -n
has been used to sort the reads by name instead. Remove -n
to sort by position, which is what is needed to prepare a BAM file for indexing with samtools index
.
Answered by John Marshall on May 19, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP