kage-genotyper / kage

Alignment-free genotyper for SNPs and short indels, implemented in Python.
GNU General Public License v3.0
45 stars 2 forks source link

kmer_mapper crashes with AttributeError exception #3

Closed ldenti closed 2 years ago

ldenti commented 2 years ago

Hi, I was trying running kage (installed via pip) using the prebuilt index but it crashed when mapping kmers. I'm running:

kmer_mapper map -b index_2548all.npz -f read.fa -o kmer_counts.npy -l 150

This is the test sample I was using (a single read): read.fa.gz.

And this is the full log:

2022-03-16 15:30:45,974 INFO: Max read length is specified to 150
2022-03-16 15:30:45,984 INFO: Made shared pool
2022-03-16 15:30:45,988 INFO: Reading VariantToNodes from index bundle
2022-03-16 15:30:47,337 INFO: Done reading VariantToNodes from index bundle
2022-03-16 15:30:47,337 INFO: Reading NumpyVariants from index bundle
2022-03-16 15:30:55,583 INFO: Done reading NumpyVariants from index bundle
2022-03-16 15:30:55,583 INFO: Reading NodeCountModelAdvanced from index bundle
2022-03-16 15:31:35,669 INFO: Done reading NodeCountModelAdvanced from index bundle
2022-03-16 15:31:35,669 INFO: Reading HelperVariants from index bundle
2022-03-16 15:31:37,208 INFO: Done reading HelperVariants from index bundle
2022-03-16 15:31:37,209 INFO: Reading CombinationMatrix from index bundle
2022-03-16 15:31:49,773 INFO: Done reading CombinationMatrix from index bundle
2022-03-16 15:31:49,773 INFO: Reading TrickyVariants from index bundle
2022-03-16 15:31:50,909 INFO: Done reading TrickyVariants from index bundle
2022-03-16 15:31:50,910 INFO: Reading KmerIndex from index bundle
2022-03-16 15:32:55,109 INFO: Done reading KmerIndex from index bundle
Traceback (most recent call last):
  File "/home/denti/.local/bin/kmer_mapper", line 8, in <module>
    sys.exit(main())
  File "/home/denti/.local/lib/python3.8/site-packages/kmer_mapper/command_line_interface.py", line 16, in main
    run_argument_parser(sys.argv[1:])
  File "/home/denti/.local/lib/python3.8/site-packages/kmer_mapper/command_line_interface.py", line 84, in run_argument_parser
    args.func(args)
  File "/home/denti/.local/lib/python3.8/site-packages/kmer_mapper/command_line_interface.py", line 46, in map_fasta_command
    kmer_index.convert_to_int32()
AttributeError: 'dict' object has no attribute 'convert_to_int32'

Am I doing something wrong?

Best, Luca

ivargr commented 2 years ago

There seems to be a mismatch between the index and some later changes in the code, unfortunately. I'll make a new index and let you know when it's ready (hopefully not too long). Sorry for this, and thanks for reaching out!

ivargr commented 2 years ago

Turned out it was only a bug in kmer_mapper (when using index bundle), which should be fixed now if you update to the latest version (0.0.18). You can force this version in pip, e.g.:

pip3 install kmer_mapper==0.0.18

We have also updated kage and som other packages. I think you wont need the latest version of these, but it might be a good idea to update anyway:

pip3 install kage-genotyper== 0.0.20

Don't hesitate to let me know if you run into any other problems or have any questions :)

ldenti commented 2 years ago

Great, thanks! Now it works.

I close this - in case I'll have other problems, I'll open a new issue.

Best, Luca