biobb-io 4.2.0__py3-none-any.whl → 5.0.1__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 +31 -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 +177 -114
- 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.1.dist-info}/METADATA +15 -16
- biobb_io-5.0.1.dist-info/RECORD +24 -0
- {biobb_io-4.2.0.dist-info → biobb_io-5.0.1.dist-info}/WHEEL +1 -1
- {biobb_io-4.2.0.dist-info → biobb_io-5.0.1.dist-info}/entry_points.txt +0 -1
- biobb_io/api/drugbank.py +0 -121
- biobb_io-4.2.0.dist-info/RECORD +0 -24
- {biobb_io-4.2.0.dist-info → biobb_io-5.0.1.dist-info}/LICENSE +0 -0
- {biobb_io-4.2.0.dist-info → biobb_io-5.0.1.dist-info}/top_level.txt +0 -0
biobb_io/api/mmcif.py
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
|
|
3
3
|
"""Module containing the Mmcif 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_mmcif,
|
|
16
|
+
write_mmcif,
|
|
17
|
+
)
|
|
9
18
|
|
|
10
19
|
|
|
11
20
|
class Mmcif(BiobbObject):
|
|
@@ -21,6 +30,7 @@ class Mmcif(BiobbObject):
|
|
|
21
30
|
* **api_id** (*str*) - ("pdbe") Identifier of the PDB REST API from which the MMCIF 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/>`_), 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 Mmcif(BiobbObject):
|
|
|
43
53
|
|
|
44
54
|
"""
|
|
45
55
|
|
|
46
|
-
def __init__(self, output_mmcif_path,
|
|
47
|
-
properties=None, **kwargs) -> None:
|
|
56
|
+
def __init__(self, output_mmcif_path, properties=None, **kwargs) -> None:
|
|
48
57
|
properties = properties or {}
|
|
49
58
|
|
|
50
59
|
# Call parent class constructor
|
|
@@ -52,13 +61,11 @@ class Mmcif(BiobbObject):
|
|
|
52
61
|
self.locals_var_dict = locals().copy()
|
|
53
62
|
|
|
54
63
|
# Input/Output files
|
|
55
|
-
self.io_dict = {
|
|
56
|
-
"out": {"output_mmcif_path": output_mmcif_path}
|
|
57
|
-
}
|
|
64
|
+
self.io_dict = {"out": {"output_mmcif_path": output_mmcif_path}}
|
|
58
65
|
|
|
59
66
|
# Properties specific for BB
|
|
60
|
-
self.api_id = properties.get(
|
|
61
|
-
self.pdb_code = properties.get(
|
|
67
|
+
self.api_id = properties.get("api_id", "pdbe")
|
|
68
|
+
self.pdb_code = properties.get("pdb_code", None)
|
|
62
69
|
self.properties = properties
|
|
63
70
|
|
|
64
71
|
# Check the properties
|
|
@@ -66,8 +73,14 @@ class Mmcif(BiobbObject):
|
|
|
66
73
|
self.check_arguments()
|
|
67
74
|
|
|
68
75
|
def check_data_params(self, out_log, err_log):
|
|
69
|
-
"""
|
|
70
|
-
self.output_mmcif_path = check_output_path(
|
|
76
|
+
"""Checks all the input/output paths and parameters"""
|
|
77
|
+
self.output_mmcif_path = check_output_path(
|
|
78
|
+
self.io_dict["out"]["output_mmcif_path"],
|
|
79
|
+
"output_mmcif_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 Mmcif(BiobbObject):
|
|
|
80
93
|
if self.check_restart():
|
|
81
94
|
return 0
|
|
82
95
|
|
|
83
|
-
check_mandatory_property(
|
|
96
|
+
check_mandatory_property(
|
|
97
|
+
self.pdb_code, "pdb_code", self.out_log, self.__class__.__name__
|
|
98
|
+
)
|
|
84
99
|
|
|
85
100
|
self.pdb_code = self.pdb_code.strip().lower()
|
|
86
101
|
|
|
87
102
|
# Downloading PDB file
|
|
88
|
-
mmcif_string = download_mmcif(
|
|
103
|
+
mmcif_string = download_mmcif(
|
|
104
|
+
self.pdb_code, self.api_id, self.out_log, self.global_log
|
|
105
|
+
)
|
|
89
106
|
write_mmcif(mmcif_string, self.output_mmcif_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 Mmcif(BiobbObject):
|
|
|
93
110
|
return 0
|
|
94
111
|
|
|
95
112
|
|
|
96
|
-
def mmcif(output_mmcif_path: str, properties: dict = None, **kwargs) -> int:
|
|
113
|
+
def mmcif(output_mmcif_path: str, properties: Optional[dict] = None, **kwargs) -> int:
|
|
97
114
|
"""Execute the :class:`Mmcif <api.mmcif.Mmcif>` class and
|
|
98
115
|
execute the :meth:`launch() <api.mmcif.Mmcif.launch>` method."""
|
|
99
116
|
|
|
100
|
-
return Mmcif(
|
|
101
|
-
|
|
117
|
+
return Mmcif(
|
|
118
|
+
output_mmcif_path=output_mmcif_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 a MMCIF structure 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_mmcif_path",
|
|
140
|
+
required=True,
|
|
141
|
+
help="Path to the output MMCIF file. Accepted formats: cif, mmcif.",
|
|
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
|
-
mmcif(output_mmcif_path=args.output_mmcif_path,
|
|
119
|
-
properties=properties)
|
|
149
|
+
mmcif(output_mmcif_path=args.output_mmcif_path, properties=properties)
|
|
120
150
|
|
|
121
151
|
|
|
122
|
-
if __name__ ==
|
|
152
|
+
if __name__ == "__main__":
|
|
123
153
|
main()
|
biobb_io/api/pdb.py
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
|
|
3
3
|
"""Module containing the Pdb 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_pdb,
|
|
16
|
+
write_pdb,
|
|
17
|
+
)
|
|
9
18
|
|
|
10
19
|
|
|
11
20
|
class Pdb(BiobbObject):
|
|
@@ -22,6 +31,7 @@ class Pdb(BiobbObject):
|
|
|
22
31
|
* **api_id** (*str*) - ("pdbe") 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>`_), pdb (`RCSB PDB REST API <https://data.rcsb.org/>`_), mmb (`MMB PDB mirror API <http://mmb.irbbarcelona.org/api/>`_).
|
|
23
32
|
* **remove_tmp** (*bool*) - (True) [WF property] Remove temporal files.
|
|
24
33
|
* **restart** (*bool*) - (False) [WF property] Do not execute if output files exist.
|
|
34
|
+
* **sandbox_path** (*str*) - ("./") [WF property] Parent path to the sandbox directory.
|
|
25
35
|
|
|
26
36
|
Examples:
|
|
27
37
|
This is a use example of how to use the building block from Python::
|
|
@@ -45,8 +55,7 @@ class Pdb(BiobbObject):
|
|
|
45
55
|
|
|
46
56
|
"""
|
|
47
57
|
|
|
48
|
-
def __init__(self, output_pdb_path,
|
|
49
|
-
properties=None, **kwargs) -> None:
|
|
58
|
+
def __init__(self, output_pdb_path, properties=None, **kwargs) -> None:
|
|
50
59
|
properties = properties or {}
|
|
51
60
|
|
|
52
61
|
# Call parent class constructor
|
|
@@ -54,14 +63,12 @@ class Pdb(BiobbObject):
|
|
|
54
63
|
self.locals_var_dict = locals().copy()
|
|
55
64
|
|
|
56
65
|
# Input/Output files
|
|
57
|
-
self.io_dict = {
|
|
58
|
-
"out": {"output_pdb_path": output_pdb_path}
|
|
59
|
-
}
|
|
66
|
+
self.io_dict = {"out": {"output_pdb_path": output_pdb_path}}
|
|
60
67
|
|
|
61
68
|
# Properties specific for BB
|
|
62
|
-
self.api_id = properties.get(
|
|
63
|
-
self.pdb_code = properties.get(
|
|
64
|
-
self.filter = properties.get(
|
|
69
|
+
self.api_id = properties.get("api_id", "pdbe")
|
|
70
|
+
self.pdb_code = properties.get("pdb_code", None)
|
|
71
|
+
self.filter = properties.get("filter", ["ATOM", "MODEL", "ENDMDL"])
|
|
65
72
|
self.properties = properties
|
|
66
73
|
|
|
67
74
|
# Check the properties
|
|
@@ -69,8 +76,14 @@ class Pdb(BiobbObject):
|
|
|
69
76
|
self.check_arguments()
|
|
70
77
|
|
|
71
78
|
def check_data_params(self, out_log, err_log):
|
|
72
|
-
"""
|
|
73
|
-
self.output_pdb_path = check_output_path(
|
|
79
|
+
"""Checks all the input/output paths and parameters"""
|
|
80
|
+
self.output_pdb_path = check_output_path(
|
|
81
|
+
self.io_dict["out"]["output_pdb_path"],
|
|
82
|
+
"output_pdb_path",
|
|
83
|
+
False,
|
|
84
|
+
out_log,
|
|
85
|
+
self.__class__.__name__,
|
|
86
|
+
)
|
|
74
87
|
|
|
75
88
|
@launchlogger
|
|
76
89
|
def launch(self) -> int:
|
|
@@ -83,44 +96,63 @@ class Pdb(BiobbObject):
|
|
|
83
96
|
if self.check_restart():
|
|
84
97
|
return 0
|
|
85
98
|
|
|
86
|
-
check_mandatory_property(
|
|
99
|
+
check_mandatory_property(
|
|
100
|
+
self.pdb_code, "pdb_code", self.out_log, self.__class__.__name__
|
|
101
|
+
)
|
|
87
102
|
|
|
88
103
|
self.pdb_code = self.pdb_code.strip().lower()
|
|
89
104
|
|
|
90
105
|
# Downloading PDB file
|
|
91
|
-
pdb_string = download_pdb(
|
|
92
|
-
|
|
106
|
+
pdb_string = download_pdb(
|
|
107
|
+
self.pdb_code, self.api_id, self.out_log, self.global_log
|
|
108
|
+
)
|
|
109
|
+
write_pdb(
|
|
110
|
+
pdb_string, self.output_pdb_path, self.filter, self.out_log, self.global_log
|
|
111
|
+
)
|
|
93
112
|
|
|
94
113
|
self.check_arguments(output_files_created=True, raise_exception=False)
|
|
95
114
|
|
|
96
115
|
return 0
|
|
97
116
|
|
|
98
117
|
|
|
99
|
-
def pdb(output_pdb_path: str, properties: dict = None, **kwargs) -> int:
|
|
118
|
+
def pdb(output_pdb_path: str, properties: Optional[dict] = None, **kwargs) -> int:
|
|
100
119
|
"""Execute the :class:`Pdb <api.pdb.Pdb>` class and
|
|
101
120
|
execute the :meth:`launch() <api.pdb.Pdb.launch>` method."""
|
|
102
121
|
|
|
103
|
-
return Pdb(
|
|
104
|
-
|
|
122
|
+
return Pdb(
|
|
123
|
+
output_pdb_path=output_pdb_path, properties=properties, **kwargs
|
|
124
|
+
).launch()
|
|
105
125
|
|
|
106
126
|
|
|
107
127
|
def main():
|
|
108
128
|
"""Command line execution of this building block. Please check the command line documentation."""
|
|
109
|
-
parser = argparse.ArgumentParser(
|
|
110
|
-
|
|
129
|
+
parser = argparse.ArgumentParser(
|
|
130
|
+
description="This class is a wrapper for downloading a PDB structure from the Protein Data Bank.",
|
|
131
|
+
formatter_class=lambda prog: argparse.RawTextHelpFormatter(prog, width=99999),
|
|
132
|
+
)
|
|
133
|
+
parser.add_argument(
|
|
134
|
+
"-c",
|
|
135
|
+
"--config",
|
|
136
|
+
required=False,
|
|
137
|
+
help="This file can be a YAML file, JSON file or JSON string",
|
|
138
|
+
)
|
|
111
139
|
|
|
112
140
|
# Specific args of each building block
|
|
113
|
-
required_args = parser.add_argument_group(
|
|
114
|
-
required_args.add_argument(
|
|
141
|
+
required_args = parser.add_argument_group("required arguments")
|
|
142
|
+
required_args.add_argument(
|
|
143
|
+
"-o",
|
|
144
|
+
"--output_pdb_path",
|
|
145
|
+
required=True,
|
|
146
|
+
help="Path to the output PDB file. Accepted formats: pdb.",
|
|
147
|
+
)
|
|
115
148
|
|
|
116
149
|
args = parser.parse_args()
|
|
117
150
|
config = args.config if args.config else None
|
|
118
151
|
properties = settings.ConfReader(config=config).get_prop_dic()
|
|
119
152
|
|
|
120
153
|
# Specific call of each building block
|
|
121
|
-
pdb(output_pdb_path=args.output_pdb_path,
|
|
122
|
-
properties=properties)
|
|
154
|
+
pdb(output_pdb_path=args.output_pdb_path, properties=properties)
|
|
123
155
|
|
|
124
156
|
|
|
125
|
-
if __name__ ==
|
|
157
|
+
if __name__ == "__main__":
|
|
126
158
|
main()
|
biobb_io/api/pdb_cluster_zip.py
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
|
|
3
3
|
"""PdbClusterZip Module"""
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
import argparse
|
|
6
|
-
|
|
6
|
+
import os
|
|
7
|
+
from typing import Optional
|
|
8
|
+
|
|
7
9
|
from biobb_common.configuration import settings
|
|
10
|
+
from biobb_common.generic.biobb_object import BiobbObject
|
|
8
11
|
from biobb_common.tools import file_utils as fu
|
|
9
12
|
from biobb_common.tools.file_utils import launchlogger
|
|
10
|
-
|
|
13
|
+
|
|
14
|
+
from biobb_io.api.common import (
|
|
15
|
+
check_mandatory_property,
|
|
16
|
+
check_output_path,
|
|
17
|
+
download_pdb,
|
|
18
|
+
get_cluster_pdb_codes,
|
|
19
|
+
write_pdb,
|
|
20
|
+
)
|
|
11
21
|
|
|
12
22
|
|
|
13
23
|
class PdbClusterZip(BiobbObject):
|
|
@@ -25,6 +35,7 @@ class PdbClusterZip(BiobbObject):
|
|
|
25
35
|
* **api_id** (*str*) - ("pdbe") 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>`_), pdb (`RCSB PDB REST API <https://data.rcsb.org/>`_), mmb (`MMB PDB mirror API <http://mmb.irbbarcelona.org/api/>`_).
|
|
26
36
|
* **remove_tmp** (*bool*) - (True) [WF property] Remove temporal files.
|
|
27
37
|
* **restart** (*bool*) - (False) [WF property] Do not execute if output files exist.
|
|
38
|
+
* **sandbox_path** (*str*) - ("./") [WF property] Parent path to the sandbox directory.
|
|
28
39
|
|
|
29
40
|
Examples:
|
|
30
41
|
This is a use example of how to use the building block from Python::
|
|
@@ -49,8 +60,7 @@ class PdbClusterZip(BiobbObject):
|
|
|
49
60
|
|
|
50
61
|
"""
|
|
51
62
|
|
|
52
|
-
def __init__(self, output_pdb_zip_path,
|
|
53
|
-
properties=None, **kwargs) -> None:
|
|
63
|
+
def __init__(self, output_pdb_zip_path, properties=None, **kwargs) -> None:
|
|
54
64
|
properties = properties or {}
|
|
55
65
|
|
|
56
66
|
# Call parent class constructor
|
|
@@ -58,15 +68,13 @@ class PdbClusterZip(BiobbObject):
|
|
|
58
68
|
self.locals_var_dict = locals().copy()
|
|
59
69
|
|
|
60
70
|
# Input/Output files
|
|
61
|
-
self.io_dict = {
|
|
62
|
-
"out": {"output_pdb_zip_path": output_pdb_zip_path}
|
|
63
|
-
}
|
|
71
|
+
self.io_dict = {"out": {"output_pdb_zip_path": output_pdb_zip_path}}
|
|
64
72
|
|
|
65
73
|
# Properties specific for BB
|
|
66
|
-
self.api_id = properties.get(
|
|
67
|
-
self.pdb_code = properties.get(
|
|
68
|
-
self.filter = properties.get(
|
|
69
|
-
self.cluster = properties.get(
|
|
74
|
+
self.api_id = properties.get("api_id", "pdbe")
|
|
75
|
+
self.pdb_code = properties.get("pdb_code", None)
|
|
76
|
+
self.filter = properties.get("filter", ["ATOM", "MODEL", "ENDMDL"])
|
|
77
|
+
self.cluster = properties.get("cluster", 90)
|
|
70
78
|
self.properties = properties
|
|
71
79
|
|
|
72
80
|
# Check the properties
|
|
@@ -74,8 +82,14 @@ class PdbClusterZip(BiobbObject):
|
|
|
74
82
|
self.check_arguments()
|
|
75
83
|
|
|
76
84
|
def check_data_params(self, out_log, err_log):
|
|
77
|
-
"""
|
|
78
|
-
self.output_pdb_zip_path = check_output_path(
|
|
85
|
+
"""Checks all the input/output paths and parameters"""
|
|
86
|
+
self.output_pdb_zip_path = check_output_path(
|
|
87
|
+
self.io_dict["out"]["output_pdb_zip_path"],
|
|
88
|
+
"output_pdb_zip_path",
|
|
89
|
+
False,
|
|
90
|
+
out_log,
|
|
91
|
+
self.__class__.__name__,
|
|
92
|
+
)
|
|
79
93
|
|
|
80
94
|
@launchlogger
|
|
81
95
|
def launch(self) -> int:
|
|
@@ -88,17 +102,29 @@ class PdbClusterZip(BiobbObject):
|
|
|
88
102
|
if self.check_restart():
|
|
89
103
|
return 0
|
|
90
104
|
|
|
91
|
-
check_mandatory_property(
|
|
105
|
+
check_mandatory_property(
|
|
106
|
+
self.pdb_code, "pdb_code", self.out_log, self.__class__.__name__
|
|
107
|
+
)
|
|
92
108
|
|
|
93
109
|
self.pdb_code = self.pdb_code.strip().lower()
|
|
94
110
|
|
|
95
111
|
file_list = []
|
|
96
112
|
# Downloading PDB_files
|
|
97
|
-
pdb_code_list = get_cluster_pdb_codes(
|
|
113
|
+
pdb_code_list = get_cluster_pdb_codes(
|
|
114
|
+
pdb_code=self.pdb_code,
|
|
115
|
+
cluster=self.cluster,
|
|
116
|
+
out_log=self.out_log,
|
|
117
|
+
global_log=self.global_log,
|
|
118
|
+
)
|
|
98
119
|
unique_dir = fu.create_unique_dir()
|
|
99
120
|
for pdb_code in pdb_code_list:
|
|
100
|
-
pdb_file = os.path.join(unique_dir, pdb_code+".pdb")
|
|
101
|
-
pdb_string = download_pdb(
|
|
121
|
+
pdb_file = os.path.join(unique_dir, pdb_code + ".pdb")
|
|
122
|
+
pdb_string = download_pdb(
|
|
123
|
+
pdb_code=pdb_code,
|
|
124
|
+
api_id=self.api_id,
|
|
125
|
+
out_log=self.out_log,
|
|
126
|
+
global_log=self.global_log,
|
|
127
|
+
)
|
|
102
128
|
write_pdb(pdb_string, pdb_file, self.filter, self.out_log, self.global_log)
|
|
103
129
|
file_list.append(os.path.abspath(pdb_file))
|
|
104
130
|
|
|
@@ -106,10 +132,7 @@ class PdbClusterZip(BiobbObject):
|
|
|
106
132
|
fu.log("Zipping the pdb files to: %s" % self.output_pdb_zip_path)
|
|
107
133
|
fu.zip_list(self.output_pdb_zip_path, file_list, out_log=self.out_log)
|
|
108
134
|
|
|
109
|
-
self.tmp_files.extend([
|
|
110
|
-
self.stage_io_dict.get("unique_dir"),
|
|
111
|
-
unique_dir
|
|
112
|
-
])
|
|
135
|
+
self.tmp_files.extend([self.stage_io_dict.get("unique_dir", ""), unique_dir])
|
|
113
136
|
self.remove_tmp_files()
|
|
114
137
|
|
|
115
138
|
self.check_arguments(output_files_created=True, raise_exception=False)
|
|
@@ -117,31 +140,46 @@ class PdbClusterZip(BiobbObject):
|
|
|
117
140
|
return 0
|
|
118
141
|
|
|
119
142
|
|
|
120
|
-
def pdb_cluster_zip(
|
|
143
|
+
def pdb_cluster_zip(
|
|
144
|
+
output_pdb_zip_path: str, properties: Optional[dict] = None, **kwargs
|
|
145
|
+
) -> int:
|
|
121
146
|
"""Execute the :class:`PdbClusterZip <api.pdb_cluster_zip.PdbClusterZip>` class and
|
|
122
147
|
execute the :meth:`launch() <api.pdb_cluster_zip.PdbClusterZip.launch>` method."""
|
|
123
148
|
|
|
124
|
-
return PdbClusterZip(
|
|
125
|
-
|
|
149
|
+
return PdbClusterZip(
|
|
150
|
+
output_pdb_zip_path=output_pdb_zip_path, properties=properties, **kwargs
|
|
151
|
+
).launch()
|
|
126
152
|
|
|
127
153
|
|
|
128
154
|
def main():
|
|
129
155
|
"""Command line execution of this building block. Please check the command line documentation."""
|
|
130
|
-
parser = argparse.ArgumentParser(
|
|
131
|
-
|
|
156
|
+
parser = argparse.ArgumentParser(
|
|
157
|
+
description="Wrapper for the Protein Data Bank in Europe (https://www.ebi.ac.uk/pdbe/), the Protein Data Bank (https://www.rcsb.org/) and the MMB PDB mirror (http://mmb.irbbarcelona.org/api/) for downloading a PDB cluster.",
|
|
158
|
+
formatter_class=lambda prog: argparse.RawTextHelpFormatter(prog, width=99999),
|
|
159
|
+
)
|
|
160
|
+
parser.add_argument(
|
|
161
|
+
"-c",
|
|
162
|
+
"--config",
|
|
163
|
+
required=False,
|
|
164
|
+
help="This file can be a YAML file, JSON file or JSON string",
|
|
165
|
+
)
|
|
132
166
|
|
|
133
167
|
# Specific args of each building block
|
|
134
|
-
required_args = parser.add_argument_group(
|
|
135
|
-
required_args.add_argument(
|
|
168
|
+
required_args = parser.add_argument_group("required arguments")
|
|
169
|
+
required_args.add_argument(
|
|
170
|
+
"-o",
|
|
171
|
+
"--output_pdb_zip_path",
|
|
172
|
+
required=True,
|
|
173
|
+
help="Path to the ZIP or PDB file containing the output PDB files. Accepted formats: pdb, zip.",
|
|
174
|
+
)
|
|
136
175
|
|
|
137
176
|
args = parser.parse_args()
|
|
138
177
|
config = args.config if args.config else None
|
|
139
178
|
properties = settings.ConfReader(config=config).get_prop_dic()
|
|
140
179
|
|
|
141
180
|
# Specific call of each building block
|
|
142
|
-
pdb_cluster_zip(output_pdb_zip_path=args.output_pdb_zip_path,
|
|
143
|
-
properties=properties)
|
|
181
|
+
pdb_cluster_zip(output_pdb_zip_path=args.output_pdb_zip_path, properties=properties)
|
|
144
182
|
|
|
145
183
|
|
|
146
|
-
if __name__ ==
|
|
184
|
+
if __name__ == "__main__":
|
|
147
185
|
main()
|