Skip to content

Commit

Permalink
Merge pull request #173 from bioexcel/master
Browse files Browse the repository at this point in the history
New biobb_pytorch Molecular dynamics autoencoder wrapper
  • Loading branch information
bgruening authored Dec 5, 2024
2 parents 3c6707a + aca822a commit 891dd7d
Show file tree
Hide file tree
Showing 7 changed files with 207 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tools/biobb_pytorch/.shed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: biobb_pytorch
owner: chemteam
description: "biobb_pytorch is the Biobb module collection to create and train ML & DL models using the popular [PyTorch](https://pytorch.org/) Python library."
homepage_url: https://github.com/bioexcel/biobb_pytorch
long_description: |
biobb_pytorch is the Biobb module collection to create and train ML & DL models using the popular [PyTorch](https://pytorch.org/) Python library.
Biobb (BioExcel building blocks) packages are Python building blocks that
create new layer of compatibility and interoperability over popular
bioinformatics tools.
The latest documentation of this package can be found in our readthedocs site:
[latest API documentation](http://biobb-pytorch.readthedocs.io/en/latest/).
remote_repository_url: https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/biobb_pytorch
type: unrestricted
categories:
- Molecular Dynamics
- Computational chemistry
maintainers:
- PauAndrio
- gbayarri
- adamhospital
84 changes: 84 additions & 0 deletions tools/biobb_pytorch/biobb_apply_mdae.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<tool id="biobb_pytorch_apply_mdae" name="ApplyMdae" version="@TOOL_VERSION@" profile="22.05">
<description>Apply a Molecular Dynamics AutoEncoder (MDAE) PyTorch model.</description>
<macros>
<token name="@TOOL_VERSION@">4.2.1</token>
</macros>

<requirements>
<requirement type="package" version="@TOOL_VERSION@">biobb_pytorch</requirement>
</requirements>

<command detect_errors="exit_code"><![CDATA[
ln -s '$input_data_npy_path' ./input_data_npy_path.$input_data_npy_path.ext &&
ln -s '$input_model_pth_path' ./input_model_pth_path.pth &&
#if $config_json:
ln -s '$config_json' ./config_json.$config_json.ext &&
#end if
apply_mdae
#if $config_json:
--config ./config_json.$config_json.ext
#end if
--input_data_npy_path ./input_data_npy_path.$input_data_npy_path.ext
--input_model_pth_path ./input_model_pth_path.pth
#if $output_latent_space_npy_path:
--output_latent_space_npy_path ./output_latent_space_npy_path.npy
#end if
--output_reconstructed_data_npy_path ./output_reconstructed_data_npy_path.npy
;
]]>
</command>

<inputs>
<param name="input_data_npy_path" type="data" format="npy" optional="False" label="Input NPY file" help="Input data file"/>
<param name="input_model_pth_path" type="data" format="pth" optional="False" label="Input PTH file" help="Input model file"/>
<param name="config_json" type="data" format="json" optional="True" label="Configuration file" help="File containing tool settings"/>
</inputs>

<outputs>
<data format="npy" name="output_reconstructed_data_npy_path" from_work_dir="output_reconstructed_data_npy_path.npy" label="output_reconstructed_data_npy_path" />
<data format="npy" name="output_latent_space_npy_path" from_work_dir="output_latent_space_npy_path.npy" label="output_latent_space_npy_path" />
</outputs>

<tests>
<test>
<param name="config_json" value="config_apply_mdae.json" ftype="json" />
<param name="input_data_npy_path" value="train_mdae_traj.npy" ftype="npy" />
<param name="input_model_pth_path" value="ref_output_model.pth" />
<output name="output_reconstructed_data_npy_path" ftype="npy">
<assert_contents>
<has_size value="123k" delta="50k"/>
</assert_contents>
</output>
<output name="output_latent_space_npy_path" ftype="npy">
<assert_contents>
<has_size value="928" delta="200"/>
</assert_contents>
</output>
</test>
</tests>

<help>
.. class:: infomark

Check the syntax for the tool parameters at the original library documentation: https://biobb-pytorch.readthedocs.io/en/latest
</help>

<citations>
<citation type="bibtex">
@misc{githubbiobb,
author = {Andrio P, Bayarri, G., Hospital A, Gelpi JL},
year = {2019-21},
title = {biobb: BioExcel building blocks },
publisher = {GitHub},
journal = {GitHub repository},
url = {https://github.com/bioexcel/biobb_pytorch},
}
</citation>
<citation type="doi">10.1038/s41597-019-0177-4</citation>
</citations>
</tool>
92 changes: 92 additions & 0 deletions tools/biobb_pytorch/biobb_train_mdae.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<tool id="biobb_pytorch_train_mdae" name="TrainMdae" version="@TOOL_VERSION@" profile="22.05">
<description>Train a Molecular Dynamics AutoEncoder (MDAE) PyTorch model</description>
<macros>
<token name="@TOOL_VERSION@">4.2.1</token>
</macros>

<requirements>
<requirement type="package" version="@TOOL_VERSION@">biobb_pytorch</requirement>
</requirements>

<command detect_errors="exit_code"><![CDATA[
ln -s '$input_train_npy_path' ./input_train_npy_path.$input_train_npy_path.ext &&
#if $input_model_pth_path:
ln -s '$input_model_pth_path' ./input_model_pth_path.$input_model_pth_path.ext &&
#end if
#if $config_json:
ln -s '$config_json' ./config_json.$config_json.ext &&
#end if
train_mdae
#if $config_json:
--config ./config_json.$config_json.ext
#end if
--input_train_npy_path ./input_train_npy_path.$input_train_npy_path.ext
#if $input_model_pth_path:
--input_model_pth_path ./input_model_pth_path.$input_model_pth_path.ext
#end if
--output_model_pth_path ./output_model_pth_path.pth
#if $output_train_data_npz_path:
--output_train_data_npz_path ./output_train_data_npz_path.npz
#end if
#if $output_performance_npz_path:
--output_performance_npz_path ./output_performance_npz_path.npz
#end if
;
]]>
</command>

<inputs>
<param name="input_train_npy_path" type="data" format="npy" optional="False" label="Input NPY file" help="Input train NPY data file"/>
<param name="input_model_pth_path" type="data" format="pth" optional="True" label="Input PTH file" help="Input model PTH file"/>
<param name="config_json" type="data" format="json" optional="True" label="Configuration file" help="File containing tool settings"/>
</inputs>

<outputs>
<data format="pth" name="output_model_pth_path" from_work_dir="output_model_pth_path.pth" label="output_model_pth_path" />
<data format="npz" name="output_train_data_npz_path" from_work_dir="output_train_data_npz_path.npz" label="output_train_data_npz_path" />
<data format="npz" name="output_performance_npz_path" from_work_dir="output_performance_npz_path.npz" label="output_performance_npz_path" />
</outputs>

<tests>
<test>
<param name="config_json" value="config_train_mdae.json" ftype="json" />
<param name="input_train_npy_path" value="train_mdae_traj.npy" ftype="npy" />
<output name="output_model_pth_path" file="ref_output_model.pth" compare="sim_size" />
<output name="output_train_data_npz_path">
<assert_contents>
<has_size value="1k" delta="500"/>
</assert_contents>
</output>
<output name="output_performance_npz_path">
<assert_contents>
<has_size value="124k" delta="50k"/>
</assert_contents>
</output>
</test>
</tests>

<help>
.. class:: infomark

Check the syntax for the tool parameters at the original library documentation: https://biobb-pytorch.readthedocs.io/en/latest
</help>

<citations>
<citation type="bibtex">
@misc{githubbiobb,
author = {Andrio P, Bayarri, G., Hospital A, Gelpi JL},
year = {2019-21},
title = {biobb: BioExcel building blocks },
publisher = {GitHub},
journal = {GitHub repository},
url = {https://github.com/bioexcel/biobb_pytorch},
}
</citation>
<citation type="doi">10.1038/s41597-019-0177-4</citation>
</citations>
</tool>
5 changes: 5 additions & 0 deletions tools/biobb_pytorch/test-data/config_apply_mdae.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"properties": {
"batch_size": 1
}
}
6 changes: 6 additions & 0 deletions tools/biobb_pytorch/test-data/config_train_mdae.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"properties": {
"num_epochs": 50,
"seed": 1
}
}
Binary file not shown.
Binary file not shown.

0 comments on commit 891dd7d

Please sign in to comment.