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

Cannot add modifications #83

Open
grimace9527 opened this issue Oct 28, 2024 · 12 comments
Open

Cannot add modifications #83

grimace9527 opened this issue Oct 28, 2024 · 12 comments

Comments

@grimace9527
Copy link

Hi,

I am trying to add a modification into unimod_to_formula.csv, and I follows the instructions on your main page:

Q: I have a modification that is not in unimod. How can I add the modification?

In the folder unimod/ there is the file unimod_to_formula.csv that can be used to add modifications. In the CSV file add a name (that is unique and not present yet) and the change in atomic composition. For example:

Met->Hse,O,H(-2) C(-1) S(-1)

However, the modification still cannot be added and the an error was raised when running:

File "D:\python_projects\python_3_11\Lib\site-packages\pyteomics\proforma.py", line 674, in _resolve_impl
raise KeyError(name)
KeyError: 'Succinimide D'

and the line I input is :
Succinimide D,,H(-2) O(-1)

I wonder if there is anything wrong with my operation. Thanks for your reply!

Best wishes,
Jim

@grimace9527
Copy link
Author

And an another question:
when I choose the "Use transfer learning calibration" in the second panel, the software goes wrong like:
Traceback (most recent call last):
File "", line 198, in run_module_as_main
File "", line 88, in run_code
File "D:\python_projects\python_3_11\Scripts\deeplc-gui.exe_main
.py", line 7, in
File "D:\python_projects\python_3_11\Lib\site-packages\gooey\python_bindings\gooey_decorator.py", line 134, in
return lambda *args, **kwargs: func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "D:\python_projects\python_3_11\Lib\site-packages\deeplc\gui.py", line 35, in start_gui
main(gui=True)
File "D:\python_projects\python_3_11\Lib\site-packages\deeplc_main
.py", line 67, in main
run(**vars(argu))
File "D:\python_projects\python_3_11\Lib\site-packages\deeplc_main_.py", line 183, in run
dlc.calibrate_preds(psm_list=psm_list_cal)
File "D:\python_projects\python_3_11\Lib\site-packages\deeplc\deeplc.py", line 1180, in calibrate_preds
models = deeplcretrainer.retrain(
^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\python_projects\python_3_11\Lib\site-packages\deeplcretrainer\deeplcretrainer.py", line 278, in retrain
df = cnn_functions.get_feat_df(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\python_projects\python_3_11\Lib\site-packages\deeplcretrainer\cnn_functions.py", line 392, in get_feat_df
pepper = deeplc.DeepLC(
^^^^^^^^^^^^^^
TypeError: deeplc.deeplc.DeepLC() got multiple values for keyword argument 'verbose'

Thanks again for your response!! : )

@RobbinBouwmeester
Copy link
Member

Hi Jim,

Actually the documentation is a bit out of date for modifications. We now use psm_utils that in turn supports ProForma. Easiest is probably to choose the composition notation.

I will have a look ASAP at the GUI.

Also feel free to contact me directly here: robbin.bouwmeester@ugent.be

I can probably help you with running DeepLC directly.

@grimace9527
Copy link
Author

grimace9527 commented Oct 28, 2024

Hi Robbin,
Thanks a lot for your response. The ProForma works well.
By the way, I noticed that ProForma supports arbitrary mass shifts:

Arbitrary mass shifts and unknown mass gaps
EM[+15.9949]EVEES[-79.9663]PEK
RTAAX[+367.0537]WT

But in your article, the element formula and other features of modifications are used in model prediction. I wonder how you deal with this kind of situation (since the element formula may not match a modification in Unimod). It will help me a lot when it can be explained to me. For what I am working on is to solve the unknown mods (known mass shifts but unknown formula). Thanks!

@RobbinBouwmeester
Copy link
Member

Yes, proforma supports mass shifts, but unfortunately DeepLC does not. It will likely throw an error (or at least ignore it).

@grimace9527
Copy link
Author

Thanks, and sorry that I have too many questions...
The default models are full_hc_PXD005573_pub_1fd8363d9af9dcad3be7553c39396960.keras, full_hc_PXD005573_pub_8c22d89667368f2f02ad996469ba157e.keras and full_hc_PXD005573_pub_cb975cfdd4105f97efa0b3afffe075cc.keras. Are they the best models you have trained? I noticed that you provide some models in .hdf5 format on https://github.com/RobbinBouwmeester/DeepLCModels, should I convert these models into .keras format if I want to use them?

Thanks again

@RobbinBouwmeester
Copy link
Member

Hey,

No worries about the questions, happy to help!

Actually a blog post was written on this recently by Matrix Science: https://www.matrixscience.com/blog/tutorial-selecting-the-best-deeplc-model.html

In terms of the keras vs hdf. I made the switch to .keras from version 3.1 >, because the latest versions of tensorflow do not support .hdf in their old form anymore. I have not updated all models. So if you want to try different models as suggested by the blog, it would be best to run DeepLC < 3.1.0.

Hope that helps :)

@grimace9527
Copy link
Author

grimace9527 commented Oct 29, 2024

Thanks!! I appreciate your helpful response.

I've tried the lower version of DeepLC. However, 3.0.7 and 3.0.8 DeepLC still cannot read .hdf5 models, and the earlier versions cannot be started with command
python -m deeplc.gui
: (
I don't know if my operations were correct....

And another question is...:

Are the models:
full_hc_PXD005573_pub_1fd8363d9af9dcad3be7553c39396960.keras, full_hc_PXD005573_pub_8c22d89667368f2f02ad996469ba157e.keras and full_hc_PXD005573_pub_cb975cfdd4105f97efa0b3afffe075cc.keras
used for training if the "Model files" textbox on the second panel of DeepLC GUI is empty?
Since these models are in the deeplc\mods folder.

The question raised because I have tried two ways of prediction: the GUI and running the source code "deeplc_example.py" by IDE, however the results are a little different. I wonder if any parameters or models are different in these two ways...

@RobbinBouwmeester
Copy link
Member

They are indeed slightly different, these days we only use a single model for prediction by default. Which in the current case is:

"mods/full_hc_PXD005573_pub_1fd8363d9af9dcad3be7553c39396960.keras"

About the version. I was wrong... I introduced that breaking change since 3.0.0, everything < v2.2.36 should work... Sorry for the confusion.

@grimace9527
Copy link
Author

grimace9527 commented Oct 30, 2024

Ok I think I get it. I really appreciate your response.
However, when I am trying v2.2.30 DeepLC GUI, and an error raises:
(The command line I use is "python -m deeplc.gui", and it works well with the latest version.)
Could you please take a look?

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "D:\python_projects\python_3_11\Lib\site-packages\deeplc\gui.py", line 38, in <module>
    start_gui()
  File "D:\python_projects\python_3_11\Lib\site-packages\gooey\python_bindings\gooey_decorator.py", line 128, in inner2
    return payload(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\python_projects\python_3_11\Lib\site-packages\deeplc\gui.py", line 35, in start_gui
    main(gui=True)
  File "D:\python_projects\python_3_11\Lib\site-packages\deeplc\__main__.py", line 52, in main
    argu = parse_arguments(gui=gui)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\python_projects\python_3_11\Lib\site-packages\deeplc\_argument_parser.py", line 266, in parse_arguments
    results = parser.parse_args()
              ^^^^^^^^^^^^^^^^^^^
  File "D:\python_projects\python_3_11\Lib\site-packages\gooey\python_bindings\gooey_parser.py", line 125, in parse_args
    return self.parser.parse_args(args, namespace)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\python_projects\python_3_11\Lib\site-packages\gooey\python_bindings\gooey_decorator.py", line 123, in run_gooey
    application.run(build_spec)
  File "D:\python_projects\python_3_11\Lib\site-packages\gooey\gui\application.py", line 21, in run
    app, _ = build_app(build_spec)
             ^^^^^^^^^^^^^^^^^^^^^
  File "D:\python_projects\python_3_11\Lib\site-packages\gooey\gui\application.py", line 27, in build_app
    return _build_app(build_spec, app)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\python_projects\python_3_11\Lib\site-packages\gooey\gui\application.py", line 40, in _build_app
    gapp = GooeyApplication(merge(build_spec, imagesPaths))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\python_projects\python_3_11\Lib\site-packages\gooey\gui\containers\application.py", line 44, in __init__
    self.configs = self.buildConfigPanels(self)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\python_projects\python_3_11\Lib\site-packages\gooey\gui\containers\application.py", line 242, in buildConfigPanels
    return [page_class(parent, widgets, self.buildSpec)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\python_projects\python_3_11\Lib\site-packages\gooey\gui\containers\application.py", line 242, in <listcomp>
    return [page_class(parent, widgets, self.buildSpec)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\python_projects\python_3_11\Lib\site-packages\gooey\gui\components\config.py", line 18, in __init__
    self.layoutComponent()
  File "D:\python_projects\python_3_11\Lib\site-packages\gooey\gui\components\config.py", line 211, in layoutComponent
    self.makeGroup(panel, sizer, group, 0, wx.EXPAND)
  File "D:\python_projects\python_3_11\Lib\site-packages\gooey\gui\components\config.py", line 141, in makeGroup
    widget = self.reifyWidget(parent, item)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\python_projects\python_3_11\Lib\site-packages\gooey\gui\components\config.py", line 193, in reifyWidget
    return widgetClass(parent, item)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\python_projects\python_3_11\Lib\site-packages\gooey\gui\components\widgets\bases.py", line 73, in __init__
    self.widget = self.getWidget(self)
                  ^^^^^^^^^^^^^^^^^^^^
  File "D:\python_projects\python_3_11\Lib\site-packages\gooey\gui\components\widgets\numeric_fields.py", line 13, in getWidget
    widget = self.widget_class(self,
             ^^^^^^^^^^^^^^^^^^^^^^^
TypeError: SpinCtrl(): arguments did not match any overloaded call:
  overload 1: too many arguments
  overload 2: argument 'min' has unexpected type 'float'

@RobbinBouwmeester
Copy link
Member

Hey, I looked into this and getting the GUI to work for older versions seems to be kinda hard. I will try to fix the latest version and provide all new model files.

@grimace9527
Copy link
Author

Thanks! I appreciate it and look forward to the new versions : )

@grimace9527
Copy link
Author

Hi Robbin,
I think I've found some bugs and hope these can helps, and I am looking forward to the new versions. DeepLC really helps me a lot.
In "cnn_functions.py", line 392:
pepper = deeplc.DeepLC( f_extractor=f_extractor, cnn_model=True, n_jobs=num_cores, verbose=True, **kwargs, )

It looks like the "verbose" param should be located before the n_jobs param since these params all have default values when the function is announced.

And in "files.py", line 235:
fid = h5f.open(name, flags, fapl=fapl)
It seems the transfer learning still needs the .hdf5 format models rather than .keras now.

Hope these messages helps.
Thanks for your response and answer again.
: )

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

2 participants