PNNL-CompBio / Snekmer

Pipeline to apply encoded Kmer analysis to protein sequences
BSD 3-Clause "New" or "Revised" License
12 stars 1 forks source link

Snekmer search: SnekmerModel' object has no attribute 'predict_proba #108

Closed joeho604 closed 1 year ago

joeho604 commented 1 year ago

Hi,

I was able to create models for my protein family with snekmer version 1.0.4, but ran into this error when I tried to perform a search to unknown sequences. I made sure the paths to the kmerize, model, and scoring directory for the models were specified in the config file. Do you have any suggestions for why I am getting this error?

RuleException:
AttributeError in line 197 of /home/jho/src/snekmer/snekmer/rules/search.smk:
'SnekmerModel' object has no attribute 'predict_proba'
  File "/home/jho/src/snekmer/snekmer/rules/search.smk", line 197, in __rule_search
  File "/home/jho/miniconda3/envs/snekmer/lib/python3.10/concurrent/futures/thread.py", line 58, in run
Exiting because a job execution failed. Look above for error message
biodataganache commented 1 year ago

That's weird and not great for being able to apply the models! We will take a look and see if we can replicate your issue. In the meantime you can try a workaround which is to copy all the contents of the model directories into one directory (and update the config.yaml to point to that one directory). It's clunky but it might solve the problem (this is how our example script works and it functions - so there might be something amiss with the 'normal' way to do things)

e.g. cp output/kmerize/ output/model cp output/scoring/ output/model

---- then change the config.yaml search params to this:

search params

model_dir: "output/model/" basis_dir: "output/model/" score_dir: "output/model/"

joeho604 commented 1 year ago

I have copied all the contents from the model directory and updated the directory on the config.yaml search parameters according to your instructions. However, I still received the error in rule search.

christinehc commented 1 year ago

Hi @joeho604 , thanks for informing of us your issue. Can I ask which model type you are using? I believe this may be a bug with some of the model types not having the available method.

joeho604 commented 1 year ago

Hi @christinehc, I have kept the cv integer at 5 with no random state for model evaluation.

biodataganache commented 1 year ago

I'm checking this out now to see if I can replicate the error.

biodataganache commented 1 year ago

I was able to replicate the error and figured out a fix. Just pushed that to main so if you update the code from the repo it should work. Sorry for the trouble. It was a stupid error too :)

Let me know if it works and I'll close out the issue. Thanks for being a user!

joeho604 commented 1 year ago

Thanks @biodataganache! The error is resolved.