cultivarium / MicrobeMod

A toolkit for exploring prokaryotic methylation and base modifications in nanopore sequencing
MIT License
34 stars 1 forks source link

TypeError: can only concatenate str (not "NoneType") to str #22

Closed jbeckle3 closed 1 week ago

jbeckle3 commented 4 months ago

I am running a test using the example .bam and .fna files provided using the following shell scripting on an M1 Mac:

MicrobeMod call_methylation -b ./tests/test_data/test.bam -r ./tests/test_data/EcoliCVM05_GCF_000005845.2_ASM584v2_genomic.fna -t 10

However, I am getting the following error when it's running:

Traceback (most recent call last): File "/Users/johnbeckley/miniconda3/envs/microbemod/bin/MicrobeMod", line 173, in microbemod.main( File "/Users/johnbeckley/miniconda3/envs/microbemod/lib/python3.8/site-packages/MicrobeMod/microbemod.py", line 558, in main modkit_table_tmp = assign_motifs( File "/Users/johnbeckley/miniconda3/envs/microbemod/lib/python3.8/site-packages/MicrobeMod/microbemod.py", line 325, in assign_motifs "Found and trimmed motif: " TypeError: can only concatenate str (not "NoneType") to str

I also had this error with aws downloaded data. Any idea what the issue is here?

alexcritschristoph commented 4 months ago

Bit hard to figure out what's going on here from this.

  1. Can you check these dependencies?

    streme --version
    modkit --version
  2. Does this error occur on the m5c or m6a stage?

  3. What do your test_low.bed and test_m_pos_streme/streme.txt look like?

jbeckle3 commented 4 months ago

Here are the dependency versions:

(microbemod) johnbeckley@Johns-MBP-10 MicrobeMod % streme --version modkit --version 5.4.1 mod_kit 0.2.4

This is the furthest I get:

24-03-10 15:16:52 INFO Running modkit: modkit pileup -t 10 ./tests/test_data/test.bam test_low.bed -r ./tests/test_data/EcoliCVM05_GCF_000005845.2_ASM584v2_genomic.fna --only-tabs --filter-threshold 0.66 24-03-10 15:16:57 INFO Reading Modkit table... 24-03-10 15:16:58 INFO Retrieving sequences 24-03-10 15:16:58 INFO Total number of sites with any possible calls (including low quality): 116243 bases 24-03-10 15:16:58 INFO Median coverage (stranded): 53.0x 24-03-10 15:16:58 INFO Total number of sites with greater than min coverage (10x): 80836 bases 24-03-10 15:16:58 INFO Potential sites (>33%) for methylation type m: 573 bases 24-03-10 15:16:58 INFO High quality sites (>66%) for methylation type m: 421 bases 24-03-10 15:16:58 INFO Very high quality sites (>90%) for methylation type m: 348 bases 24-03-10 15:16:58 INFO Potential sites (>33%) for methylation type a: 1596 bases 24-03-10 15:16:58 INFO High quality sites (>66%) for methylation type a: 845 bases 24-03-10 15:16:58 INFO Very high quality sites (>90%) for methylation type a: 510 bases 24-03-10 15:16:58 INFO Running for Methylation type: 6mA 24-03-10 15:16:58 INFO Modkit table size: 57110 24-03-10 15:16:58 INFO 510 sites for STREME with cutoff 0.9 and min coverage 10 24-03-10 15:16:58 INFO Creating background control distribution: test_a_control.fasta 24-03-10 15:16:58 INFO Running STREME: streme . --n test_a_control.fasta -p test_a_pos.fasta -o test_a_pos_streme

So I assume this means that 6mA stage?

For the files:

streme.txt

test_low.txt

alexcritschristoph commented 4 months ago

Want to try an update to streme 5.5 and see if that fixes it?

Can you send the streme.xml as well?

jbeckle3 commented 4 months ago

Will try to do streme 5.5, but have been having trouble updating. Working on it.

streme.txt

streme_xml.txt

alexcritschristoph commented 4 months ago

Oh this definitely seems like a streme version. However, I think we can modify it to support older versions of streme.

Would you be able to test it out? In microbemod.py can you change this line (330):

motif.get("npassing")

to

motif.get("total_sites")

And then run pip install . again and give that a try? If that fixes your issue, I'll release a new version with that fix.

jbeckle3 commented 4 months ago

It worked! Thanks a lot for your help. That was the only streme version that I was able to install with conda.

test_motifs.txt

samuelmontgomery commented 3 months ago

Hi,

I am getting the same error using the test dataset with microbemod v1.0.3, but with streme version 5.5.2 installed streme.txt says "Stopped because the last motif found had no valid sites."

24-04-08 07:13:20 INFO Running modkit: modkit pileup -t 10 test.bam test_low.bed -r EcoliCVM05_GCF_000005845.2_ASM584v2_genomic.fna --only-tabs --filter-threshold 0.66 24-04-08 07:13:27 INFO Reading Modkit table... 24-04-08 07:13:28 INFO Retrieving sequences 24-04-08 07:13:28 INFO Total number of sites with any possible calls (including low quality): 116243 bases 24-04-08 07:13:28 INFO Median coverage (stranded): 53.0x 24-04-08 07:13:28 INFO Total number of sites with greater than min coverage (10x): 80836 bases 24-04-08 07:13:28 INFO Potential sites (>33%) for methylation type m: 573 bases 24-04-08 07:13:28 INFO High quality sites (>66%) for methylation type m: 421 bases 24-04-08 07:13:28 INFO Very high quality sites (>90%) for methylation type m: 348 bases 24-04-08 07:13:28 INFO Potential sites (>33%) for methylation type a: 1596 bases 24-04-08 07:13:28 INFO High quality sites (>66%) for methylation type a: 845 bases 24-04-08 07:13:28 INFO Very high quality sites (>90%) for methylation type a: 510 bases 24-04-08 07:13:28 INFO Running for Methylation type: 6mA 24-04-08 07:13:28 INFO Modkit table size: 57110 24-04-08 07:13:28 INFO 510 sites for STREME with cutoff 0.9 and min coverage 10 24-04-08 07:13:28 INFO Creating background control distribution: test_a_control.fasta 24-04-08 07:13:28 INFO Running STREME: streme . --n test_a_control.fasta -p test_a_pos.fasta -o test_a_pos_streme Traceback (most recent call last): Traceback (most recent call last): File "/home/ubuntu/scratch/software/miniforge3/envs/microbemod/bin/MicrobeMod", line 173, in microbemod.main( File "/home/ubuntu/scratch/software/miniforge3/envs/microbemod/lib/python3.10/site-packages/MicrobeMod/microbemod.py", line 558, in main modkit_table_tmp = assign_motifs( File "/home/ubuntu/scratch/software/miniforge3/envs/microbemod/lib/python3.10/site-packages/MicrobeMod/microbemod.py", line 325, in assign_motifs "Found and trimmed motif: " TypeError: can only concatenate str (not "NoneType") to str

Changing motif.get("npassing") to total_sites works for me as well However due to git everytime i run pip install . it reverts to the remote version but I've got it working

alexcritschristoph commented 3 months ago

Will try to release an update soon!

alexcritschristoph commented 1 week ago

fixed in #26