biobb-pytorch 4.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,126 @@
1
+ Metadata-Version: 2.1
2
+ Name: biobb_pytorch
3
+ Version: 4.1.0
4
+ Summary: biobb_pytorch is the Biobb module collection to create and train ML & DL models.
5
+ Home-page: https://github.com/bioexcel/biobb_pytorch
6
+ Author: Biobb developers
7
+ Author-email: pau.andrio@bsc.es
8
+ Project-URL: Documentation, http://biobb-pytorch.readthedocs.io/en/latest/
9
+ Project-URL: Bioexcel, https://bioexcel.eu/
10
+ Keywords: Bioinformatics Workflows BioExcel Compatibility
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Programming Language :: Python :: 3.8
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: License :: OSI Approved :: Apache Software License
16
+ Classifier: Operating System :: MacOS :: MacOS X
17
+ Classifier: Operating System :: POSIX
18
+ Classifier: Operating System :: Unix
19
+ Requires-Python: >=3.8
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+
23
+ [![](https://img.shields.io/github/v/tag/bioexcel/biobb_pytorch?label=Version)](https://GitHub.com/bioexcel/biobb_pytorch/tags/)
24
+ [![](https://img.shields.io/pypi/v/biobb-pytorch.svg?label=Pypi)](https://pypi.python.org/pypi/biobb-pytorch/)
25
+ [![](https://img.shields.io/conda/vn/bioconda/biobb_pytorch?label=Conda)](https://anaconda.org/bioconda/biobb_pytorch)
26
+ [![](https://img.shields.io/conda/dn/bioconda/biobb_pytorch?label=Conda%20Downloads)](https://anaconda.org/bioconda/biobb_pytorch)
27
+ [![](https://img.shields.io/badge/Docker-Quay.io-blue)](https://quay.io/repository/biocontainers/biobb_pytorch?tab=tags)
28
+ [![](https://img.shields.io/badge/Singularity-GalaxyProject-blue)](https://depot.galaxyproject.org/singularity/biobb_pytorch:4.1.0--pyhdfd78af_1)
29
+
30
+ [![](https://img.shields.io/badge/OS-Unix%20%7C%20MacOS-blue)](https://github.com/bioexcel/biobb_pytorch)
31
+ [![](https://img.shields.io/pypi/pyversions/biobb-pytorch.svg?label=Python%20Versions)](https://pypi.org/project/biobb-pytorch/)
32
+ [![](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
33
+ [![](https://img.shields.io/badge/Open%20Source%3f-Yes!-blue)](https://github.com/bioexcel/biobb_pytorch)
34
+
35
+ [![](https://readthedocs.org/projects/biobb-pytorch/badge/?version=latest&label=Docs)](https://biobb-pytorch.readthedocs.io/en/latest/?badge=latest)
36
+ [![](https://img.shields.io/website?down_message=Offline&label=Biobb%20Website&up_message=Online&url=https%3A%2F%2Fmmb.irbbarcelona.org%2Fbiobb%2F)](https://mmb.irbbarcelona.org/biobb/)
37
+ [![](https://img.shields.io/badge/Youtube-tutorial-blue?logo=youtube&logoColor=red)](https://www.youtube.com/watch?v=ou1DOGNs0xM)
38
+ [![](https://zenodo.org/badge/DOI/10.1038/s41597-019-0177-4.svg)](https://doi.org/10.1038/s41597-019-0177-4)
39
+ [![](https://img.shields.io/endpoint?color=brightgreen&url=https%3A%2F%2Fapi.juleskreuer.eu%2Fcitation-badge.php%3Fshield%26doi%3D10.1038%2Fs41597-019-0177-4)](https://www.nature.com/articles/s41597-019-0177-4#citeas)
40
+
41
+ [![](https://docs.bioexcel.eu/biobb_pytorch/junit/testsbadge.svg)](https://docs.bioexcel.eu/biobb_pytorch/junit/report.html)
42
+ [![](https://docs.bioexcel.eu/biobb_pytorch/coverage/coveragebadge.svg)](https://docs.bioexcel.eu/biobb_pytorch/coverage/)
43
+ [![](https://docs.bioexcel.eu/biobb_pytorch/flake8/flake8badge.svg)](https://docs.bioexcel.eu/biobb_pytorch/flake8/)
44
+ [![](https://img.shields.io/github/last-commit/bioexcel/biobb_pytorch?label=Last%20Commit)](https://github.com/bioexcel/biobb_pytorch/commits/master)
45
+ [![](https://img.shields.io/github/issues/bioexcel/biobb_pytorch.svg?color=brightgreen&label=Issues)](https://GitHub.com/bioexcel/biobb_pytorch/issues/)
46
+
47
+
48
+ # biobb_pytorch
49
+
50
+ ### Introduction
51
+ biobb_pytorch is the Biobb module collection to create and train ML & DL models using the popular [PyTorch](https://pytorch.org/) Python library.
52
+ Biobb (BioExcel building blocks) packages are Python building blocks that
53
+ create new layer of compatibility and interoperability over popular
54
+ bioinformatics tools.
55
+ The latest documentation of this package can be found in our readthedocs site:
56
+ [latest API documentation](http://biobb-pytorch.readthedocs.io/en/latest/).
57
+
58
+ ### Version
59
+ v4.1.0 2024.1
60
+
61
+ ### Installation
62
+ Using PIP:
63
+
64
+ > **Important:** PIP only installs the package. All the dependencies must be installed separately. To perform a complete installation, please use ANACONDA, DOCKER or SINGULARITY.
65
+
66
+ * Installation:
67
+
68
+
69
+ pip install "biobb_pytorch>=4.1.0"
70
+
71
+
72
+ * Usage: [Python API documentation](https://biobb-pytorch.readthedocs.io/en/latest/modules.html)
73
+
74
+ Using ANACONDA:
75
+
76
+ * Installation:
77
+
78
+
79
+ conda install -c bioconda "biobb_pytorch>=4.1.0"
80
+
81
+
82
+ * Usage: With conda installation BioBBs can be used with the [Python API documentation](https://biobb-pytorch.readthedocs.io/en/latest/modules.html) and the [Command Line documentation](https://biobb-pytorch.readthedocs.io/en/latest/command_line.html)
83
+
84
+ Using DOCKER:
85
+
86
+ * Installation:
87
+
88
+
89
+ docker pull quay.io/biocontainers/biobb_pytorch:4.1.0--pyhdfd78af_1
90
+
91
+
92
+ * Usage:
93
+
94
+
95
+ docker run quay.io/biocontainers/biobb_pytorch:4.1.0--pyhdfd78af_1 <command>
96
+
97
+
98
+ Using SINGULARITY:
99
+
100
+ **MacOS users**: it's strongly recommended to avoid Singularity and use **Docker** as containerization system.
101
+
102
+ * Installation:
103
+
104
+
105
+ singularity pull --name biobb_pytorch.sif https://depot.galaxyproject.org/singularity/biobb_pytorch:4.1.0--pyhdfd78af_1
106
+
107
+
108
+ * Usage:
109
+
110
+
111
+ singularity exec biobb_pytorch.sif <command>
112
+
113
+
114
+ The command list and specification can be found at the [Command Line documentation](https://biobb-pytorch.readthedocs.io/en/latest/command_line.html).
115
+
116
+
117
+ ### Copyright & Licensing
118
+ This software has been developed in the [MMB group](http://mmb.irbbarcelona.org) at the [BSC](http://www.bsc.es/) & [IRB](https://www.irbbarcelona.org/) for the [European BioExcel](http://bioexcel.eu/), funded by the European Commission (EU H2020 [823830](http://cordis.europa.eu/projects/823830), EU H2020 [675728](http://cordis.europa.eu/projects/675728)).
119
+
120
+ * (c) 2015-2024 [Barcelona Supercomputing Center](https://www.bsc.es/)
121
+ * (c) 2015-2024 [Institute for Research in Biomedicine](https://www.irbbarcelona.org/)
122
+
123
+ Licensed under the
124
+ [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0), see the file LICENSE for details.
125
+
126
+ ![](https://bioexcel.eu/wp-content/uploads/2019/04/Bioexcell_logo_1080px_transp.png "Bioexcel")
@@ -0,0 +1,104 @@
1
+ [![](https://img.shields.io/github/v/tag/bioexcel/biobb_pytorch?label=Version)](https://GitHub.com/bioexcel/biobb_pytorch/tags/)
2
+ [![](https://img.shields.io/pypi/v/biobb-pytorch.svg?label=Pypi)](https://pypi.python.org/pypi/biobb-pytorch/)
3
+ [![](https://img.shields.io/conda/vn/bioconda/biobb_pytorch?label=Conda)](https://anaconda.org/bioconda/biobb_pytorch)
4
+ [![](https://img.shields.io/conda/dn/bioconda/biobb_pytorch?label=Conda%20Downloads)](https://anaconda.org/bioconda/biobb_pytorch)
5
+ [![](https://img.shields.io/badge/Docker-Quay.io-blue)](https://quay.io/repository/biocontainers/biobb_pytorch?tab=tags)
6
+ [![](https://img.shields.io/badge/Singularity-GalaxyProject-blue)](https://depot.galaxyproject.org/singularity/biobb_pytorch:4.1.0--pyhdfd78af_1)
7
+
8
+ [![](https://img.shields.io/badge/OS-Unix%20%7C%20MacOS-blue)](https://github.com/bioexcel/biobb_pytorch)
9
+ [![](https://img.shields.io/pypi/pyversions/biobb-pytorch.svg?label=Python%20Versions)](https://pypi.org/project/biobb-pytorch/)
10
+ [![](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
11
+ [![](https://img.shields.io/badge/Open%20Source%3f-Yes!-blue)](https://github.com/bioexcel/biobb_pytorch)
12
+
13
+ [![](https://readthedocs.org/projects/biobb-pytorch/badge/?version=latest&label=Docs)](https://biobb-pytorch.readthedocs.io/en/latest/?badge=latest)
14
+ [![](https://img.shields.io/website?down_message=Offline&label=Biobb%20Website&up_message=Online&url=https%3A%2F%2Fmmb.irbbarcelona.org%2Fbiobb%2F)](https://mmb.irbbarcelona.org/biobb/)
15
+ [![](https://img.shields.io/badge/Youtube-tutorial-blue?logo=youtube&logoColor=red)](https://www.youtube.com/watch?v=ou1DOGNs0xM)
16
+ [![](https://zenodo.org/badge/DOI/10.1038/s41597-019-0177-4.svg)](https://doi.org/10.1038/s41597-019-0177-4)
17
+ [![](https://img.shields.io/endpoint?color=brightgreen&url=https%3A%2F%2Fapi.juleskreuer.eu%2Fcitation-badge.php%3Fshield%26doi%3D10.1038%2Fs41597-019-0177-4)](https://www.nature.com/articles/s41597-019-0177-4#citeas)
18
+
19
+ [![](https://docs.bioexcel.eu/biobb_pytorch/junit/testsbadge.svg)](https://docs.bioexcel.eu/biobb_pytorch/junit/report.html)
20
+ [![](https://docs.bioexcel.eu/biobb_pytorch/coverage/coveragebadge.svg)](https://docs.bioexcel.eu/biobb_pytorch/coverage/)
21
+ [![](https://docs.bioexcel.eu/biobb_pytorch/flake8/flake8badge.svg)](https://docs.bioexcel.eu/biobb_pytorch/flake8/)
22
+ [![](https://img.shields.io/github/last-commit/bioexcel/biobb_pytorch?label=Last%20Commit)](https://github.com/bioexcel/biobb_pytorch/commits/master)
23
+ [![](https://img.shields.io/github/issues/bioexcel/biobb_pytorch.svg?color=brightgreen&label=Issues)](https://GitHub.com/bioexcel/biobb_pytorch/issues/)
24
+
25
+
26
+ # biobb_pytorch
27
+
28
+ ### Introduction
29
+ biobb_pytorch is the Biobb module collection to create and train ML & DL models using the popular [PyTorch](https://pytorch.org/) Python library.
30
+ Biobb (BioExcel building blocks) packages are Python building blocks that
31
+ create new layer of compatibility and interoperability over popular
32
+ bioinformatics tools.
33
+ The latest documentation of this package can be found in our readthedocs site:
34
+ [latest API documentation](http://biobb-pytorch.readthedocs.io/en/latest/).
35
+
36
+ ### Version
37
+ v4.1.0 2024.1
38
+
39
+ ### Installation
40
+ Using PIP:
41
+
42
+ > **Important:** PIP only installs the package. All the dependencies must be installed separately. To perform a complete installation, please use ANACONDA, DOCKER or SINGULARITY.
43
+
44
+ * Installation:
45
+
46
+
47
+ pip install "biobb_pytorch>=4.1.0"
48
+
49
+
50
+ * Usage: [Python API documentation](https://biobb-pytorch.readthedocs.io/en/latest/modules.html)
51
+
52
+ Using ANACONDA:
53
+
54
+ * Installation:
55
+
56
+
57
+ conda install -c bioconda "biobb_pytorch>=4.1.0"
58
+
59
+
60
+ * Usage: With conda installation BioBBs can be used with the [Python API documentation](https://biobb-pytorch.readthedocs.io/en/latest/modules.html) and the [Command Line documentation](https://biobb-pytorch.readthedocs.io/en/latest/command_line.html)
61
+
62
+ Using DOCKER:
63
+
64
+ * Installation:
65
+
66
+
67
+ docker pull quay.io/biocontainers/biobb_pytorch:4.1.0--pyhdfd78af_1
68
+
69
+
70
+ * Usage:
71
+
72
+
73
+ docker run quay.io/biocontainers/biobb_pytorch:4.1.0--pyhdfd78af_1 <command>
74
+
75
+
76
+ Using SINGULARITY:
77
+
78
+ **MacOS users**: it's strongly recommended to avoid Singularity and use **Docker** as containerization system.
79
+
80
+ * Installation:
81
+
82
+
83
+ singularity pull --name biobb_pytorch.sif https://depot.galaxyproject.org/singularity/biobb_pytorch:4.1.0--pyhdfd78af_1
84
+
85
+
86
+ * Usage:
87
+
88
+
89
+ singularity exec biobb_pytorch.sif <command>
90
+
91
+
92
+ The command list and specification can be found at the [Command Line documentation](https://biobb-pytorch.readthedocs.io/en/latest/command_line.html).
93
+
94
+
95
+ ### Copyright & Licensing
96
+ This software has been developed in the [MMB group](http://mmb.irbbarcelona.org) at the [BSC](http://www.bsc.es/) & [IRB](https://www.irbbarcelona.org/) for the [European BioExcel](http://bioexcel.eu/), funded by the European Commission (EU H2020 [823830](http://cordis.europa.eu/projects/823830), EU H2020 [675728](http://cordis.europa.eu/projects/675728)).
97
+
98
+ * (c) 2015-2024 [Barcelona Supercomputing Center](https://www.bsc.es/)
99
+ * (c) 2015-2024 [Institute for Research in Biomedicine](https://www.irbbarcelona.org/)
100
+
101
+ Licensed under the
102
+ [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0), see the file LICENSE for details.
103
+
104
+ ![](https://bioexcel.eu/wp-content/uploads/2019/04/Bioexcell_logo_1080px_transp.png "Bioexcel")
@@ -0,0 +1,5 @@
1
+ from . import mdae
2
+
3
+ name = "biobb_pytorch"
4
+ __all__ = ["mdae"]
5
+ __version__ = "4.1.0"
@@ -0,0 +1,5 @@
1
+ from . import train_mdae
2
+ from . import apply_mdae
3
+
4
+ name = "mdae"
5
+ __all__ = ["train_mdae", "apply_mdae"]
@@ -0,0 +1,169 @@
1
+ import torch
2
+ import numpy as np
3
+ import argparse
4
+ from typing import Optional, Tuple, Dict
5
+ from biobb_common.generic.biobb_object import BiobbObject
6
+ from biobb_common.configuration import settings
7
+ from biobb_common.tools import file_utils as fu
8
+ from biobb_common.tools.file_utils import launchlogger
9
+ from biobb_pytorch.mdae.mdae import MDAE
10
+ from biobb_pytorch.mdae.common import ndarray_normalization, ndarray_denormalization, execute_model
11
+
12
+
13
+ class ApplyMDAE(BiobbObject):
14
+ """
15
+ | biobb_pytorch ApplyMDAE
16
+ | Apply a Molecular Dynamics AutoEncoder (MDAE) PyTorch model.
17
+ | Apply a Molecular Dynamics AutoEncoder (MDAE) PyTorch model, the resulting denoised molecular dynamics or the reduced the dimensionality of molecular dynamics data can be used to analyze the dynamic properties of the system.
18
+
19
+ Args:
20
+ input_data_npy_path (str): Path to the input data file. File type: input. `Sample file <https://github.com/bioexcel/biobb_pytorch/raw/master/biobb_pytorch/test/data/mdae/train_mdae_traj.npy>`_. Accepted formats: npy (edam:format_4003).
21
+ input_model_pth_path (str): Path to the input model file. File type: input. `Sample file <https://github.com/bioexcel/biobb_pytorch/raw/master/biobb_pytorch/test/reference/mdae/ref_output_model.pth>`_. Accepted formats: pth (edam:format_2333).
22
+ output_reconstructed_data_npy_path (str): Path to the output reconstructed data file. File type: output. `Sample file <https://github.com/bioexcel/biobb_pytorch/raw/master/biobb_pytorch/test/reference/mdae/ref_output_reconstructed_data.npy>`_. Accepted formats: npy (edam:format_4003).
23
+ output_latent_space_npy_path (str) (Optional): Path to the reduced dimensionality file. File type: output. `Sample file <https://github.com/bioexcel/biobb_pytorch/raw/master/biobb_pytorch/test/reference/mdae/ref_output_latent_space.npy>`_. Accepted formats: npy (edam:format_4003).
24
+ properties (dict - Python dictionary object containing the tool parameters, not input/output files):
25
+ * **batch_size** (*int*) - (1) number of samples/frames per batch.
26
+ * **latent_dimensions** (*int*) - (2) min dimensionality of the latent space.
27
+ * **num_layers** (*int*) - (4) number of layers in the encoder/decoder (4 to encode and 4 to decode).
28
+ * **input_dimensions** (*int*) - (None) input dimensions by default it should be the number of features in the input data (number of atoms * 3 corresponding to x, y, z coordinates).
29
+ * **output_dimensions** (*int*) - (None) output dimensions by default it should be the number of features in the input data (number of atoms * 3 corresponding to x, y, z coordinates).
30
+
31
+ Examples:
32
+ This is a use case of how to use the building block from Python::
33
+
34
+ from biobb_pytorch.mdae.apply_mdae import ApplyMDAE
35
+ prop = {
36
+ 'latent_dimensions': 2,
37
+ 'num_layers': 4
38
+ }
39
+ ApplyMDAE(input_data_npy_path='/path/to/myInputData.npy',
40
+ output_reconstructed_data_npy_path='/path/to/newReconstructedData.npz',
41
+ input_model_pth_path='/path/to/oldModel.pth',
42
+ properties=prop).launch()
43
+
44
+ Info:
45
+ * wrapped_software:
46
+ * name: PyTorch
47
+ * version: >=1.6.0
48
+ * license: BSD 3-Clause
49
+ * ontology:
50
+ * name: EDAM
51
+ * schema: http://edamontology.org/EDAM.owl
52
+ """
53
+
54
+ def __init__(self,
55
+ input_data_npy_path: str,
56
+ input_model_pth_path: str,
57
+ output_reconstructed_data_npy_path: str,
58
+ output_latent_space_npy_path: Optional[str] = None,
59
+ properties: Optional[Dict] = None, **kwargs) -> None:
60
+ properties = properties or {}
61
+
62
+ # Call parent class constructor
63
+ super().__init__(properties)
64
+ self.locals_var_dict = locals().copy()
65
+
66
+ # Input/Output files
67
+ self.io_dict = {
68
+ 'in': {'input_data_npy_path': input_data_npy_path, 'input_model_pth_path': input_model_pth_path},
69
+ 'out': {'output_reconstructed_data_npy_path': output_reconstructed_data_npy_path, 'output_latent_space_npy_path': output_latent_space_npy_path}
70
+ }
71
+
72
+ # Properties specific for BB
73
+ self.batch_size: int = int(properties.get('batch_size', 1)) # number of samples/frames per batch
74
+ self.latent_dimensions: int = int(properties.get('latent_dimensions', 2)) # min dimensionality of the latent space
75
+ self.num_layers: int = int(properties.get('num_layers', 4)) # number of layers in the encoder/decoder (4 to encode and 4 to decode)
76
+
77
+ # Input data section
78
+ input_raw_data = np.load(self.io_dict['in']['input_data_npy_path'])
79
+ # Reshape the input data to be a 2D array and normalization
80
+ input_reshaped_data: np.ndarray = np.reshape(input_raw_data, (len(input_raw_data), input_raw_data.shape[1]*input_raw_data.shape[2]))
81
+ # Normalization of the input data
82
+ self.input_data_max_values: np.ndarray = np.max(input_reshaped_data, axis=0)
83
+ self.input_data_min_values: np.ndarray = np.min(input_reshaped_data, axis=0)
84
+ input_data: np.ndarray = ndarray_normalization(input_reshaped_data, max_values=self.input_data_max_values, min_values=self.input_data_min_values)
85
+ self.input_dimensions: int = int(properties['input_dimensions']) if properties.get('input_dimensions') else input_data.shape[1] # input dimensions by default it should be the number of features in the input data (number of atoms * 3 corresponding to x, y, z coordinates)
86
+ self.output_dimensions: int = int(properties['output_dimensions']) if properties.get('output_dimensions') else self.input_dimensions # output dimensions by default it should be the number of features in the input data (number of atoms * 3 corresponding to x, y, z coordinates)
87
+
88
+ # Check the properties
89
+ self.check_properties(properties)
90
+ self.check_arguments()
91
+
92
+ data_tensor = torch.FloatTensor(input_data)
93
+ tensor_dataset = torch.utils.data.TensorDataset(data_tensor)
94
+ self.data_loader = torch.utils.data.DataLoader(tensor_dataset, batch_size=self.batch_size, shuffle=False)
95
+ self.model = MDAE(input_dimensions=self.input_dimensions, num_layers=self.num_layers, latent_dimensions=self.latent_dimensions)
96
+ self.model.load_state_dict(torch.load(self.io_dict['in']['input_model_pth_path'], map_location=self.model.device))
97
+
98
+ @launchlogger
99
+ def launch(self) -> int:
100
+ """Execute the :class:`ApplyMDAE <mdae.apply_mdae.ApplyMDAE>` object."""
101
+
102
+ # Setup Biobb
103
+ if self.check_restart():
104
+ return 0
105
+
106
+ self.stage_files()
107
+
108
+ fu.log(f'Applying MDAE model reducing dimensionality from {self.input_dimensions} to {self.latent_dimensions} and reconstructing.', self.out_log)
109
+ latent_space, reconstructed_data = self.apply_model(self.data_loader)
110
+ denormalized_reconstructed_data = ndarray_denormalization(reconstructed_data, self.input_data_max_values, self.input_data_min_values)
111
+ reshaped_reconstructed_data = np.reshape(denormalized_reconstructed_data, (len(denormalized_reconstructed_data), -1, 3))
112
+ fu.log(f'Saving reconstructed data to {self.stage_io_dict["out"]["output_reconstructed_data_npy_path"]}', self.out_log)
113
+ np.save(self.stage_io_dict['out']['output_reconstructed_data_npy_path'], np.array(reshaped_reconstructed_data))
114
+
115
+ if self.io_dict['out'].get('output_latent_space_npy_path'):
116
+ fu.log(f'Saving latent space to {self.io_dict["out"]["output_latent_space_npy_path"]}', self.out_log)
117
+ np.save(self.io_dict['out']['output_latent_space_npy_path'], np.array(latent_space))
118
+
119
+ # Copy files to host
120
+ self.copy_to_host()
121
+
122
+ # Remove temporal files
123
+ self.remove_tmp_files()
124
+
125
+ self.check_arguments(output_files_created=True, raise_exception=False)
126
+ return 0
127
+
128
+ def apply_model(self, dataloader: torch.utils.data.DataLoader) -> Tuple[np.ndarray, np.ndarray]:
129
+ return execute_model(self.model, dataloader, self.input_dimensions, self.latent_dimensions)[1:]
130
+
131
+
132
+ def applyMDAE(input_data_npy_path: str, input_model_pth_path: str,
133
+ output_reconstructed_data_npy_path: str, output_latent_space_npy_path: Optional[str] = None,
134
+ properties: Optional[Dict] = None, **kwargs) -> int:
135
+ """Execute the :class:`ApplyMDAE <mdae.apply_mdae.ApplyMDAE>` class and
136
+ execute the :meth:`launch() <mdae.apply_mdae.ApplyMDAE.launch>` method."""
137
+
138
+ return ApplyMDAE(input_data_npy_path=input_data_npy_path, input_model_pth_path=input_model_pth_path,
139
+ output_reconstructed_data_npy_path=output_reconstructed_data_npy_path,
140
+ output_latent_space_npy_path=output_latent_space_npy_path, properties=properties, **kwargs).launch()
141
+
142
+
143
+ def main():
144
+ """Command line execution of this building block. Please check the command line documentation."""
145
+ parser = argparse.ArgumentParser(description='Apply a Molecular Dynamics AutoEncoder (MDAE) PyTorch model.',
146
+ formatter_class=lambda prog: argparse.RawTextHelpFormatter(prog, width=99999))
147
+ parser.add_argument('-c', '--config', required=False, help="This file can be a YAML file, JSON file or JSON string")
148
+
149
+ # Specific args of each building block
150
+ required_args = parser.add_argument_group('required arguments')
151
+
152
+ required_args.add_argument('--input_data_npy_path', required=True, help='Path to the input data file.')
153
+ required_args.add_argument('--input_model_pth_path', required=True, help='Path to the input model file.')
154
+ required_args.add_argument('--output_reconstructed_data_npy_path', required=True, help='Path to the output reconstructed data file.')
155
+ parser.add_argument('--output_latent_space_npy_path', required=False, help='Path to the reduced dimensionality file.')
156
+ parser.add_argument('--properties', required=False, help='Additional properties for the MDAE object.')
157
+ args = parser.parse_args()
158
+ config = args.config if args.config else None
159
+ properties = settings.ConfReader(config=config).get_prop_dic()
160
+
161
+ applyMDAE(input_data_npy_path=args.input_data_npy_path,
162
+ input_model_pth_path=args.input_model_pth_path,
163
+ output_reconstructed_data_npy_path=args.output_reconstructed_data_npy_path,
164
+ output_latent_space_npy_path=args.output_latent_space_npy_path,
165
+ properties=properties)
166
+
167
+
168
+ if __name__ == '__main__':
169
+ main()