philres / ngmlr

NGMLR is a long-read mapper designed to align PacBio or Oxford Nanopore (standard and ultra-long) to a reference genome with a focus on reads that span structural variations
MIT License
284 stars 41 forks source link

NGMLR with samtools 1.10 and 1.11 #86

Open marcotoffoli opened 3 years ago

marcotoffoli commented 3 years ago

This issue is somewhat related to #75 I use NGMLR to align data produced by nanopore using the command: ngmlr -t8 -r ./reference.fa -q ./reads.fastq -o ./output.sam -x ont -bam-fix

And get proper output.

When I try to sort with samtools sort ./output.sam -o ./sorted.bam

I get the error parse error at line 20892 samtools sort: truncated file. Aborting

This only happens with samtools versions 1.10 and 1.11, while it works normally with samtools version 1.09.

Any help?

OmarOakheart commented 3 years ago

Have you checked line 20892 in your sam file? I think it's very likely that you'll find the mapping quality is given as a negative integer. If you do, then it's also related to #83

marcotoffoli commented 3 years ago

Have you checked line 20892 in your sam file? I think it's very likely that you'll find the mapping quality is given as a negative integer. If you do, then it's also related to #83

Hi nPhasePipeline, you are right, read quality is negative there. Hopefully someone will be able to merge our two issues (and issue #75) and to help us solving it.

OmarOakheart commented 3 years ago

That means your problem is that newer versions of samtools do some file formats format checks that 1.09 doesn't do. So they see a negative mapQ and presume that the entire file is broken and abort the entire process.

Unless if there is a specific feature in samtools >=1.10 you want, or if you're interested in using mapQ for all of your reads, you can continue with 1.09 until there's a fix, which is what I'm doing.

marcotoffoli commented 3 years ago

That means your problem is that newer versions of samtools do some file formats format checks that 1.09 doesn't do. So they see a negative mapQ and presume that the entire file is broken and abort the entire process.

Unless if there is a specific feature in samtools >=1.10 you want, or if you're interested in using mapQ for all of your reads, you can continue with 1.09 until there's a fix, which is what I'm doing.

Yep, that's what I've been doing so far

RonaldOellers commented 2 years ago

Has anything changed regarding this? I think I am running into the same error, though the error message is a different one in samtools 1.12: samtools view: error reading file "/data/MN1.sam": Input/output error samtools view: error closing "/data//MN1.sam": -5 When trying to convert from .sam to .bam. If I switch to version 1.9 its fine.