nanoporetech / modkit

A bioinformatics tool for working with modified bases
https://nanoporetech.com/
Other
139 stars 7 forks source link

Issue that "#failed to get modbase info for record XXX" #156

Closed xiangpingyu closed 6 months ago

xiangpingyu commented 6 months ago

Hi everybody.

We have a unaligned nanopore bam file with MM/ML tag. We use minimap2 and samtools to align the bam with reference.fa to get the sorted bam, and then run the modkit pileup to try to get bed file. However, we encourtered an issue that, " failed to get modbase info for record XXX, Skipped: AUX data not found.

image

Is there any modkit sub-command to solve this kind of result?

Thanks in advance for any help.

Sophia

samuelmontgomery commented 6 months ago

You need to make sure that when you convert to fastq you include the tags i.e. samtools fastq -T "*" bam > fastq

then minimap2 doesn't include them by default which can be fixed by including the -y flag i.e. minimap2 -ax lr:hq --secondary=no -y -t 16 reference.fa fastq > mapped.sam

alternatively, using dorado aligner to align your bam files to your reference results in a working mapped bam file in my experience

xiangpingyu commented 6 months ago

@samuelmontgomery When attempting to convert BAM files to FASTQ format using the command samtools fastq -T "*" bam > fastq, I observed that the MM/ML tags are not preserved. Are you aware of any alternative tools or methods that could retain these MM/ML tags during the conversion process?

Thank you, Sophia

ArtRand commented 6 months ago

Hello @xiangpingyu (and thanks @samuelmontgomery),

I would highly recommend using dorado aligner for mapping. It will handle the mod-base tags correctly. With the latest version you can re-map your unaligned BAM so that you don't have to re-basecall. If you're stuck with using samtools + minimap could you send the exact script you're running as well as the versions of those tools?

ArtRand commented 6 months ago

@xiangpingyu,

Any luck? You may be interested in the conversation at https://github.com/nanoporetech/modkit/issues/159.

xiangpingyu commented 6 months ago

@ArtRand thank you very much! I noticed that when using the command samtools fastq -T "*" bam > fastq, the MM/ML tags are not preserved. Consequently, I opted to use the Dorado aligner instead.

ArtRand commented 6 months ago

@xiangpingyu great!