From 245aab5c7f517a2321545cfd4c187cca2e2e6c54 Mon Sep 17 00:00:00 2001 From: Matej Trojak Date: Thu, 9 Dec 2021 16:44:11 +0100 Subject: [PATCH 1/4] Added script to generate conversion job options for Galaxy macro --- MSMetaEnhancer/libs/services/__init__.py | 2 +- galaxy/__init__.py | 0 galaxy/generate_options.py | 25 ++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 galaxy/__init__.py create mode 100644 galaxy/generate_options.py diff --git a/MSMetaEnhancer/libs/services/__init__.py b/MSMetaEnhancer/libs/services/__init__.py index 5850d54..0c64cf4 100644 --- a/MSMetaEnhancer/libs/services/__init__.py +++ b/MSMetaEnhancer/libs/services/__init__.py @@ -3,4 +3,4 @@ from MSMetaEnhancer.libs.services.NLM import NLM from MSMetaEnhancer.libs.services.PubChem import PubChem -__all__ = ['CIR', 'CTS', 'NLM', 'PubChem'] +__all__ = ['PubChem', 'CTS', 'CIR', 'NLM'] diff --git a/galaxy/__init__.py b/galaxy/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/galaxy/generate_options.py b/galaxy/generate_options.py new file mode 100644 index 0000000..2d08640 --- /dev/null +++ b/galaxy/generate_options.py @@ -0,0 +1,25 @@ +import asyncio +import sys +import os + +# this add to path eBCSgen home dir, so it can be called from anywhere +sys.path.append(os.path.split(sys.path[0])[0]) + +from MSMetaEnhancer.libs.services import * +from MSMetaEnhancer.libs.services import __all__ as services + + +def generate_options(): + jobs = [] + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) + for service in services: + jobs += (eval(service)(None).get_conversion_functions()) + loop.close() + + for job in jobs: + print(f'') + + +if __name__ == '__main__': + generate_options() From 8c977fc2a05593e79cee368a53e3efd1d3d17cfd Mon Sep 17 00:00:00 2001 From: Matej Trojak Date: Thu, 9 Dec 2021 16:49:14 +0100 Subject: [PATCH 2/4] Removed asyncio loop --- galaxy/generate_options.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/galaxy/generate_options.py b/galaxy/generate_options.py index 2d08640..dfd3827 100644 --- a/galaxy/generate_options.py +++ b/galaxy/generate_options.py @@ -1,8 +1,7 @@ -import asyncio import sys import os -# this add to path eBCSgen home dir, so it can be called from anywhere +# this add to path the home dir, so it can be called from anywhere sys.path.append(os.path.split(sys.path[0])[0]) from MSMetaEnhancer.libs.services import * @@ -11,11 +10,8 @@ def generate_options(): jobs = [] - loop = asyncio.new_event_loop() - asyncio.set_event_loop(loop) for service in services: jobs += (eval(service)(None).get_conversion_functions()) - loop.close() for job in jobs: print(f'') From f81f8ecb26b1cea30b49db10f9762c45e1899e9c Mon Sep 17 00:00:00 2001 From: Matej Trojak Date: Mon, 13 Dec 2021 08:50:43 +0100 Subject: [PATCH 3/4] Changed format of value in jobs options to work properly with Galaxy tool --- galaxy/generate_options.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/galaxy/generate_options.py b/galaxy/generate_options.py index dfd3827..8d6fe7d 100644 --- a/galaxy/generate_options.py +++ b/galaxy/generate_options.py @@ -14,7 +14,7 @@ def generate_options(): jobs += (eval(service)(None).get_conversion_functions()) for job in jobs: - print(f'') + print(f'') if __name__ == '__main__': From f06097d3c8262b6cd2f1806422d9a1b575a8a75d Mon Sep 17 00:00:00 2001 From: hechth Date: Thu, 16 Dec 2021 15:04:31 +0100 Subject: [PATCH 4/4] Added information to changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index edc36a4..46ee566 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [dev] - unreleased ### Added +- `generate_options()` function in `Galaxy` submodule to create all possible conversions supported by the tool in a format suitable for the galaxy tool form [#58](https://github.com/RECETOX/MSMetaEnhancer/pull/58) ### Changed ### Removed