Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modkit repair - update MN tags? #126

Closed
jkh00 opened this issue Feb 12, 2024 · 4 comments
Closed

modkit repair - update MN tags? #126

jkh00 opened this issue Feb 12, 2024 · 4 comments
Labels
build-available custom build produced for fix.

Comments

@jkh00
Copy link

jkh00 commented Feb 12, 2024

Hi,

I ran into an issue while trying to align my trimmed modBam to an assembly and noticed it might be due to the outdated MN tags.

my current workflow:

  1. mod basecall using dorado
  2. adapters and barcodes trimming using porechop
  3. repair MM/ML tags using modkit repair
  4. align trimmed aligned modBam to reference using dorado aligner

I sorted both my donor and acceptor bam using samtools sort -n and ran:

modkit repair --threads 32 --log-filepath porechop_BC50_6mA_5mC_5hmC.log
--donor-bam sorted_barcode50_6mA_5mC_5hmC.bam
--acceptor-bam sorted_porechop_BC50_6mA_5mC_5hmC.bam
--output-bam repaired_sorted_porechop_BC50_6mA_5mC_5hmC.bam

Once this was done, I tried to align the repaired modbam to my assembly using dorado aligner, but I ran into error showing:

starting alignment
terminate called after throwing an instance of 'std::runtime_error'
what(): MN tag and sequence length are not in sync.
Aborted (core dumped)

I did a bit of digging on MN tags, and as my understanding from the discussion here: samtools/hts-specs#646 and documentation https://cdn.jsdelivr.net/gh/samtools/hts-specs@8c1fc489bb6f835e072f06a77e7ae73f54c30d92/new/SAMtags.pdf

MN tag and sequence length are not in sync.

This error is indicating that the MM/ML tags of my trimmed reads were not adjusted after trimming. I checked some records from my modBam, compared before and after the repair and it seems to work (the MM/ML tags were adjusted), only the MN tags were not change, could this be the issue itself?

I attached the sequences and tags before and after repaired for one record as reference.

example.txt

Many thanks in advance.

@ArtRand
Copy link
Contributor

ArtRand commented Feb 12, 2024

Hello @jkh00,

Thanks for bringing this to my attention. Indeed modkit repair is failing to update the MN tag. It's an easy fix. I've attached a build to this thread that corrects the tag. Thank you for the thorough description of your procedure by the way. This fix will certainly make it into the next release.
modkit_v0.2.5-dev1cd8775_centos7_x86_64.tar.gz

@jkh00
Copy link
Author

jkh00 commented Feb 13, 2024

Hi @ArtRand ,

Thanks! Glad I could help, the build you provided works : )

@jkh00 jkh00 closed this as completed Feb 13, 2024
@ArtRand
Copy link
Contributor

ArtRand commented Feb 13, 2024

@jkh00, glad to hear it. I'm going to keep this issue open until the next release in case other folks need the build.

@ArtRand ArtRand reopened this Feb 13, 2024
@ArtRand ArtRand added repair build-available custom build produced for fix. labels Feb 13, 2024
@ArtRand
Copy link
Contributor

ArtRand commented Mar 5, 2024

@jkh00 This has been included in the v0.2.5 release.

@ArtRand ArtRand closed this as completed Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build-available custom build produced for fix.
Projects
None yet
Development

No branches or pull requests

2 participants