-
Notifications
You must be signed in to change notification settings - Fork 22
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
Modularize / de-hardcode parser and partly record rendering: CH$LINK, various subtags, adducts #303
Comments
Also e.g. here, wouldn't it be nice to read the adducts from a definition file rather than hardcode them? MassBank-web/MassBank-Project/MassBank-lib/src/main/java/massbank/RecordParserDefinition.java Lines 1414 to 1435 in 8ffefdd
I am willing to work on modularizing the parser as a whole if this is desired. |
I agree that a definition file would make sense, new adduct types are likely to keep coming in - wasn't @michaelwitting working on a list of these? (I assume, however, that this is not directly related to |
Yes, we started some time ago to collect differant adduct and their different notations in different software tools here: https://docs.google.com/spreadsheets/d/1r4dPw1shIEy_W2BkfgPsihinwg-Nah654VlNTn8Gxo0/edit?usp=sharing Could be revamped... |
Where will be the location of the definition file? I suggest as a part of the MassBank-data to follow the idea that it is user editable and independent of MassBank-sever code updates? @sneumann and @meier-rene, what do you think about? |
Potentially, yes. Possibly with a fallback in the server code if no file is provided in data? As for the format, this could be YAML, JSON or simple text format. |
@meier-rene Note:
|
Hi, I have modularized / de-hardcoded Would there be any chance of these changes (or another, potentially better implementation) being upstreamed? As of now, I have to merge this manually whenever anything changes in the main branch. |
Of course I can integrate it. A pull request would have been best, but I can also grab the required files from your repo. |
I can make a PR - I initially intended this to be a proof of concept to be followed up by "something better" but I guess it's not so bad. The resource file gets loaded upon first use: If you are fine with this implementation, I will put it onto the newest version and make a PR. |
If you are ok with it, than you can skip the PR. Im nearly done with copying over your additions. Im working on this files any anyhow atm. |
With 864137c i have integrated your suggestion for a de-hardcoded parser in the dev branch. Its only slightly modified from your version. To integrate this procedure for other tags its probably just copy and paste. The display issue is still open... |
Thanks!
StrSubstitutor could help maybe? I have to look at it again |
To make
CH$LINK
more easily customizable and more modular, the link types and corresponding format could be defined in an external file e.g. a YAML of this style (I don't know if that's the best solution):The
Record,java
would parse the links usingStringSubstitutor
:https://commons.apache.org/proper/commons-text/javadocs/api-release/org/apache/commons/text/StringSubstitutor.html
The petitparser for record parsing could also be built modularly, as I tried on my fork (for now without a config file):
meowcat@28d9b50
My egoistic reason why I would want this is that I would like to specify some additional internal links in our lab. It would be good if I can do that without hardcoding them. But I think this could be a good idea in general. Also, the
CH$LINK
types would then be defined in one single place instead of multiple places.The text was updated successfully, but these errors were encountered: