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

macsypy.error.MacsypyError: 'defense-finder-models/Rst_Hydrolase-Tm__Hydrolase-Tm': No such profile #42

Closed
ezherman opened this issue Dec 23, 2023 · 6 comments

Comments

@ezherman
Copy link

Since updating defensefinder and the associated models, I am receiving the error pasted at the bottom of this issue. The profile seems inaccessible to defensefinder, despite being present under /home/elh605/.macsyfinder/models/defense-finder-models/profiles/Rst_Hydrolase-Tm__Hydrolase-Tm.hmm.

I installed and ran defensefinder as follows:

mamba create -c bioconda -c conda-forge -n defensefinder_test pip hmmer -y
mamba activate defensefinder_test
pip install mdmparis-defense-finder
defense-finder update
defense-finder run GCF_900143905.1.faa.gz

The input file is available here.

I'm not sure, but this issue may be related to this comment in another issue.

If there is anything I can do to help, please let me know.

Traceback (most recent call last):
  File "/home/elh605/mambaforge/envs/defensefinder_test/lib/python3.12/site-packages/macsypy/profile.py", line 70, in get_profile
    path = model_location.get_profile(gene.name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/elh605/mambaforge/envs/defensefinder_test/lib/python3.12/site-packages/macsypy/registries.py", line 344, in get_profile
    return self._profiles[name]
           ~~~~~~~~~~~~~~^^^^^^
KeyError: 'Rst_Hydrolase-Tm__Hydrolase-Tm'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/elh605/mambaforge/envs/defensefinder_test/bin/defense-finder", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/home/elh605/mambaforge/envs/defensefinder_test/lib/python3.12/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/elh605/mambaforge/envs/defensefinder_test/lib/python3.12/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/elh605/mambaforge/envs/defensefinder_test/lib/python3.12/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/elh605/mambaforge/envs/defensefinder_test/lib/python3.12/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/elh605/mambaforge/envs/defensefinder_test/lib/python3.12/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/elh605/mambaforge/envs/defensefinder_test/lib/python3.12/site-packages/defense_finder_cli/main.py", line 143, in run
    defense_finder.run(protein_file_name, dbtype, workers, coverage, tmp_dir, models_dir, no_cut_ga, loglevel)
  File "/home/elh605/mambaforge/envs/defensefinder_test/lib/python3.12/site-packages/defense_finder/__init__.py", line 29, in run
    macsyfinder.main(args=msf_cmd)
  File "/home/elh605/mambaforge/envs/defensefinder_test/lib/python3.12/site-packages/macsypy/scripts/macsyfinder.py", line 1193, in main
    all_systems, rejected_candidates = search_systems(config, model_registry, models_def_to_detect, logger)
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/elh605/mambaforge/envs/defensefinder_test/lib/python3.12/site-packages/macsypy/scripts/macsyfinder.py", line 529, in search_systems
    parser.parse(models_def_to_detect)
  File "/home/elh605/mambaforge/envs/defensefinder_test/lib/python3.12/site-packages/macsypy/definition_parser.py", line 85, in parse
    self._fill_gene_bank(model_node, model_location, def_loc)
  File "/home/elh605/mambaforge/envs/defensefinder_test/lib/python3.12/site-packages/macsypy/definition_parser.py", line 287, in _fill_gene_bank
    self.gene_bank.add_new_gene(model_location, gene_name, self.profile_factory)
  File "/home/elh605/mambaforge/envs/defensefinder_test/lib/python3.12/site-packages/macsypy/gene.py", line 102, in add_new_gene
    gene = CoreGene(model_location, name, profile_factory)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/elh605/mambaforge/envs/defensefinder_test/lib/python3.12/site-packages/macsypy/gene.py", line 114, in __init__
    self._profile = profile_factory.get_profile(self, model_location)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/elh605/mambaforge/envs/defensefinder_test/lib/python3.12/site-packages/macsypy/profile.py", line 72, in get_profile
    raise MacsypyError(f"'{model_location.name}/{gene.name}': No such profile")
macsypy.error.MacsypyError: 'defense-finder-models/Rst_Hydrolase-Tm__Hydrolase-Tm': No such profile
@ZarulHanifah
Copy link

I got this too. I had free time to look into the problem. Actually, it was because of some python string substitution went wrong:

>>> "Rst_RT-Tm__RT-Tm.hmm".strip(".hmm")
'Rst_RT-Tm__RT-T'

Still trying to figure out how to correct this.

@ZarulHanifah
Copy link

A quick cheat is to find the lib/python3.11/site-packages/macsypy/registries.py file, go to line 232, replace line
base = profile.strip(profile_suffix)
to
base = profile[:-4]

@ezherman
Copy link
Author

Ah! Thanks for contributing @ZarulHanifah. I'll open an issue in the Macsyfinder repo and reference our discussion here.

@mmolari
Copy link

mmolari commented Jan 8, 2024

I'm having the same exact issue, looking forward to a non-hacky fix. Thank you guys for the info!

@China-LHY
Copy link

Thank you for your help. It helps me a lot!

A quick cheat is to find the lib/python3.11/site-packages/macsypy/registries.py file, go to line 232, replace line base = profile.strip(profile_suffix) to base = profile[:-4]

@jeanrjc
Copy link
Collaborator

jeanrjc commented Feb 22, 2024

This is fixed in version 1.2.2 (you can update on pip, soon on conda)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants