# HG changeset patch
# User recetox
# Date 1684414670 0
# Node ID 2ada1099f42e2017849624f05c2af4c56d0eef76
# Parent 37afe368348b37bac3b496dc7361f9a391242cf5
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/msmetaenhancer commit 538d6c063bb049fe7a08d7d4bd88af91c0d696e8
diff -r 37afe368348b -r 2ada1099f42e macros.xml
--- a/macros.xml Tue May 09 09:18:10 2023 +0000
+++ b/macros.xml Thu May 18 12:57:50 2023 +0000
@@ -1,5 +1,5 @@
- 0.2.5
+ 0.3.0
@@ -17,7 +17,7 @@
+
+
@@ -61,12 +63,6 @@
-
-
-
-
-
-
@@ -81,36 +77,36 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r 37afe368348b -r 2ada1099f42e msmetaenhancer.xml
--- a/msmetaenhancer.xml Tue May 09 09:18:10 2023 +0000
+++ b/msmetaenhancer.xml Thu May 18 12:57:50 2023 +0000
@@ -1,4 +1,4 @@
-
+
annotate MS data
@@ -23,6 +23,7 @@
python3 ${__tool_directory__}/msmetaenhancer_wrapper.py \
--input_file "$input_file" \
+ --file_format "$input_file.ext" \
--output_file "$output_file" \
#if $options.logging.output_log:
--log_file "$log_file" \
@@ -44,7 +45,7 @@
-
+
@@ -73,7 +74,15 @@
-
+
+
+
+
+
+
+
+
+
options['logging']['output_log']
diff -r 37afe368348b -r 2ada1099f42e msmetaenhancer_wrapper.py
--- a/msmetaenhancer_wrapper.py Tue May 09 09:18:10 2023 +0000
+++ b/msmetaenhancer_wrapper.py Thu May 18 12:57:50 2023 +0000
@@ -1,14 +1,24 @@
import argparse
import asyncio
+import os
+import shutil
import sys
from matchms import set_matchms_logger_level
from MSMetaEnhancer import Application
+def handle_xlsx_file(app, filename):
+ basename = os.path.splitext(filename)[0]
+ temp_file = basename + '.xlsx'
+ app.save_data(temp_file, file_format='xlsx')
+ shutil.copyfile(temp_file, filename)
+
+
def main(argv):
- parser = argparse.ArgumentParser(description="Annotate MSP file.")
- parser.add_argument("--input_file", type=str, help="Path to query spectra file in MSP format.")
+ parser = argparse.ArgumentParser(description="Annotate spectra file.")
+ parser.add_argument("--input_file", type=str, help="Path to query spectra file.")
+ parser.add_argument("--file_format", type=str, help="Format of the input and the output files.")
parser.add_argument("--output_file", type=str, help="Path to output spectra file.")
parser.add_argument("--jobs", type=str, help="Sequence of conversion jobs to be used.")
parser.add_argument("--log_file", type=str, help="Path to log with details of the annotation process.")
@@ -20,17 +30,17 @@
# set matchms logging level to avoid extensive messages in stdout while reading file
set_matchms_logger_level("ERROR")
- # import .msp file
- app.load_spectra(args.input_file, file_format='msp')
+ # import spectra file
+ app.load_data(args.input_file, file_format=args.file_format)
# set matchms logging level back to warning
set_matchms_logger_level("WARNING")
# curate given metadata
- app.curate_spectra()
+ app.curate_metadata()
# specify requested services and jobs
- services = ['PubChem', 'CTS', 'CIR', 'NLM', 'RDKit', 'IDSM', 'BridgeDB']
+ services = ['PubChem', 'CTS', 'CIR', 'RDKit', 'IDSM', 'BridgeDb']
if len(args.jobs) != 0:
jobs = []
@@ -42,8 +52,11 @@
# execute without jobs parameter to run all possible jobs
asyncio.run(app.annotate_spectra(services))
- # export .msp file
- app.save_spectra(args.output_file, file_format="msp")
+ # export spectra file
+ if args.file_format == 'xlsx':
+ handle_xlsx_file(app, args.output_file)
+ else:
+ app.save_data(args.output_file, file_format=args.file_format)
return 0
diff -r 37afe368348b -r 2ada1099f42e test-data/sample_out.msp
--- a/test-data/sample_out.msp Tue May 09 09:18:10 2023 +0000
+++ b/test-data/sample_out.msp Thu May 18 12:57:50 2023 +0000
@@ -1,9 +1,9 @@
FORMULA: H2
-MW: 2
CASNO: 1333-74-0
ID: 1
COMMENT: NIST MS# 245692, Seq# M1
COMPOUND_NAME: Hydrogen
+NOMINAL_MASS: 2
INCHI: InChI=1S/H2/h1H
CANONICAL_SMILES: [HH]
NUM PEAKS: 2
@@ -11,11 +11,11 @@
2.0 999.0
FORMULA: D2
-MW: 4
CASNO: 7782-39-0
ID: 2
COMMENT: NIST MS# 61316, Seq# M2
COMPOUND_NAME: Deuterium
+NOMINAL_MASS: 4
INCHI: InChI=1S/H2/h1H/i1+1D
CANONICAL_SMILES: [HH]
NUM PEAKS: 2
@@ -23,11 +23,11 @@
4.0 999.0
FORMULA: CH4
-MW: 16
CASNO: 74-82-8
ID: 3
COMMENT: Any=100 ; NIST MS# 61313, Seq# M64
COMPOUND_NAME: Methane
+NOMINAL_MASS: 16
INCHI: InChI=1S/CH4/h1H4
CANONICAL_SMILES: C
NUM PEAKS: 6
@@ -39,11 +39,11 @@
17.0 15.99
FORMULA: CH4
-MW: 16
CASNO: 74-82-8
ID: 4
COMMENT: Any=100 ; NIST MS# 18807, Seq# R26
COMPOUND_NAME: Methane
+NOMINAL_MASS: 16
INCHI: InChI=1S/CH4/h1H4
CANONICAL_SMILES: C
NUM PEAKS: 6
@@ -55,11 +55,11 @@
17.0 10.99
FORMULA: CH4
-MW: 16
CASNO: 74-82-8
ID: 5
COMMENT: Any=100 ; NIST MS# 18809, Seq# R27
COMPOUND_NAME: Methane
+NOMINAL_MASS: 16
INCHI: InChI=1S/CH4/h1H4
CANONICAL_SMILES: C
NUM PEAKS: 6
@@ -71,11 +71,11 @@
17.0 11.99
FORMULA: CH4
-MW: 16
CASNO: 74-82-8
ID: 6
COMMENT: Any=100 ; NIST MS# 423924, Seq# R28
COMPOUND_NAME: Methane
+NOMINAL_MASS: 16
INCHI: InChI=1S/CH4/h1H4
CANONICAL_SMILES: C
NUM PEAKS: 6