Mykrobe-tools/mykrobe

TypeError: argument of type 'NoneType' is not iterable

idolawoye opened this issue · 7 comments

Hi @iqbal-lab, I am trying to run Mykrobe on some staph aureus samples and I am encounterig a 'NonType' is not iterable error message:

[mykrobe 2023-03-23T14:26:17 INFO] Running mykrobe predict using species staph, and panel version 20201001
[mykrobe 2023-03-23T14:26:17 INFO] Run command: /usr/local/lib/python3.9/site-packages/mykrobe/cortex/mccortex31 build -q -m 1GB -t 1 -k 15 -s staph-amr-bradley_2015-feb-17-2017-staph-species-160227 -1 /usr/local/lib/python3.9/site-packages/mykrobe/data/staph/staph-amr-bradley_2015-feb-17-2017.fasta.gz -1 /usr/local/lib/python3.9/site-packages/mykrobe/data/staph/staph-species-160227.fasta.gz mykrobe/data/skeletons/staph-amr-bradley_2015-feb-17-2017-staph-species-160227_15.ctx
[mykrobe 2023-03-23T14:26:17 INFO] Run command: /usr/local/lib/python3.9/site-packages/mykrobe/cortex/mccortex31 geno -t 1 -m 1GB -k 15 -o /tmp/tmpegiwu8n5/JGM001-15_staph-amr-bradley_2015-feb-17-2017-staph-species-160227.covgs -I mykrobe/data/skeletons/staph-amr-bradley_2015-feb-17-2017-staph-species-160227_15.ctx -s JGM001-15 -1 JGM001_S1_R1.fastq.gz -1 JGM001_S1_R2.fastq.gz -c /usr/local/lib/python3.9/site-packages/mykrobe/data/staph/staph-amr-bradley_2015-feb-17-2017.fasta.gz -c /usr/local/lib/python3.9/site-packages/mykrobe/data/staph/staph-species-160227.fasta.gz /tmp/tmpegiwu8n5/JGM001-15_staph-amr-bradley_2015-feb-17-2017-staph-species-160227.ctx
Traceback (most recent call last): File "/usr/local/bin/mykrobe", line 33, in <module> sys.exit(load_entry_point('mykrobe==0.12.1', 'console_scripts', 'mykrobe')()) File "/usr/local/lib/python3.9/site-packages/mykrobe/cli.py", line 9, in main args.func(parser, args) File "/usr/local/lib/python3.9/site-packages/mykrobe/parser.py", line 53, in run_subtool run(parser, args) File "/usr/local/lib/python3.9/site-packages/mykrobe/cmds/amr.py", line 338, in run gt.run() File "/usr/local/lib/python3.9/site-packages/mykrobe/typing/typer/genotyper.py", line 321, in run self._type() File "/usr/local/lib/python3.9/site-packages/mykrobe/typing/typer/genotyper.py", line 324, in _type self._type_genes() File "/usr/local/lib/python3.9/site-packages/mykrobe/typing/typer/genotyper.py", line 341, in _type_genes if gene_name in self.lineage_variants: TypeError: argument of type 'NoneType' is not iterable

I ran this on a TB sample and it worked fine, so I'm a bit confused as to what's going wrong here

Hi there - sorry to hear this. Can you tell me what version you used/how you installed? I must apologise in advance - Friday and Monday are national holidays here, and I have a deadline on thursday. I will try to help if I can, but it is possible I won't get back to you until Tuesday.

Thanks @iqbal-lab. I am using version 0.12.1. I didn't install it on our server but I'm guessing it was compiled from source using pip because it is in /usr/local/bin/

I am having the same issue using the version v0.12.1 installed via conda.
Located at: /home/djs217/miniconda3/envs/mykrobe_env/bin/mykrobe

Everything seems to work fine with the test dataset, but when I try to analyse my fq or fq.gz or .bam files I get the error message. For example:

