Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

MSMetaEnhancer log as an optional output #223

Merged
merged 4 commits into from
Feb 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions tools/msmetaenhancer/macros.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<macros>
<token name="@TOOL_VERSION@">0.1.2</token>
<token name="@TOOL_VERSION@">0.1.3</token>

<xml name="creator">
<creator>
Expand Down Expand Up @@ -32,26 +32,29 @@
</token>

<xml name="job_options">
<option value="inchi canonical_smiles PubChem">PubChem: inchi -> canonical_smiles</option>
<option value="inchi formula PubChem">PubChem: inchi -> formula</option>
<option value="inchi inchikey PubChem">PubChem: inchi -> inchikey</option>
<option value="inchi isomeric_smiles PubChem">PubChem: inchi -> isomeric_smiles</option>
<option value="inchi iupac_name PubChem">PubChem: inchi -> iupac_name</option>
<option value="inchi smiles PubChem">PubChem: inchi -> smiles</option>
<option value="name canonical_smiles PubChem">PubChem: name -> canonical_smiles</option>
<option value="name formula PubChem">PubChem: name -> formula</option>
<option value="name inchi PubChem">PubChem: name -> inchi</option>
<option value="name inchikey PubChem">PubChem: name -> inchikey</option>
<option value="name isomeric_smiles PubChem">PubChem: name -> isomeric_smiles</option>
<option value="name iupac_name PubChem">PubChem: name -> iupac_name</option>
<option value="name smiles PubChem">PubChem: name -> smiles</option>
<option value="casno inchikey CTS">CTS: casno -> inchikey</option>
<option value="inchikey inchi CTS">CTS: inchikey -> inchi</option>
<option value="inchikey iupac_name CTS">CTS: inchikey -> iupac_name</option>
<option value="inchikey name CTS">CTS: inchikey -> name</option>
<option value="name inchikey CTS">CTS: name -> inchikey</option>
<option value="casno smiles CIR">CIR: casno -> smiles</option>
<option value="inchi smiles CIR">CIR: inchi -> smiles</option>
<option value="inchikey casno CIR">CIR: inchikey -> casno</option>
<option value="inchikey formula CIR">CIR: inchikey -> formula</option>
<option value="inchikey inchi CIR">CIR: inchikey -> inchi</option>
<option value="inchikey smiles CIR">CIR: inchikey -> smiles</option>
<option value="smiles inchikey CIR">CIR: smiles -> inchikey</option>
<option value="casno inchikey CTS">CTS: casno -> inchikey</option>
<option value="inchikey inchi CTS">CTS: inchikey -> inchi</option>
<option value="inchikey iupac_name CTS">CTS: inchikey -> iupac_name</option>
<option value="inchikey name CTS">CTS: inchikey -> name</option>
<option value="name inchikey CTS">CTS: name -> inchikey</option>
<option value="inchikey casno NLM">NLM: inchikey -> casno</option>
<option value="inchikey formula NLM">NLM: inchikey -> formula</option>
<option value="inchikey name NLM">NLM: inchikey -> name</option>
Expand Down
11 changes: 11 additions & 0 deletions tools/msmetaenhancer/msmetaenhancer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
python3 ${__tool_directory__}/msmetaenhancer_wrapper.py \
--input_file "$input_file" \
--output_file "$output_file" \
#if $options.output_log:
--log_file "$log_file"\
#end if
#if len($ordered_jobs) != 0:
#set ordered_jobs = ",".join([str($job.ordered_jobs_select) for $job in $ordered_jobs]) + ","
#else:
Expand Down Expand Up @@ -46,10 +49,18 @@
<param name="jobs" type="select" label="Other conversions" multiple="true" optional="true">
<expand macro="job_options" />
</param>

<section name="options" title="Options">
<param label="Save the log file" name="output_log" type="boolean" truevalue="TRUE" falsevalue="FALSE"
checked="false" help="Preserve a log with details about the annotation process."/>
</section>
</inputs>

<outputs>
<data label="MSMetaEnhancer on ${on_string}" name="output_file" format="msp" />
<data label="Log of MSMetaEnhancer on ${on_string}" name="log_file" format="txt">
<filter>options['output_log']</filter>
</data>
</outputs>

<tests>
Expand Down
3 changes: 2 additions & 1 deletion tools/msmetaenhancer/msmetaenhancer_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ def main(argv):
parser.add_argument("--input_file", type=str, help="Path to query spectra file in MSP format.")
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.")
args = parser.parse_args()

app = Application()
app = Application(log_file=args.log_file)

# import .msp file
app.load_spectra(args.input_file, file_format='msp')
Expand Down
74 changes: 39 additions & 35 deletions tools/msmetaenhancer/test-data/sample_out.msp
Original file line number Diff line number Diff line change
Expand Up @@ -4,92 +4,96 @@ MW: 2
CASNO: 1333-74-0
ID: 1
COMMENT: NIST MS# 245692, Seq# M1
INCHIKEY: UFHFLCQGNIYNRP-UHFFFAOYSA-N
CANONICAL_SMILES: [HH]
INCHI: InChI=1S/H2/h1H
IUPAC_NAME: hydrogen monohydride
INCHIKEY: UFHFLCQGNIYNRP-UHFFFAOYSA-N
ISOMERIC_SMILES: [HH]
IUPAC_NAME: molecular hydrogen
SMILES: [H][H]
NUM PEAKS: 2
1.0 20.98
2.0 999.0
1.0 20.98
2.0 999.0

NAME: Deuterium
FORMULA: D2
MW: 4
CASNO: 7782-39-0
ID: 2
COMMENT: NIST MS# 61316, Seq# M2
INCHIKEY: UFHFLCQGNIYNRP-VVKOMZTBSA-N
CANONICAL_SMILES: [HH]
INCHI: InChI=1S/H2/h1H/i1+1D
INCHIKEY: UFHFLCQGNIYNRP-VVKOMZTBSA-N
ISOMERIC_SMILES: [2H][2H]
SMILES: [2H][2H]
NUM PEAKS: 2
2.0 14.99
4.0 999.0
2.0 14.99
4.0 999.0

NAME: Methane
FORMULA: CH4
MW: 16
CASNO: 74-82-8
ID: 3
COMMENT: Any=100 ; NIST MS# 61313, Seq# M64
INCHIKEY: VNWKTOKETHGBQD-UHFFFAOYSA-N
INCHI: InChI=1S/CH4/h1H4
INCHIKEY: VNWKTOKETHGBQD-UHFFFAOYSA-N
IUPAC_NAME: methane
NUM PEAKS: 6
12.0 37.97
13.0 105.9
14.0 203.82
15.0 886.2
16.0 999.0
17.0 15.99
12.0 37.97
13.0 105.9
14.0 203.82
15.0 886.2
16.0 999.0
17.0 15.99

NAME: Methane
FORMULA: CH4
MW: 16
CASNO: 74-82-8
ID: 4
COMMENT: Any=100 ; NIST MS# 18807, Seq# R26
INCHIKEY: VNWKTOKETHGBQD-UHFFFAOYSA-N
INCHI: InChI=1S/CH4/h1H4
INCHIKEY: VNWKTOKETHGBQD-UHFFFAOYSA-N
IUPAC_NAME: methane
NUM PEAKS: 6
12.0 25.98
13.0 85.92
14.0 170.85
15.0 855.23
16.0 999.0
17.0 10.99
12.0 25.98
13.0 85.92
14.0 170.85
15.0 855.23
16.0 999.0
17.0 10.99

NAME: Methane
FORMULA: CH4
MW: 16
CASNO: 74-82-8
ID: 5
COMMENT: Any=100 ; NIST MS# 18809, Seq# R27
INCHIKEY: VNWKTOKETHGBQD-UHFFFAOYSA-N
INCHI: InChI=1S/CH4/h1H4
INCHIKEY: VNWKTOKETHGBQD-UHFFFAOYSA-N
IUPAC_NAME: methane
NUM PEAKS: 6
12.0 7.99
13.0 28.97
14.0 74.93
15.0 753.32
16.0 999.0
17.0 11.99
12.0 7.99
13.0 28.97
14.0 74.93
15.0 753.32
16.0 999.0
17.0 11.99

NAME: Methane
FORMULA: CH4
MW: 16
CASNO: 74-82-8
ID: 6
COMMENT: Any=100 ; NIST MS# 423924, Seq# R28
INCHIKEY: VNWKTOKETHGBQD-UHFFFAOYSA-N
INCHI: InChI=1S/CH4/h1H4
INCHIKEY: VNWKTOKETHGBQD-UHFFFAOYSA-N
IUPAC_NAME: methane
NUM PEAKS: 6
12.0 25.98
13.0 74.93
14.0 152.86
15.0 829.25
16.0 999.0
17.0 10.99
12.0 25.98
13.0 74.93
14.0 152.86
15.0 829.25
16.0 999.0
17.0 10.99