samtools index error
1
0
Entering edit mode
3.8 years ago
pt.taklifi ▴ 60

Hello everyone I am trying to extract uniquely aligned reads and sort them with samtools with the following command

samtools view -h -f 2 -q 10 -bS -@ 20 hg38.sam | samtools sort -n -@ 1 > hg38.sort.bam

after this when I try to index the output file

samtools index hg38.sort.bam

I get this error message

[E::hts_idx_push] Unsorted positions on sequence #16: 73874275 followed by 73874203
[E::sam_index] Read 'SRR10984462.26' with ref_name='chr16', ref_length=90338345, flags=163, pos=73874203 cannot be indexed
samtools index: failed to create index for "hg38.sort.bam": No such file or directory

any suggestions ?

alignment • 1.3k views
ADD COMMENT
2
Entering edit mode
3.8 years ago

option -n of samtools sort is for sorting on read name, not on coordinate. Remove this this.option.

ADD COMMENT

Login before adding your answer.

Traffic: 1692 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6