[mykrobe 2023-05-08T09:42:06 INFO] Start runnning mykrobe predict. Command line: /home/djs217/miniconda3/envs/mykrobe_env/bin/mykrobe predict --sample ERR1212589 --species staph --output ERR1212589.json --format json --seq ERR1212589.fq.gz
[mykrobe 2023-05-08T09:42:06 INFO] Running mykrobe predict using species staph, and panel version 20201001
[mykrobe 2023-05-08T09:42:06 INFO] Run command: /home/djs217/miniconda3/envs/mykrobe_env/lib/python3.10/site-packages/mykrobe/cortex/mccortex31 geno -t 1 -m 1GB -k 15 -o /tmp/tmpdit5nxrw/ERR1212589-15_staph-amr-bradley_2015-feb-17-2017-staph-species-160227.covgs -I mykrobe/data/skeletons/staph-amr-bradley_2015-feb-17-2017-staph-species-160227_15.ctx -s ERR1212589-15 -1 ERR1212589.fq.gz -c /home/djs217/miniconda3/envs/mykrobe_env/lib/python3.10/site-packages/mykrobe/data/staph/staph-amr-bradley_2015-feb-17-2017.fasta.gz -c /home/djs217/miniconda3/envs/mykrobe_env/lib/python3.10/site-packages/mykrobe/data/staph/staph-species-160227.fasta.gz /tmp/tmpdit5nxrw/ERR1212589-15_staph-amr-bradley_2015-feb-17-2017-staph-species-160227.ctx
Traceback (most recent call last):
  File "/home/djs217/miniconda3/envs/mykrobe_env/bin/mykrobe", line 11, in <module>
    sys.exit(main())
  File "/home/djs217/miniconda3/envs/mykrobe_env/lib/python3.10/site-packages/mykrobe/cli.py", line 9, in main
    args.func(parser, args)
  File "/home/djs217/miniconda3/envs/mykrobe_env/lib/python3.10/site-packages/mykrobe/parser.py", line 53, in run_subtool
    run(parser, args)
  File "/home/djs217/miniconda3/envs/mykrobe_env/lib/python3.10/site-packages/mykrobe/cmds/amr.py", line 338, in run
    gt.run()
  File "/home/djs217/miniconda3/envs/mykrobe_env/lib/python3.10/site-packages/mykrobe/typing/typer/genotyper.py", line 321, in run
    self._type()
  File "/home/djs217/miniconda3/envs/mykrobe_env/lib/python3.10/site-packages/mykrobe/typing/typer/genotyper.py", line 324, in _type
    self._type_genes()
  File "/home/djs217/miniconda3/envs/mykrobe_env/lib/python3.10/site-packages/mykrobe/typing/typer/genotyper.py", line 341, in _type_genes
    if gene_name in self.lineage_variants:
TypeError: argument of type 'NoneType' is not iterable```



Jen Guthrie says the same thing

"This is the error that we’re getting when we try to run Mykrobe for S. aureus but it works fine for Mtb

mykrobe predict -S staph -s sa50 -i sa50_S29_R1_001.fastq.gz sa50_S29_R2_001.fastq.gz -o ./myk_out/sa50_out.csv
[mykrobe 2023-03-22T18:01:06 INFO] Start runnning mykrobe predict. Command line: /usr/local/bin/mykrobe predict -S staph -s sa50 -i sa50_S29_R1_001.fastq.gz sa50_S29_R2_001.fastq.gz -o ./myk_out/sa50_out.csv
[mykrobe 2023-03-22T18:01:06 INFO] Running mykrobe predict using species staph, and panel version 20201001
[mykrobe 2023-03-22T18:01:06 INFO] Run command: /usr/local/lib/python3.9/site-packages/mykrobe/cortex/mccortex31 geno -t 1 -m 1GB -k 15 -o /tmp/tmpui7f3yeo/sa50-15_staph-amr-bradley_2015-feb-17-2017-staph-species-160227.covgs -I mykrobe/data/skeletons/staph-amr-bradley_2015-feb-17-2017-staph-species-160227_15.ctx -s 50-15 -1 sa50_S29_R1_001.fastq.gz -1 sa50_S29_R2_001.fastq.gz -c /usr/local/lib/python3.9/site-packages/mykrobe/data/staph/staph-amr-bradley_2015-feb-17-2017.fasta.gz -c /usr/local/lib/python3.9/site-packages/mykrobe/data/staph/staph-species-160227.fasta.gz /tmp/tmpui7f3yeo/50-15_staph-amr-bradley_2015-feb-17-2017-staph-species-160227.ctx
Traceback (most recent call last):
  File "/usr/local/bin/mykrobe", line 33, in <module>
    sys.exit(load_entry_point('mykrobe==0.12.1', 'console_scripts', 'mykrobe')())
  File "/usr/local/lib/python3.9/site-packages/mykrobe/cli.py", line 9, in main
    args.func(parser, args)
  File "/usr/local/lib/python3.9/site-packages/mykrobe/parser.py", line 53, in run_subtool
    run(parser, args)
  File "/usr/local/lib/python3.9/site-packages/mykrobe/cmds/amr.py", line 338, in run
    gt.run()
  File "/usr/local/lib/python3.9/site-packages/mykrobe/typing/typer/genotyper.py", line 321, in run
    self._type()
  File "/usr/local/lib/python3.9/site-packages/mykrobe/typing/typer/genotyper.py", line 324, in _type
    self._type_genes()
  File "/usr/local/lib/python3.9/site-packages/mykrobe/typing/typer/genotyper.py", line 341, in _type_genes
    if gene_name in self.lineage_variants:
TypeError: argument of type 'NoneType' is not iterable

Apologies everyone, @martinghunt and I were at ABPHM at the end of last week. We will take a look

This is now fixed, and there's a new release v0.12.2.

https://github.com/Mykrobe-tools/mykrobe/releases/tag/v0.12.2