compomics / compomics-utilities

Open source Java library for computational proteomics
http://compomics.github.io/projects/compomics-utilities.html
30 stars 17 forks source link

PTMFactory modifications loss #24

Closed KaiLiCn closed 3 years ago

KaiLiCn commented 7 years ago

Hi:

When I tried to get all modifications, I found the number of that in PTMFactory is always 143 which means your default ones. However, the default file in folder .compomics was from unimod which has at least thousands of modifications.
` /**

And then, I tested source codes and found it ran catch part each time which means default modifications returned only.

Do you know how to add all modifications from file into PTMFactory when PTMFactory.getInstance?

Kai

mvaudel commented 7 years ago

Hi,

Sorry for the delay of my answer. It seems that the factory fails to parse your file and then defaults to the standard modifications. May I know what unimod file you are referring to?

This part of the code is not really well written I am sorry, we are currently refactoring it, hopefully coming versions will be more intuitive. If you are missing modifications from our list you can add them via the GUI of SearchGUI or via the following command line. I am in process of testing and documenting this, don't hesitate to ask if you encounter issues.

https://github.com/compomics/compomics-utilities/blob/master/src/main/java/com/compomics/cli/modifications/ModificationsCLI.java

Hope this helps,

Marc

KaiLiCn commented 7 years ago

Hi Marc,

At first I converted unimod.xml downloaded from UNIMOD to json, and then I added it into PTMFactory. But it didn't work. So, I found ptmFactory-4.12.1.json in .compomics and read it by PTMFactory, there was no more modifications as well.

Meanwhile, I tried to add modification singly by .addUserPTM, but I met same problem. However, after reading your PTMFactory codes and changing something, it worked! The codes changed as follow.

`/**

It is essential to update instance. I wish it could help you.

Best regards!

Kai

hbarsnes commented 3 years ago

Issue assumed resolved in more recent versions of utilities. If this is not the case, please let us know and we'll reopen the issue.