biobb-io 4.2.0__py3-none-any.whl → 5.0.0__py3-none-any.whl
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.
- biobb_io/__init__.py +3 -1
- biobb_io/api/__init__.py +33 -1
- biobb_io/api/alphafold.py +53 -22
- biobb_io/api/api_binding_site.py +59 -23
- biobb_io/api/canonical_fasta.py +55 -23
- biobb_io/api/common.py +185 -103
- biobb_io/api/drugbank.py +52 -22
- biobb_io/api/ideal_sdf.py +53 -23
- biobb_io/api/ligand.py +53 -23
- biobb_io/api/memprotmd_sim.py +53 -22
- biobb_io/api/memprotmd_sim_list.py +44 -18
- biobb_io/api/memprotmd_sim_search.py +48 -21
- biobb_io/api/mmcif.py +53 -23
- biobb_io/api/pdb.py +57 -25
- biobb_io/api/pdb_cluster_zip.py +70 -32
- biobb_io/api/pdb_variants.py +108 -40
- biobb_io/api/structure_info.py +54 -22
- biobb_io/py.typed +0 -0
- {biobb_io-4.2.0.dist-info → biobb_io-5.0.0.dist-info}/METADATA +15 -16
- biobb_io-5.0.0.dist-info/RECORD +25 -0
- {biobb_io-4.2.0.dist-info → biobb_io-5.0.0.dist-info}/WHEEL +1 -1
- biobb_io-4.2.0.dist-info/RECORD +0 -24
- {biobb_io-4.2.0.dist-info → biobb_io-5.0.0.dist-info}/LICENSE +0 -0
- {biobb_io-4.2.0.dist-info → biobb_io-5.0.0.dist-info}/entry_points.txt +0 -0
- {biobb_io-4.2.0.dist-info → biobb_io-5.0.0.dist-info}/top_level.txt +0 -0
biobb_io/api/ideal_sdf.py
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
|
|
3
3
|
"""Module containing the IdealSdf class and the command line interface."""
|
|
4
|
+
|
|
4
5
|
import argparse
|
|
5
|
-
from
|
|
6
|
+
from typing import Optional
|
|
7
|
+
|
|
6
8
|
from biobb_common.configuration import settings
|
|
9
|
+
from biobb_common.generic.biobb_object import BiobbObject
|
|
7
10
|
from biobb_common.tools.file_utils import launchlogger
|
|
8
|
-
|
|
11
|
+
|
|
12
|
+
from biobb_io.api.common import (
|
|
13
|
+
check_mandatory_property,
|
|
14
|
+
check_output_path,
|
|
15
|
+
download_ideal_sdf,
|
|
16
|
+
write_sdf,
|
|
17
|
+
)
|
|
9
18
|
|
|
10
19
|
|
|
11
20
|
class IdealSdf(BiobbObject):
|
|
@@ -21,6 +30,7 @@ class IdealSdf(BiobbObject):
|
|
|
21
30
|
* **api_id** (*str*) - ("pdbe") Identifier of the PDB REST API from which the SDF structure will be downloaded. Values: pdbe (`PDB in Europe REST API <https://www.ebi.ac.uk/pdbe/pdbe-rest-api>`_), pdb (`RCSB PDB REST API <https://data.rcsb.org/>`_).
|
|
22
31
|
* **remove_tmp** (*bool*) - (True) [WF property] Remove temporal files.
|
|
23
32
|
* **restart** (*bool*) - (False) [WF property] Do not execute if output files exist.
|
|
33
|
+
* **sandbox_path** (*str*) - ("./") [WF property] Parent path to the sandbox directory.
|
|
24
34
|
|
|
25
35
|
Examples:
|
|
26
36
|
This is a use example of how to use the building block from Python::
|
|
@@ -43,8 +53,7 @@ class IdealSdf(BiobbObject):
|
|
|
43
53
|
|
|
44
54
|
"""
|
|
45
55
|
|
|
46
|
-
def __init__(self, output_sdf_path,
|
|
47
|
-
properties=None, **kwargs) -> None:
|
|
56
|
+
def __init__(self, output_sdf_path, properties=None, **kwargs) -> None:
|
|
48
57
|
properties = properties or {}
|
|
49
58
|
|
|
50
59
|
# Call parent class constructor
|
|
@@ -52,13 +61,11 @@ class IdealSdf(BiobbObject):
|
|
|
52
61
|
self.locals_var_dict = locals().copy()
|
|
53
62
|
|
|
54
63
|
# Input/Output files
|
|
55
|
-
self.io_dict = {
|
|
56
|
-
"out": {"output_sdf_path": output_sdf_path}
|
|
57
|
-
}
|
|
64
|
+
self.io_dict = {"out": {"output_sdf_path": output_sdf_path}}
|
|
58
65
|
|
|
59
66
|
# Properties specific for BB
|
|
60
|
-
self.api_id = properties.get(
|
|
61
|
-
self.ligand_code = properties.get(
|
|
67
|
+
self.api_id = properties.get("api_id", "pdbe")
|
|
68
|
+
self.ligand_code = properties.get("ligand_code", None)
|
|
62
69
|
self.properties = properties
|
|
63
70
|
|
|
64
71
|
# Check the properties
|
|
@@ -66,8 +73,14 @@ class IdealSdf(BiobbObject):
|
|
|
66
73
|
self.check_arguments()
|
|
67
74
|
|
|
68
75
|
def check_data_params(self, out_log, err_log):
|
|
69
|
-
"""
|
|
70
|
-
self.output_sdf_path = check_output_path(
|
|
76
|
+
"""Checks all the input/output paths and parameters"""
|
|
77
|
+
self.output_sdf_path = check_output_path(
|
|
78
|
+
self.io_dict["out"]["output_sdf_path"],
|
|
79
|
+
"output_sdf_path",
|
|
80
|
+
False,
|
|
81
|
+
out_log,
|
|
82
|
+
self.__class__.__name__,
|
|
83
|
+
)
|
|
71
84
|
|
|
72
85
|
@launchlogger
|
|
73
86
|
def launch(self) -> int:
|
|
@@ -80,12 +93,16 @@ class IdealSdf(BiobbObject):
|
|
|
80
93
|
if self.check_restart():
|
|
81
94
|
return 0
|
|
82
95
|
|
|
83
|
-
check_mandatory_property(
|
|
96
|
+
check_mandatory_property(
|
|
97
|
+
self.ligand_code, "ligand_code", self.out_log, self.__class__.__name__
|
|
98
|
+
)
|
|
84
99
|
|
|
85
100
|
self.ligand_code = self.ligand_code.strip()
|
|
86
101
|
|
|
87
102
|
# Downloading PDB file
|
|
88
|
-
sdf_string = download_ideal_sdf(
|
|
103
|
+
sdf_string = download_ideal_sdf(
|
|
104
|
+
self.ligand_code, self.api_id, self.out_log, self.global_log
|
|
105
|
+
)
|
|
89
106
|
write_sdf(sdf_string, self.output_sdf_path, self.out_log, self.global_log)
|
|
90
107
|
|
|
91
108
|
self.check_arguments(output_files_created=True, raise_exception=False)
|
|
@@ -93,31 +110,44 @@ class IdealSdf(BiobbObject):
|
|
|
93
110
|
return 0
|
|
94
111
|
|
|
95
112
|
|
|
96
|
-
def ideal_sdf(output_sdf_path: str, properties: dict = None, **kwargs) -> int:
|
|
113
|
+
def ideal_sdf(output_sdf_path: str, properties: Optional[dict] = None, **kwargs) -> int:
|
|
97
114
|
"""Execute the :class:`IdealSdf <api.ideal_sdf.IdealSdf>` class and
|
|
98
115
|
execute the :meth:`launch() <api.ideal_sdf.IdealSdf.launch>` method."""
|
|
99
116
|
|
|
100
|
-
return IdealSdf(
|
|
101
|
-
|
|
117
|
+
return IdealSdf(
|
|
118
|
+
output_sdf_path=output_sdf_path, properties=properties, **kwargs
|
|
119
|
+
).launch()
|
|
102
120
|
|
|
103
121
|
|
|
104
122
|
def main():
|
|
105
123
|
"""Command line execution of this building block. Please check the command line documentation."""
|
|
106
|
-
parser = argparse.ArgumentParser(
|
|
107
|
-
|
|
124
|
+
parser = argparse.ArgumentParser(
|
|
125
|
+
description="This class is a wrapper for downloading an ideal SDF ligand from the Protein Data Bank.",
|
|
126
|
+
formatter_class=lambda prog: argparse.RawTextHelpFormatter(prog, width=99999),
|
|
127
|
+
)
|
|
128
|
+
parser.add_argument(
|
|
129
|
+
"-c",
|
|
130
|
+
"--config",
|
|
131
|
+
required=False,
|
|
132
|
+
help="This file can be a YAML file, JSON file or JSON string",
|
|
133
|
+
)
|
|
108
134
|
|
|
109
135
|
# Specific args of each building block
|
|
110
|
-
required_args = parser.add_argument_group(
|
|
111
|
-
required_args.add_argument(
|
|
136
|
+
required_args = parser.add_argument_group("required arguments")
|
|
137
|
+
required_args.add_argument(
|
|
138
|
+
"-o",
|
|
139
|
+
"--output_sdf_path",
|
|
140
|
+
required=True,
|
|
141
|
+
help="Path to the output SDF file. Accepted formats: sdf.",
|
|
142
|
+
)
|
|
112
143
|
|
|
113
144
|
args = parser.parse_args()
|
|
114
145
|
config = args.config if args.config else None
|
|
115
146
|
properties = settings.ConfReader(config=config).get_prop_dic()
|
|
116
147
|
|
|
117
148
|
# Specific call of each building block
|
|
118
|
-
ideal_sdf(output_sdf_path=args.output_sdf_path,
|
|
119
|
-
properties=properties)
|
|
149
|
+
ideal_sdf(output_sdf_path=args.output_sdf_path, properties=properties)
|
|
120
150
|
|
|
121
151
|
|
|
122
|
-
if __name__ ==
|
|
152
|
+
if __name__ == "__main__":
|
|
123
153
|
main()
|
biobb_io/api/ligand.py
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
|
|
3
3
|
"""Module containing the Ligand class and the command line interface."""
|
|
4
|
+
|
|
4
5
|
import argparse
|
|
5
|
-
from
|
|
6
|
+
from typing import Optional
|
|
7
|
+
|
|
6
8
|
from biobb_common.configuration import settings
|
|
9
|
+
from biobb_common.generic.biobb_object import BiobbObject
|
|
7
10
|
from biobb_common.tools.file_utils import launchlogger
|
|
8
|
-
|
|
11
|
+
|
|
12
|
+
from biobb_io.api.common import (
|
|
13
|
+
check_mandatory_property,
|
|
14
|
+
check_output_path,
|
|
15
|
+
download_ligand,
|
|
16
|
+
write_pdb,
|
|
17
|
+
)
|
|
9
18
|
|
|
10
19
|
|
|
11
20
|
class Ligand(BiobbObject):
|
|
@@ -21,6 +30,7 @@ class Ligand(BiobbObject):
|
|
|
21
30
|
* **api_id** (*str*) - ("mmb") Identifier of the PDB REST API from which the PDB structure will be downloaded. Values: pdbe (`PDB in Europe REST API <https://www.ebi.ac.uk/pdbe/pdbe-rest-api>`_), mmb (`MMB PDB mirror API <http://mmb.irbbarcelona.org/api/>`_).
|
|
22
31
|
* **remove_tmp** (*bool*) - (True) [WF property] Remove temporal files.
|
|
23
32
|
* **restart** (*bool*) - (False) [WF property] Do not execute if output files exist.
|
|
33
|
+
* **sandbox_path** (*str*) - ("./") [WF property] Parent path to the sandbox directory.
|
|
24
34
|
|
|
25
35
|
Examples:
|
|
26
36
|
This is a use example of how to use the building block from Python::
|
|
@@ -43,8 +53,7 @@ class Ligand(BiobbObject):
|
|
|
43
53
|
|
|
44
54
|
"""
|
|
45
55
|
|
|
46
|
-
def __init__(self, output_pdb_path,
|
|
47
|
-
properties=None, **kwargs) -> None:
|
|
56
|
+
def __init__(self, output_pdb_path, properties=None, **kwargs) -> None:
|
|
48
57
|
properties = properties or {}
|
|
49
58
|
|
|
50
59
|
# Call parent class constructor
|
|
@@ -52,13 +61,11 @@ class Ligand(BiobbObject):
|
|
|
52
61
|
self.locals_var_dict = locals().copy()
|
|
53
62
|
|
|
54
63
|
# Input/Output files
|
|
55
|
-
self.io_dict = {
|
|
56
|
-
"out": {"output_pdb_path": output_pdb_path}
|
|
57
|
-
}
|
|
64
|
+
self.io_dict = {"out": {"output_pdb_path": output_pdb_path}}
|
|
58
65
|
|
|
59
66
|
# Properties specific for BB
|
|
60
|
-
self.api_id = properties.get(
|
|
61
|
-
self.ligand_code = properties.get(
|
|
67
|
+
self.api_id = properties.get("api_id", "mmb")
|
|
68
|
+
self.ligand_code = properties.get("ligand_code", None)
|
|
62
69
|
self.properties = properties
|
|
63
70
|
|
|
64
71
|
# Check the properties
|
|
@@ -66,8 +73,14 @@ class Ligand(BiobbObject):
|
|
|
66
73
|
self.check_arguments()
|
|
67
74
|
|
|
68
75
|
def check_data_params(self, out_log, err_log):
|
|
69
|
-
"""
|
|
70
|
-
self.output_pdb_path = check_output_path(
|
|
76
|
+
"""Checks all the input/output paths and parameters"""
|
|
77
|
+
self.output_pdb_path = check_output_path(
|
|
78
|
+
self.io_dict["out"]["output_pdb_path"],
|
|
79
|
+
"output_pdb_path",
|
|
80
|
+
False,
|
|
81
|
+
out_log,
|
|
82
|
+
self.__class__.__name__,
|
|
83
|
+
)
|
|
71
84
|
|
|
72
85
|
@launchlogger
|
|
73
86
|
def launch(self) -> int:
|
|
@@ -80,12 +93,16 @@ class Ligand(BiobbObject):
|
|
|
80
93
|
if self.check_restart():
|
|
81
94
|
return 0
|
|
82
95
|
|
|
83
|
-
check_mandatory_property(
|
|
96
|
+
check_mandatory_property(
|
|
97
|
+
self.ligand_code, "ligand_code", self.out_log, self.__class__.__name__
|
|
98
|
+
)
|
|
84
99
|
|
|
85
100
|
self.ligand_code = self.ligand_code.strip().lower()
|
|
86
101
|
|
|
87
102
|
# Downloading PDB file
|
|
88
|
-
pdb_string = download_ligand(
|
|
103
|
+
pdb_string = download_ligand(
|
|
104
|
+
self.ligand_code, self.api_id, self.out_log, self.global_log
|
|
105
|
+
)
|
|
89
106
|
write_pdb(pdb_string, self.output_pdb_path, None, self.out_log, self.global_log)
|
|
90
107
|
|
|
91
108
|
self.check_arguments(output_files_created=True, raise_exception=False)
|
|
@@ -93,31 +110,44 @@ class Ligand(BiobbObject):
|
|
|
93
110
|
return 0
|
|
94
111
|
|
|
95
112
|
|
|
96
|
-
def ligand(output_pdb_path: str, properties: dict = None, **kwargs) -> int:
|
|
113
|
+
def ligand(output_pdb_path: str, properties: Optional[dict] = None, **kwargs) -> int:
|
|
97
114
|
"""Execute the :class:`Ligand <api.ligand.Ligand>` class and
|
|
98
115
|
execute the :meth:`launch() <api.ligand.Ligand.launch>` method."""
|
|
99
116
|
|
|
100
|
-
return Ligand(
|
|
101
|
-
|
|
117
|
+
return Ligand(
|
|
118
|
+
output_pdb_path=output_pdb_path, properties=properties, **kwargs
|
|
119
|
+
).launch()
|
|
102
120
|
|
|
103
121
|
|
|
104
122
|
def main():
|
|
105
123
|
"""Command line execution of this building block. Please check the command line documentation."""
|
|
106
|
-
parser = argparse.ArgumentParser(
|
|
107
|
-
|
|
124
|
+
parser = argparse.ArgumentParser(
|
|
125
|
+
description="Wrapper for the Protein Data Bank in Europe (https://www.ebi.ac.uk/pdbe/) and the MMB PDB mirror (http://mmb.irbbarcelona.org/api/) for downloading a single PDB ligand.",
|
|
126
|
+
formatter_class=lambda prog: argparse.RawTextHelpFormatter(prog, width=99999),
|
|
127
|
+
)
|
|
128
|
+
parser.add_argument(
|
|
129
|
+
"-c",
|
|
130
|
+
"--config",
|
|
131
|
+
required=False,
|
|
132
|
+
help="This file can be a YAML file, JSON file or JSON string",
|
|
133
|
+
)
|
|
108
134
|
|
|
109
135
|
# Specific args of each building block
|
|
110
|
-
required_args = parser.add_argument_group(
|
|
111
|
-
required_args.add_argument(
|
|
136
|
+
required_args = parser.add_argument_group("required arguments")
|
|
137
|
+
required_args.add_argument(
|
|
138
|
+
"-o",
|
|
139
|
+
"--output_pdb_path",
|
|
140
|
+
required=True,
|
|
141
|
+
help="Path to the output PDB ligand file. Accepted formats: pdb.",
|
|
142
|
+
)
|
|
112
143
|
|
|
113
144
|
args = parser.parse_args()
|
|
114
145
|
config = args.config if args.config else None
|
|
115
146
|
properties = settings.ConfReader(config=config).get_prop_dic()
|
|
116
147
|
|
|
117
148
|
# Specific call of each building block
|
|
118
|
-
ligand(output_pdb_path=args.output_pdb_path,
|
|
119
|
-
properties=properties)
|
|
149
|
+
ligand(output_pdb_path=args.output_pdb_path, properties=properties)
|
|
120
150
|
|
|
121
151
|
|
|
122
|
-
if __name__ ==
|
|
152
|
+
if __name__ == "__main__":
|
|
123
153
|
main()
|
biobb_io/api/memprotmd_sim.py
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
|
|
3
3
|
"""Module containing the MemProtMDSim class and the command line interface."""
|
|
4
|
+
|
|
4
5
|
import argparse
|
|
5
|
-
from
|
|
6
|
+
from typing import Optional
|
|
7
|
+
|
|
6
8
|
from biobb_common.configuration import settings
|
|
9
|
+
from biobb_common.generic.biobb_object import BiobbObject
|
|
7
10
|
from biobb_common.tools.file_utils import launchlogger
|
|
8
|
-
|
|
11
|
+
|
|
12
|
+
from biobb_io.api.common import (
|
|
13
|
+
check_mandatory_property,
|
|
14
|
+
check_output_path,
|
|
15
|
+
get_memprotmd_sim,
|
|
16
|
+
)
|
|
9
17
|
|
|
10
18
|
|
|
11
19
|
class MemProtMDSim(BiobbObject):
|
|
@@ -20,6 +28,7 @@ class MemProtMDSim(BiobbObject):
|
|
|
20
28
|
* **pdb_code** (*str*) - (None) RSCB PDB code.
|
|
21
29
|
* **remove_tmp** (*bool*) - (True) [WF property] Remove temporal files.
|
|
22
30
|
* **restart** (*bool*) - (False) [WF property] Do not execute if output files exist.
|
|
31
|
+
* **sandbox_path** (*str*) - ("./") [WF property] Parent path to the sandbox directory.
|
|
23
32
|
|
|
24
33
|
Examples:
|
|
25
34
|
This is a use example of how to use the building block from Python::
|
|
@@ -41,8 +50,7 @@ class MemProtMDSim(BiobbObject):
|
|
|
41
50
|
|
|
42
51
|
"""
|
|
43
52
|
|
|
44
|
-
def __init__(self, output_simulation,
|
|
45
|
-
properties=None, **kwargs) -> None:
|
|
53
|
+
def __init__(self, output_simulation, properties=None, **kwargs) -> None:
|
|
46
54
|
properties = properties or {}
|
|
47
55
|
|
|
48
56
|
# Call parent class constructor
|
|
@@ -50,12 +58,10 @@ class MemProtMDSim(BiobbObject):
|
|
|
50
58
|
self.locals_var_dict = locals().copy()
|
|
51
59
|
|
|
52
60
|
# Input/Output files
|
|
53
|
-
self.io_dict = {
|
|
54
|
-
"out": {"output_simulation": output_simulation}
|
|
55
|
-
}
|
|
61
|
+
self.io_dict = {"out": {"output_simulation": output_simulation}}
|
|
56
62
|
|
|
57
63
|
# Properties specific for BB
|
|
58
|
-
self.pdb_code = properties.get(
|
|
64
|
+
self.pdb_code = properties.get("pdb_code", None)
|
|
59
65
|
self.properties = properties
|
|
60
66
|
|
|
61
67
|
# Check the properties
|
|
@@ -63,8 +69,14 @@ class MemProtMDSim(BiobbObject):
|
|
|
63
69
|
self.check_arguments()
|
|
64
70
|
|
|
65
71
|
def check_data_params(self, out_log, err_log):
|
|
66
|
-
"""
|
|
67
|
-
self.output_simulation = check_output_path(
|
|
72
|
+
"""Checks all the input/output paths and parameters"""
|
|
73
|
+
self.output_simulation = check_output_path(
|
|
74
|
+
self.io_dict["out"]["output_simulation"],
|
|
75
|
+
"output_simulation",
|
|
76
|
+
False,
|
|
77
|
+
out_log,
|
|
78
|
+
self.__class__.__name__,
|
|
79
|
+
)
|
|
68
80
|
|
|
69
81
|
@launchlogger
|
|
70
82
|
def launch(self) -> int:
|
|
@@ -77,41 +89,60 @@ class MemProtMDSim(BiobbObject):
|
|
|
77
89
|
if self.check_restart():
|
|
78
90
|
return 0
|
|
79
91
|
|
|
80
|
-
check_mandatory_property(
|
|
92
|
+
check_mandatory_property(
|
|
93
|
+
self.pdb_code, "pdb_code", self.out_log, self.__class__.__name__
|
|
94
|
+
)
|
|
81
95
|
|
|
82
96
|
# get simulation files and save to output
|
|
83
|
-
get_memprotmd_sim(
|
|
97
|
+
get_memprotmd_sim(
|
|
98
|
+
self.pdb_code, self.output_simulation, self.out_log, self.global_log
|
|
99
|
+
)
|
|
84
100
|
|
|
85
101
|
self.check_arguments(output_files_created=True, raise_exception=False)
|
|
86
102
|
|
|
87
103
|
return 0
|
|
88
104
|
|
|
89
105
|
|
|
90
|
-
def memprotmd_sim(
|
|
106
|
+
def memprotmd_sim(
|
|
107
|
+
output_simulation: str, properties: Optional[dict] = None, **kwargs
|
|
108
|
+
) -> int:
|
|
91
109
|
"""Execute the :class:`MemProtMDSim <api.memprotmd_sim.MemProtMDSim>` class and
|
|
92
110
|
execute the :meth:`launch() <api.memprotmd_sim.MemProtMDSim.launch>` method."""
|
|
93
111
|
|
|
94
|
-
return MemProtMDSim(
|
|
95
|
-
|
|
112
|
+
return MemProtMDSim(
|
|
113
|
+
output_simulation=output_simulation, properties=properties, **kwargs
|
|
114
|
+
).launch()
|
|
96
115
|
|
|
97
116
|
|
|
98
117
|
def main():
|
|
99
118
|
"""Command line execution of this building block. Please check the command line documentation."""
|
|
100
|
-
parser = argparse.ArgumentParser(
|
|
101
|
-
|
|
119
|
+
parser = argparse.ArgumentParser(
|
|
120
|
+
description="Wrapper for the MemProtMD DB REST API (http://memprotmd.bioch.ox.ac.uk/) to download a simulation.",
|
|
121
|
+
formatter_class=lambda prog: argparse.RawTextHelpFormatter(prog, width=99999),
|
|
122
|
+
)
|
|
123
|
+
parser.add_argument(
|
|
124
|
+
"-c",
|
|
125
|
+
"--config",
|
|
126
|
+
required=False,
|
|
127
|
+
help="This file can be a YAML file, JSON file or JSON string",
|
|
128
|
+
)
|
|
102
129
|
|
|
103
130
|
# Specific args of each building block
|
|
104
|
-
required_args = parser.add_argument_group(
|
|
105
|
-
required_args.add_argument(
|
|
131
|
+
required_args = parser.add_argument_group("required arguments")
|
|
132
|
+
required_args.add_argument(
|
|
133
|
+
"-o",
|
|
134
|
+
"--output_simulation",
|
|
135
|
+
required=True,
|
|
136
|
+
help="Path to the output simulation in a ZIP file. Accepted formats: zip.",
|
|
137
|
+
)
|
|
106
138
|
|
|
107
139
|
args = parser.parse_args()
|
|
108
140
|
config = args.config if args.config else None
|
|
109
141
|
properties = settings.ConfReader(config=config).get_prop_dic()
|
|
110
142
|
|
|
111
143
|
# Specific call of each building block
|
|
112
|
-
memprotmd_sim(output_simulation=args.output_simulation,
|
|
113
|
-
properties=properties)
|
|
144
|
+
memprotmd_sim(output_simulation=args.output_simulation, properties=properties)
|
|
114
145
|
|
|
115
146
|
|
|
116
|
-
if __name__ ==
|
|
147
|
+
if __name__ == "__main__":
|
|
117
148
|
main()
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
|
|
3
3
|
"""Module containing the MemProtMDSimList class and the command line interface."""
|
|
4
|
+
|
|
4
5
|
import argparse
|
|
5
|
-
from
|
|
6
|
+
from typing import Optional
|
|
7
|
+
|
|
6
8
|
from biobb_common.configuration import settings
|
|
9
|
+
from biobb_common.generic.biobb_object import BiobbObject
|
|
7
10
|
from biobb_common.tools.file_utils import launchlogger
|
|
11
|
+
|
|
8
12
|
from biobb_io.api.common import check_output_path, get_memprotmd_sim_list, write_json
|
|
9
13
|
|
|
10
14
|
|
|
@@ -19,13 +23,14 @@ class MemProtMDSimList(BiobbObject):
|
|
|
19
23
|
properties (dic - Python dictionary object containing the tool parameters, not input/output files):
|
|
20
24
|
* **remove_tmp** (*bool*) - (True) [WF property] Remove temporal files.
|
|
21
25
|
* **restart** (*bool*) - (False) [WF property] Do not execute if output files exist.
|
|
26
|
+
* **sandbox_path** (*str*) - ("./") [WF property] Parent path to the sandbox directory.
|
|
22
27
|
|
|
23
28
|
Examples:
|
|
24
29
|
This is a use example of how to use the building block from Python::
|
|
25
30
|
|
|
26
31
|
from biobb_io.api.memprotmd_sim_list import memprotmd_sim_list
|
|
27
32
|
prop = { }
|
|
28
|
-
memprotmd_sim_list(output_simulations='/path/to/
|
|
33
|
+
memprotmd_sim_list(output_simulations='/path/to/newSimulationlist.json',
|
|
29
34
|
properties=prop)
|
|
30
35
|
|
|
31
36
|
Info:
|
|
@@ -38,8 +43,7 @@ class MemProtMDSimList(BiobbObject):
|
|
|
38
43
|
|
|
39
44
|
"""
|
|
40
45
|
|
|
41
|
-
def __init__(self, output_simulations,
|
|
42
|
-
properties=None, **kwargs) -> None:
|
|
46
|
+
def __init__(self, output_simulations, properties=None, **kwargs) -> None:
|
|
43
47
|
properties = properties or {}
|
|
44
48
|
|
|
45
49
|
# Call parent class constructor
|
|
@@ -47,9 +51,7 @@ class MemProtMDSimList(BiobbObject):
|
|
|
47
51
|
self.locals_var_dict = locals().copy()
|
|
48
52
|
|
|
49
53
|
# Input/Output files
|
|
50
|
-
self.io_dict = {
|
|
51
|
-
"out": {"output_simulations": output_simulations}
|
|
52
|
-
}
|
|
54
|
+
self.io_dict = {"out": {"output_simulations": output_simulations}}
|
|
53
55
|
|
|
54
56
|
# Properties specific for BB
|
|
55
57
|
self.properties = properties
|
|
@@ -59,8 +61,14 @@ class MemProtMDSimList(BiobbObject):
|
|
|
59
61
|
self.check_arguments()
|
|
60
62
|
|
|
61
63
|
def check_data_params(self, out_log, err_log):
|
|
62
|
-
"""
|
|
63
|
-
self.output_simulations = check_output_path(
|
|
64
|
+
"""Checks all the input/output paths and parameters"""
|
|
65
|
+
self.output_simulations = check_output_path(
|
|
66
|
+
self.io_dict["out"]["output_simulations"],
|
|
67
|
+
"output_simulations",
|
|
68
|
+
False,
|
|
69
|
+
out_log,
|
|
70
|
+
self.__class__.__name__,
|
|
71
|
+
)
|
|
64
72
|
|
|
65
73
|
@launchlogger
|
|
66
74
|
def launch(self) -> int:
|
|
@@ -84,30 +92,48 @@ class MemProtMDSimList(BiobbObject):
|
|
|
84
92
|
return 0
|
|
85
93
|
|
|
86
94
|
|
|
87
|
-
def memprotmd_sim_list(
|
|
95
|
+
def memprotmd_sim_list(
|
|
96
|
+
output_simulations: str, properties: Optional[dict] = None, **kwargs
|
|
97
|
+
) -> int:
|
|
88
98
|
"""Execute the :class:`MemProtMDSimList <api.memprotmd_sim_list.MemProtMDSimList>` class and
|
|
89
99
|
execute the :meth:`launch() <api.memprotmd_sim_list.MemProtMDSimList.launch>` method."""
|
|
90
100
|
|
|
91
|
-
return MemProtMDSimList(
|
|
92
|
-
|
|
101
|
+
return MemProtMDSimList(
|
|
102
|
+
output_simulations=output_simulations, properties=properties, **kwargs
|
|
103
|
+
).launch()
|
|
93
104
|
|
|
94
105
|
|
|
95
106
|
def main():
|
|
96
107
|
"""Command line execution of this building block. Please check the command line documentation."""
|
|
97
|
-
parser = argparse.ArgumentParser(
|
|
98
|
-
|
|
108
|
+
parser = argparse.ArgumentParser(
|
|
109
|
+
description="Wrapper for the MemProtMD DB REST API (http://memprotmd.bioch.ox.ac.uk/) to get all available membrane-protein systems (simulations).",
|
|
110
|
+
formatter_class=lambda prog: argparse.RawTextHelpFormatter(prog, width=99999),
|
|
111
|
+
)
|
|
112
|
+
parser.add_argument(
|
|
113
|
+
"-c",
|
|
114
|
+
"--config",
|
|
115
|
+
required=False,
|
|
116
|
+
help="This file can be a YAML file, JSON file or JSON string",
|
|
117
|
+
)
|
|
99
118
|
|
|
100
119
|
# Specific args of each building block
|
|
101
|
-
required_args = parser.add_argument_group(
|
|
102
|
-
required_args.add_argument(
|
|
120
|
+
required_args = parser.add_argument_group("required arguments")
|
|
121
|
+
required_args.add_argument(
|
|
122
|
+
"-o",
|
|
123
|
+
"--output_simulations",
|
|
124
|
+
required=True,
|
|
125
|
+
help="Path to the output JSON file. Accepted formats: json.",
|
|
126
|
+
)
|
|
103
127
|
|
|
104
128
|
args = parser.parse_args()
|
|
105
129
|
config = args.config if args.config else None
|
|
106
130
|
properties = settings.ConfReader(config=config).get_prop_dic()
|
|
107
131
|
|
|
108
132
|
# Specific call of each building block
|
|
109
|
-
memprotmd_sim_list(
|
|
133
|
+
memprotmd_sim_list(
|
|
134
|
+
output_simulations=args.output_simulations, properties=properties
|
|
135
|
+
)
|
|
110
136
|
|
|
111
137
|
|
|
112
|
-
if __name__ ==
|
|
138
|
+
if __name__ == "__main__":
|
|
113
139
|
main()
|