Skip to content

NO_COOR error when trying to index the output bam file #71

@ghost

Description

Hi,

I am running the following elprep command

elprep sfm input.bam outputl.bam \
  --mark-duplicates \
  --mark-optical-duplicates output.mkdup.metrics \
  --sorting-order coordinate \
  --bqsr output.recal \
  --known-sites ${references__dbsnp} \
  --known-sites ${references__hapmap} \
  --reference ${references__elfasta} \
  --haplotypecaller output.vcf.gz \
  --tmp-path $(TMPDIR) \
  --nr-of-threads ${resources__threads}

When I try to run

samtools index outputl.bam

I get the following error

[E::hts_idx_push] NO_COOR reads not in a single block at the end 0 -1
[E::sam_index] Read 'HWI-D00360:5:H814YADXX:1:1111:9027:67970' with ref_name='chr1', ref_length=248956422, flags=163, pos=10004 cannot be indexed

Usually, this would imply that the output bam is not coordinate sorted. However, the coordinate sorted flag is set, and when I run
stats to check if samtools thinks the file is coordiante sorted, then it seems that samtools thinks it is sorted.

samtools stats output.bam | grep "is sorted:"
SN	is sorted:	1

Further, when I run output.bam through samtools sort, the NO_COOR error goes away and the newly sorted bam is indexed appropriately.

I am not sure what the issue here is, but samtools stats thinks the output of elprep is sorted. On the other hand it requires another sort command to get the output bam to be indexed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions