Mercurial > repos > recetox > matchms_add_key
diff matchms_add_key.xml @ 0:ea00a749ec1f draft
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/matchms commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
| author | recetox |
|---|---|
| date | Thu, 12 Oct 2023 13:26:04 +0000 |
| parents | |
| children | fb80536001bc |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/matchms_add_key.xml Thu Oct 12 13:26:04 2023 +0000 @@ -0,0 +1,70 @@ +<tool id="matchms_add_key" name="matchms add key" version="@TOOL_VERSION@+galaxy1" profile="21.09"> + <description>Set metadata key in MSP to static value</description> + + <macros> + <import>macros.xml</import> + <import>help.xml</import> + </macros> + + <expand macro="creator"/> + + <edam_operations> + <edam_operation>operation_2409</edam_operation> + </edam_operations> + <expand macro="bio.tools"/> + + <requirements> + <requirement type="package" version="@TOOL_VERSION@">matchms</requirement> + </requirements> + + <command detect_errors='aggressive'><![CDATA[ + python ${matchms_python_cli} + ]]></command> + +<configfiles> +<configfile name="matchms_python_cli"> +@init_logger@ + +from matchms.importing import load_from_msp +from matchms.exporting import save_as_msp +spectra = list(load_from_msp("${spectral_library}", metadata_harmonization = "False")) +new_spectra = [] +for spectrum in spectra: + spectrum.set("${key}", "${value}") + new_spectra.append(spectrum) +save_as_msp(new_spectra, "${output}") +</configfile> +</configfiles> + + <inputs> + <param label="Spectra file" name="spectral_library" type="data" format="msp" + help="Mass spectral library file to add key." /> + + <param label="Attribute Name" name="key" type="text" value="" help="Name of the attribute which will be assigned to all spectra records in the MSP." /> + <param label="Value" name="value" type="text" value="" help="Value of the attribute which will be assigned to all spectra records in the MSP." /> + </inputs> + + <outputs> + <data label="${tool.name} on ${on_string}" name="output" format="msp"> + </data> + </outputs> + + <tests> + <test> + <param name="spectral_library" value="filtering/input.msp" ftype="msp"/> + <param name="key" value="tool_used"/> + <param name="value" value="matchms"/> + <output name="output" file="out_matchms_add_key.msp" ftype="msp"/> + </test> + </tests> + + <help><![CDATA[ + Description + The tool take MSP file as an input and take as parameters the name of the + attribute and its value which will be assigned to all spectra records in the MSP. + ]]></help> + + <citations> + <citation type="doi">https://doi.org/10.5281/zenodo.6035335</citation> + </citations> +</tool>
