annotate ms2deepscore_training.xml @ 0:0a0529822d91 draft default tip

planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
author recetox
date Mon, 02 Sep 2024 12:12:30 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
1 <tool id="ms2deepscore_training" name="MS2DeepScore Model Training" version="@TOOL_VERSION@+galaxy0">
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
2 <description>Compute similarity scores using a pre-trained MS2DeepScore model</description>
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
3 <macros>
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
4 <import>macros.xml</import>
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
5 </macros>
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
6 <expand macro="creator"/>
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
7 <expand macro="edam" />
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
8
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
9 <requirements>
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
10 <requirement type="package" version="@TOOL_VERSION@">ms2deepscore</requirement>
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
11 <requirement type="package" version="@ONNX_VERSION@">onnx</requirement>
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
12 </requirements>
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
13
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
14 <command detect_errors="exit_code"><![CDATA[
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
15 mkdir processing;
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
16 cp $spectra processing/input."$spectra.ext";
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
17 python3 ${python_wrapper}
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
18 ]]></command>
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
19 <configfiles>
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
20 <configfile name="python_wrapper">
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
21 import onnx
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
22 import os
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
23 import torch
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
24 from ms2deepscore.models import load_model
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
25 from ms2deepscore.SettingsMS2Deepscore import SettingsMS2Deepscore
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
26 from ms2deepscore.wrapper_functions.training_wrapper_functions import train_ms2deepscore_wrapper, StoreTrainingData
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
27
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
28 @json_load@
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
29
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
30 settings = SettingsMS2Deepscore(**model_params)
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
31 file = "processing/input.$spectra.ext"
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
32 directory = train_ms2deepscore_wrapper(file, settings, $validation_split_fraction)
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
33
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
34 expected_file_names = StoreTrainingData(file)
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
35 pt_model_path = os.path.join(expected_file_names.trained_models_folder, directory, settings.model_file_name)
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
36
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
37 model = load_model(pt_model_path)
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
38 model.eval()
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
39
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
40 batch_size = 1
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
41 number_of_bins = settings.number_of_bins()
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
42 additional_inputs = len(settings.additional_metadata)
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
43
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
44 # Create dummy inputs
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
45 spectra_tensors_1 = torch.randn(batch_size, number_of_bins)
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
46 spectra_tensors_2 = torch.randn(batch_size, number_of_bins)
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
47 metadata_1 = torch.randn(batch_size, additional_inputs)
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
48 metadata_2 = torch.randn(batch_size, additional_inputs)
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
49
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
50 # Export the model to ONNX
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
51 torch.onnx.export(
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
52 model,
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
53 (spectra_tensors_1, spectra_tensors_2, metadata_1, metadata_2),
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
54 "$onnx_trained_model",
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
55 verbose=True
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
56 )
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
57
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
58 </configfile>
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
59 </configfiles>
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
60
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
61 <inputs>
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
62 <expand macro="training_param" />
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
63 </inputs>
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
64
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
65 <outputs>
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
66 <data label="Trained model" name="onnx_trained_model" format="onnx"/>
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
67 </outputs>
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
68
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
69 <tests>
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
70 <test expect_num_outputs="1">
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
71 <param name="spectra" value="clean_spectra.mgf" ftype="mgf"/>
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
72 <param name="model_param" value="Model_Parameter_JSON.json" ftype="json" />
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
73 <param name="validation_split_fraction" value="5"/>
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
74 <output name="onnx_trained_model" value="Trained_model.onnx" ftype="onnx" compare="sim_size"/>
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
75 </test>
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
76 </tests>
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
77
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
78 <help>
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
79 <![CDATA[
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
80 Info
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
81 ====
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
82 This tool trains a MS2DeepScore model using the provided training data and model configuration.
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
83 The trained model is then exported using ONNX.
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
84
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
85 About
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
86 =====
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
87 @HELP@
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
88 ]]>
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
89 </help>
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
90 <expand macro="citations"/>
0a0529822d91 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ms2deepscore commit 4bd610e0cbbcbed51a6bfb880179777fc8034fd6
recetox
parents:
diff changeset
91 </tool>