Skip to content

SAM file is not sorted ERROR even if the input file is sorted #260

@YuanfengZhang

Description

@YuanfengZhang

Describe the bug
SAM file is not sorted ERROR even if the input file is sorted

cd result/BL/trim-galore/no-pre-dedup/no-pre-calibrate/segemehl/samtools/no-calibrate
mkdir -p dnmtools
samtools sort -@ 16 -o BL.sorted.bam BL.bam
dnmtools counts \
    -c /data/BL.fa \
    -t 16  \
    -o dnmtools/BL.dnmtools.tmp \
    BL.sorted.bam
cd dnmtools

awk -F'\t' '$6 > 4' \
    BL.dnmtools.tmp \
    | pigz  -p 16 --best > BL.dnmtools.gz

stdout:

[bam_sort_core] merging from 0 files and 16 in-memory blocks...
[error: 0][ERRNO: 0][Success][SAM file is not sorted]

I'm sure that this error is from dnmtools instead of samtools

if (tid < prev_tid) throw dnmt_error("SAM file is not sorted");

I tried samtools index -n but it failed too. I wonder what exact sorting tool and method does dnmtools require?

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