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/pdb_variants.py
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
|
|
3
3
|
"""PdbVariants Module"""
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
import argparse
|
|
6
|
+
import re
|
|
7
|
+
from typing import Optional
|
|
8
|
+
|
|
6
9
|
import requests
|
|
7
|
-
from biobb_common.generic.biobb_object import BiobbObject
|
|
8
10
|
from biobb_common.configuration import settings
|
|
11
|
+
from biobb_common.generic.biobb_object import BiobbObject
|
|
9
12
|
from biobb_common.tools import file_utils as fu
|
|
10
13
|
from biobb_common.tools.file_utils import launchlogger
|
|
11
|
-
|
|
14
|
+
|
|
15
|
+
from biobb_io.api.common import (
|
|
16
|
+
check_mandatory_property,
|
|
17
|
+
check_output_path,
|
|
18
|
+
get_uniprot,
|
|
19
|
+
get_variants,
|
|
20
|
+
)
|
|
12
21
|
|
|
13
22
|
|
|
14
23
|
class PdbVariants(BiobbObject):
|
|
@@ -23,6 +32,7 @@ class PdbVariants(BiobbObject):
|
|
|
23
32
|
* **pdb_code** (*str*) - (None) RSCB PDB four letter code.
|
|
24
33
|
* **remove_tmp** (*bool*) - (True) [WF property] Remove temporal files.
|
|
25
34
|
* **restart** (*bool*) - (False) [WF property] Do not execute if output files exist.
|
|
35
|
+
* **sandbox_path** (*str*) - ("./") [WF property] Parent path to the sandbox directory.
|
|
26
36
|
|
|
27
37
|
Examples:
|
|
28
38
|
This is a use example of how to use the PdbVariants module from Python
|
|
@@ -31,7 +41,7 @@ class PdbVariants(BiobbObject):
|
|
|
31
41
|
prop = {
|
|
32
42
|
'pdb_code': '2VGB'
|
|
33
43
|
}
|
|
34
|
-
pdb_variants(output_mutations_list_txt='/path/to/
|
|
44
|
+
pdb_variants(output_mutations_list_txt='/path/to/newMutationslist.txt',
|
|
35
45
|
properties=prop)
|
|
36
46
|
|
|
37
47
|
Info:
|
|
@@ -44,8 +54,7 @@ class PdbVariants(BiobbObject):
|
|
|
44
54
|
|
|
45
55
|
"""
|
|
46
56
|
|
|
47
|
-
def __init__(self, output_mutations_list_txt,
|
|
48
|
-
properties=None, **kwargs) -> None:
|
|
57
|
+
def __init__(self, output_mutations_list_txt, properties=None, **kwargs) -> None:
|
|
49
58
|
properties = properties or {}
|
|
50
59
|
|
|
51
60
|
# Call parent class constructor
|
|
@@ -53,12 +62,10 @@ class PdbVariants(BiobbObject):
|
|
|
53
62
|
self.locals_var_dict = locals().copy()
|
|
54
63
|
|
|
55
64
|
# Input/Output files
|
|
56
|
-
self.io_dict = {
|
|
57
|
-
"out": {"output_mutations_list_txt": output_mutations_list_txt}
|
|
58
|
-
}
|
|
65
|
+
self.io_dict = {"out": {"output_mutations_list_txt": output_mutations_list_txt}}
|
|
59
66
|
|
|
60
67
|
# Properties specific for BB
|
|
61
|
-
self.pdb_code = properties.get(
|
|
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 PdbVariants(BiobbObject):
|
|
|
66
73
|
self.check_arguments()
|
|
67
74
|
|
|
68
75
|
def check_data_params(self, out_log, err_log):
|
|
69
|
-
"""
|
|
70
|
-
self.output_mutations_list_txt = check_output_path(
|
|
76
|
+
"""Checks all the input/output paths and parameters"""
|
|
77
|
+
self.output_mutations_list_txt = check_output_path(
|
|
78
|
+
self.io_dict["out"]["output_mutations_list_txt"],
|
|
79
|
+
"output_mutations_list_txt",
|
|
80
|
+
False,
|
|
81
|
+
out_log,
|
|
82
|
+
self.__class__.__name__,
|
|
83
|
+
)
|
|
71
84
|
|
|
72
85
|
@launchlogger
|
|
73
86
|
def launch(self) -> int:
|
|
@@ -80,36 +93,72 @@ class PdbVariants(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
|
-
url =
|
|
102
|
+
url = "http://mmb.irbbarcelona.org/api"
|
|
88
103
|
uniprot_id = get_uniprot(self.pdb_code, url, self.out_log, self.global_log)
|
|
89
|
-
url_mapPDBRes = (
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
104
|
+
url_mapPDBRes = (
|
|
105
|
+
url + "/uniprot/" + uniprot_id + "/mapPDBRes?pdbId=" + self.pdb_code
|
|
106
|
+
)
|
|
107
|
+
pattern = re.compile(
|
|
108
|
+
(r"p.(?P<wt>[a-zA-Z]{3})(?P<resnum>\d+)(?P<mt>[a-zA-Z]{3})")
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
fu.log(
|
|
112
|
+
"Fetching variants for uniprot_id: %s and pdb_code: %s"
|
|
113
|
+
% (uniprot_id, self.pdb_code),
|
|
114
|
+
self.out_log,
|
|
115
|
+
self.global_log,
|
|
116
|
+
)
|
|
117
|
+
unfiltered_dic = requests.get(url_mapPDBRes, verify=True).json()
|
|
94
118
|
if not unfiltered_dic:
|
|
95
119
|
fu.log("No mutation found", self.out_log, self.global_log)
|
|
96
|
-
return
|
|
120
|
+
return 1
|
|
97
121
|
|
|
98
|
-
mapdic = requests.get(url_mapPDBRes, verify=
|
|
122
|
+
mapdic = requests.get(url_mapPDBRes, verify=True).json()
|
|
99
123
|
mutations = []
|
|
100
124
|
uniprot_var_list = get_variants(uniprot_id, url, self.out_log, self.global_log)
|
|
101
125
|
for var in uniprot_var_list:
|
|
102
|
-
|
|
126
|
+
match = pattern.match(var)
|
|
127
|
+
if match:
|
|
128
|
+
uni_mut = match.groupdict()
|
|
129
|
+
else:
|
|
130
|
+
continue
|
|
103
131
|
for k in mapdic.keys():
|
|
104
132
|
for fragment in mapdic[k]:
|
|
105
|
-
if
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
133
|
+
if (
|
|
134
|
+
int(fragment["unp_start"])
|
|
135
|
+
<= int(uni_mut["resnum"])
|
|
136
|
+
<= int(fragment["unp_end"])
|
|
137
|
+
):
|
|
138
|
+
resnum = (
|
|
139
|
+
int(uni_mut["resnum"])
|
|
140
|
+
+ int(fragment["pdb_start"])
|
|
141
|
+
- int(fragment["unp_start"])
|
|
142
|
+
)
|
|
143
|
+
mutations.append(
|
|
144
|
+
k[-1] + "." + uni_mut["wt"] + str(resnum) + uni_mut["mt"]
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
fu.log(
|
|
148
|
+
"Found %d mutations mapped to PDB: %s" % (len(mutations), self.pdb_code),
|
|
149
|
+
self.out_log,
|
|
150
|
+
self.global_log,
|
|
151
|
+
)
|
|
152
|
+
fu.log(
|
|
153
|
+
"Writting mutations to: %s" % self.output_mutations_list_txt,
|
|
154
|
+
self.out_log,
|
|
155
|
+
self.global_log,
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
if not self.output_mutations_list_txt:
|
|
159
|
+
raise ValueError("Output mutations list file path is not specified.")
|
|
160
|
+
|
|
161
|
+
with open(self.output_mutations_list_txt, "w") as mut_file:
|
|
113
162
|
mutations.sort()
|
|
114
163
|
mut_file.write(",".join(mutations))
|
|
115
164
|
|
|
@@ -118,31 +167,50 @@ class PdbVariants(BiobbObject):
|
|
|
118
167
|
return 0
|
|
119
168
|
|
|
120
169
|
|
|
121
|
-
def pdb_variants(
|
|
170
|
+
def pdb_variants(
|
|
171
|
+
output_mutations_list_txt: str, properties: Optional[dict] = None, **kwargs
|
|
172
|
+
) -> int:
|
|
122
173
|
"""Execute the :class:`PdbVariants <api.pdb_variants.PdbVariants>` class and
|
|
123
174
|
execute the :meth:`launch() <api.pdb_variants.PdbVariants.launch>` method."""
|
|
124
175
|
|
|
125
|
-
return PdbVariants(
|
|
126
|
-
|
|
176
|
+
return PdbVariants(
|
|
177
|
+
output_mutations_list_txt=output_mutations_list_txt,
|
|
178
|
+
properties=properties,
|
|
179
|
+
**kwargs,
|
|
180
|
+
).launch()
|
|
127
181
|
|
|
128
182
|
|
|
129
183
|
def main():
|
|
130
184
|
"""Command line execution of this building block. Please check the command line documentation."""
|
|
131
|
-
parser = argparse.ArgumentParser(
|
|
132
|
-
|
|
185
|
+
parser = argparse.ArgumentParser(
|
|
186
|
+
description="Wrapper for the UNIPROT (http://www.uniprot.org/) mirror of the MMB group REST API (http://mmb.irbbarcelona.org/api/) for creating a list of all the variants mapped to a PDB code from the corresponding UNIPROT entries.",
|
|
187
|
+
formatter_class=lambda prog: argparse.RawTextHelpFormatter(prog, width=99999),
|
|
188
|
+
)
|
|
189
|
+
parser.add_argument(
|
|
190
|
+
"-c",
|
|
191
|
+
"--config",
|
|
192
|
+
required=False,
|
|
193
|
+
help="This file can be a YAML file, JSON file or JSON string",
|
|
194
|
+
)
|
|
133
195
|
|
|
134
196
|
# Specific args of each building block
|
|
135
|
-
required_args = parser.add_argument_group(
|
|
136
|
-
required_args.add_argument(
|
|
197
|
+
required_args = parser.add_argument_group("required arguments")
|
|
198
|
+
required_args.add_argument(
|
|
199
|
+
"-o",
|
|
200
|
+
"--output_mutations_list_txt",
|
|
201
|
+
required=True,
|
|
202
|
+
help="Path to the TXT file containing an ASCII comma separated values of the mutations. Accepted formats: txt.",
|
|
203
|
+
)
|
|
137
204
|
|
|
138
205
|
args = parser.parse_args()
|
|
139
206
|
config = args.config if args.config else None
|
|
140
207
|
properties = settings.ConfReader(config=config).get_prop_dic()
|
|
141
208
|
|
|
142
209
|
# Specific call of each building block
|
|
143
|
-
pdb_variants(
|
|
144
|
-
|
|
210
|
+
pdb_variants(
|
|
211
|
+
output_mutations_list_txt=args.output_mutations_list_txt, properties=properties
|
|
212
|
+
)
|
|
145
213
|
|
|
146
214
|
|
|
147
|
-
if __name__ ==
|
|
215
|
+
if __name__ == "__main__":
|
|
148
216
|
main()
|
biobb_io/api/structure_info.py
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
|
|
3
3
|
"""Module containing the StructureInfo 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_str_info,
|
|
16
|
+
write_json,
|
|
17
|
+
)
|
|
9
18
|
|
|
10
19
|
|
|
11
20
|
class StructureInfo(BiobbObject):
|
|
@@ -20,6 +29,7 @@ class StructureInfo(BiobbObject):
|
|
|
20
29
|
* **pdb_code** (*str*) - (None) RSCB PDB structure code.
|
|
21
30
|
* **remove_tmp** (*bool*) - (True) [WF property] Remove temporal files.
|
|
22
31
|
* **restart** (*bool*) - (False) [WF property] Do not execute if output files exist.
|
|
32
|
+
* **sandbox_path** (*str*) - ("./") [WF property] Parent path to the sandbox directory.
|
|
23
33
|
|
|
24
34
|
Examples:
|
|
25
35
|
This is a use example of how to use the building block from Python::
|
|
@@ -41,8 +51,7 @@ class StructureInfo(BiobbObject):
|
|
|
41
51
|
|
|
42
52
|
"""
|
|
43
53
|
|
|
44
|
-
def __init__(self, output_json_path,
|
|
45
|
-
properties=None, **kwargs) -> None:
|
|
54
|
+
def __init__(self, output_json_path, properties=None, **kwargs) -> None:
|
|
46
55
|
properties = properties or {}
|
|
47
56
|
|
|
48
57
|
# Call parent class constructor
|
|
@@ -50,12 +59,10 @@ class StructureInfo(BiobbObject):
|
|
|
50
59
|
self.locals_var_dict = locals().copy()
|
|
51
60
|
|
|
52
61
|
# Input/Output files
|
|
53
|
-
self.io_dict = {
|
|
54
|
-
"out": {"output_json_path": output_json_path}
|
|
55
|
-
}
|
|
62
|
+
self.io_dict = {"out": {"output_json_path": output_json_path}}
|
|
56
63
|
|
|
57
64
|
# Properties specific for BB
|
|
58
|
-
self.pdb_code = properties.get(
|
|
65
|
+
self.pdb_code = properties.get("pdb_code", None)
|
|
59
66
|
self.properties = properties
|
|
60
67
|
|
|
61
68
|
# Check the properties
|
|
@@ -63,8 +70,14 @@ class StructureInfo(BiobbObject):
|
|
|
63
70
|
self.check_arguments()
|
|
64
71
|
|
|
65
72
|
def check_data_params(self, out_log, err_log):
|
|
66
|
-
"""
|
|
67
|
-
self.output_json_path = check_output_path(
|
|
73
|
+
"""Checks all the input/output paths and parameters"""
|
|
74
|
+
self.output_json_path = check_output_path(
|
|
75
|
+
self.io_dict["out"]["output_json_path"],
|
|
76
|
+
"output_json_path",
|
|
77
|
+
False,
|
|
78
|
+
out_log,
|
|
79
|
+
self.__class__.__name__,
|
|
80
|
+
)
|
|
68
81
|
|
|
69
82
|
@launchlogger
|
|
70
83
|
def launch(self) -> int:
|
|
@@ -77,13 +90,17 @@ class StructureInfo(BiobbObject):
|
|
|
77
90
|
if self.check_restart():
|
|
78
91
|
return 0
|
|
79
92
|
|
|
80
|
-
check_mandatory_property(
|
|
93
|
+
check_mandatory_property(
|
|
94
|
+
self.pdb_code, "pdb_code", self.out_log, self.__class__.__name__
|
|
95
|
+
)
|
|
81
96
|
|
|
82
97
|
self.pdb_code = self.pdb_code.strip().lower()
|
|
83
98
|
url = "http://mmb.irbbarcelona.org/api/pdb/%s.json"
|
|
84
99
|
|
|
85
100
|
# Downloading PDB file
|
|
86
|
-
json_string = download_str_info(
|
|
101
|
+
json_string = download_str_info(
|
|
102
|
+
self.pdb_code, url, self.out_log, self.global_log
|
|
103
|
+
)
|
|
87
104
|
write_json(json_string, self.output_json_path, self.out_log, self.global_log)
|
|
88
105
|
|
|
89
106
|
self.check_arguments(output_files_created=True, raise_exception=False)
|
|
@@ -91,31 +108,46 @@ class StructureInfo(BiobbObject):
|
|
|
91
108
|
return 0
|
|
92
109
|
|
|
93
110
|
|
|
94
|
-
def structure_info(
|
|
111
|
+
def structure_info(
|
|
112
|
+
output_json_path: str, properties: Optional[dict] = None, **kwargs
|
|
113
|
+
) -> int:
|
|
95
114
|
"""Execute the :class:`StructureInfo <api.structure_info.StructureInfo>` class and
|
|
96
115
|
execute the :meth:`launch() <api.structure_info.StructureInfo.launch>` method."""
|
|
97
116
|
|
|
98
|
-
return StructureInfo(
|
|
99
|
-
|
|
117
|
+
return StructureInfo(
|
|
118
|
+
output_json_path=output_json_path, properties=properties, **kwargs
|
|
119
|
+
).launch()
|
|
100
120
|
|
|
101
121
|
|
|
102
122
|
def main():
|
|
103
123
|
"""Command line execution of this building block. Please check the command line documentation."""
|
|
104
|
-
parser = argparse.ArgumentParser(
|
|
105
|
-
|
|
124
|
+
parser = argparse.ArgumentParser(
|
|
125
|
+
description="This class is a wrapper for getting all the available information of a 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
|
+
)
|
|
106
134
|
|
|
107
135
|
# Specific args of each building block
|
|
108
|
-
required_args = parser.add_argument_group(
|
|
109
|
-
required_args.add_argument(
|
|
136
|
+
required_args = parser.add_argument_group("required arguments")
|
|
137
|
+
required_args.add_argument(
|
|
138
|
+
"-o",
|
|
139
|
+
"--output_json_path",
|
|
140
|
+
required=True,
|
|
141
|
+
help="Path to the output JSON file with all the structure information. Accepted formats: json.",
|
|
142
|
+
)
|
|
110
143
|
|
|
111
144
|
args = parser.parse_args()
|
|
112
145
|
config = args.config if args.config else None
|
|
113
146
|
properties = settings.ConfReader(config=config).get_prop_dic()
|
|
114
147
|
|
|
115
148
|
# Specific call of each building block
|
|
116
|
-
structure_info(output_json_path=args.output_json_path,
|
|
117
|
-
properties=properties)
|
|
149
|
+
structure_info(output_json_path=args.output_json_path, properties=properties)
|
|
118
150
|
|
|
119
151
|
|
|
120
|
-
if __name__ ==
|
|
152
|
+
if __name__ == "__main__":
|
|
121
153
|
main()
|
biobb_io/py.typed
ADDED
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
|
-
Name:
|
|
3
|
-
Version:
|
|
2
|
+
Name: biobb_io
|
|
3
|
+
Version: 5.0.1
|
|
4
4
|
Summary: Biobb_io is the Biobb module collection to fetch data to be consumed by the rest of the Biobb building blocks.
|
|
5
5
|
Home-page: https://github.com/bioexcel/biobb_io
|
|
6
6
|
Author: Biobb developers
|
|
@@ -8,24 +8,23 @@ Author-email: pau.andrio@bsc.es
|
|
|
8
8
|
Project-URL: Documentation, http://biobb-io.readthedocs.io/en/latest/
|
|
9
9
|
Project-URL: Bioexcel, https://bioexcel.eu/
|
|
10
10
|
Keywords: Bioinformatics Workflows BioExcel Compatibility
|
|
11
|
-
Classifier: Development Status ::
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
12
|
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
15
13
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
14
|
Classifier: Operating System :: MacOS :: MacOS X
|
|
17
15
|
Classifier: Operating System :: POSIX
|
|
18
|
-
|
|
16
|
+
Classifier: Operating System :: Unix
|
|
17
|
+
Requires-Python: >=3.9
|
|
19
18
|
Description-Content-Type: text/markdown
|
|
20
19
|
License-File: LICENSE
|
|
21
|
-
Requires-Dist: biobb-common
|
|
20
|
+
Requires-Dist: biobb-common==5.0.0
|
|
22
21
|
|
|
23
22
|
[](https://GitHub.com/bioexcel/biobb_io/tags/)
|
|
24
23
|
[](https://pypi.python.org/pypi/biobb-io/)
|
|
25
24
|
[](https://anaconda.org/bioconda/biobb_io)
|
|
26
25
|
[](https://anaconda.org/bioconda/biobb_io)
|
|
27
26
|
[](https://quay.io/repository/biocontainers/biobb_io?tab=tags)
|
|
28
|
-
[](https://depot.galaxyproject.org/singularity/biobb_io:
|
|
27
|
+
[](https://depot.galaxyproject.org/singularity/biobb_io:5.0.1--pyhdfd78af_0)
|
|
29
28
|
|
|
30
29
|
[](https://github.com/bioexcel/biobb_io)
|
|
31
30
|
[](https://pypi.org/project/biobb-io/)
|
|
@@ -34,7 +33,7 @@ Requires-Dist: biobb-common ==4.2.0
|
|
|
34
33
|
|
|
35
34
|
[](https://biobb-io.readthedocs.io/en/latest/?badge=latest)
|
|
36
35
|
[](https://mmb.irbbarcelona.org/biobb/)
|
|
37
|
-
[](https://www.youtube.com/@BioExcelCoE/search?query=biobb)
|
|
38
37
|
[](https://doi.org/10.1038/s41597-019-0177-4)
|
|
39
38
|
[](https://www.nature.com/articles/s41597-019-0177-4#citeas)
|
|
40
39
|
|
|
@@ -63,7 +62,7 @@ The latest documentation of this package can be found in our readthedocs site:
|
|
|
63
62
|
[latest API documentation](http://biobb-io.readthedocs.io/en/latest/).
|
|
64
63
|
|
|
65
64
|
### Version
|
|
66
|
-
|
|
65
|
+
v5.0.1 2024.2
|
|
67
66
|
|
|
68
67
|
### Installation
|
|
69
68
|
Using PIP:
|
|
@@ -72,15 +71,15 @@ Using PIP:
|
|
|
72
71
|
|
|
73
72
|
* Installation:
|
|
74
73
|
|
|
75
|
-
pip install "biobb_io==
|
|
76
|
-
|
|
74
|
+
pip install "biobb_io==5.0.1"
|
|
75
|
+
|
|
77
76
|
* Usage: [Python API documentation](https://biobb-io.readthedocs.io/en/latest/modules.html)
|
|
78
77
|
|
|
79
78
|
Using ANACONDA:
|
|
80
79
|
* Installation:
|
|
81
80
|
|
|
82
81
|
|
|
83
|
-
conda install -c bioconda "biobb_io==
|
|
82
|
+
conda install -c bioconda "biobb_io==5.0.1"
|
|
84
83
|
|
|
85
84
|
|
|
86
85
|
* Usage: With conda installation BioBBs can be used with the [Python API documentation](https://biobb-io.readthedocs.io/en/latest/modules.html) and the [Command Line documentation](https://biobb-io.readthedocs.io/en/latest/command_line.html)
|
|
@@ -89,12 +88,12 @@ Using DOCKER:
|
|
|
89
88
|
* Installation:
|
|
90
89
|
|
|
91
90
|
|
|
92
|
-
docker pull quay.io/biocontainers/biobb_io:
|
|
91
|
+
docker pull quay.io/biocontainers/biobb_io:5.0.1--pyhdfd78af_0
|
|
93
92
|
|
|
94
93
|
* Usage:
|
|
95
94
|
|
|
96
95
|
|
|
97
|
-
docker run quay.io/biocontainers/biobb_io:
|
|
96
|
+
docker run quay.io/biocontainers/biobb_io:5.0.1--pyhdfd78af_0 <command>
|
|
98
97
|
|
|
99
98
|
|
|
100
99
|
The command list and specification can be found at the [Command Line documentation](https://biobb-io.readthedocs.io/en/latest/command_line.html).
|
|
@@ -106,7 +105,7 @@ Using SINGULARITY:
|
|
|
106
105
|
* Installation:
|
|
107
106
|
|
|
108
107
|
|
|
109
|
-
singularity pull --name biobb_io.sif https://depot.galaxyproject.org/singularity/biobb_io:
|
|
108
|
+
singularity pull --name biobb_io.sif https://depot.galaxyproject.org/singularity/biobb_io:5.0.1--pyhdfd78af_0
|
|
110
109
|
|
|
111
110
|
|
|
112
111
|
* Usage:
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
biobb_io/__init__.py,sha256=5fB4i9qgGOZ0ZrZRiZrdxgVxzntL56ErhlDSvnqqnP8,77
|
|
2
|
+
biobb_io/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
biobb_io/api/__init__.py,sha256=fR17sA2mh78x2NoyM25XN3vlsjka4aNubzaP4SvpCDc,538
|
|
4
|
+
biobb_io/api/alphafold.py,sha256=e_5N0yntKTjI-Sd9cM1IGv56FwlD1HqeODXooSLmSBg,5402
|
|
5
|
+
biobb_io/api/api_binding_site.py,sha256=cu6McFh1e75J8JMaZHjnfiK2ljQVOsREsXH3ZvOyUyU,5884
|
|
6
|
+
biobb_io/api/canonical_fasta.py,sha256=DTwvoV8yY_xX_X3E9PbhucNaLk21jJ-K_34db1p9SOU,5785
|
|
7
|
+
biobb_io/api/common.py,sha256=TQD3oSWL-WtXxJHnNp9469Iun-REqFeAb8dmKWU3UJc,13384
|
|
8
|
+
biobb_io/api/ideal_sdf.py,sha256=MxNiFLoQU0tF7k3mztDYHkIpmZ5s9Z0p4BI-NlTW7Dc,5599
|
|
9
|
+
biobb_io/api/ligand.py,sha256=_iFZWxuMPz2c0IOQPpeaBsvjsFcOr0wqtf0c6QICX2M,5654
|
|
10
|
+
biobb_io/api/memprotmd_sim.py,sha256=bnZFaAMkMIYzS75VognyNh0H8F5gZCwQM1ErhLrrtWw,5167
|
|
11
|
+
biobb_io/api/memprotmd_sim_list.py,sha256=zFsaM-d2efmiWPbMEMFEUmKKet9P18O4-7XsMxgh3a4,5099
|
|
12
|
+
biobb_io/api/memprotmd_sim_search.py,sha256=_bTzx552Sn2GiogGojWL5uR8mPNsgJwEUxA9P_jgiKE,7452
|
|
13
|
+
biobb_io/api/mmcif.py,sha256=kntBTLcWpxAubyjtSMEokP7ZyzmTWRyx36zqCEfnVgg,5690
|
|
14
|
+
biobb_io/api/pdb.py,sha256=mpaMklW3N5avUO08W3bB75cPRfPHcRccDB8TaG-xLF8,6024
|
|
15
|
+
biobb_io/api/pdb_cluster_zip.py,sha256=eml2QmX0NTUk8YkEwDPqSPu3ZjTtBqYUVl9r4eWtFzs,7749
|
|
16
|
+
biobb_io/api/pdb_variants.py,sha256=GbovaDIQZQDPiSQaHp1ohr_Ds3eucdkdLR7bcW3c7Q4,7969
|
|
17
|
+
biobb_io/api/structure_info.py,sha256=VKy9lxMTpbkGMuxWoEwP9NLwdw8AapLFutHs8J0qgjA,5503
|
|
18
|
+
biobb_io/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
|
+
biobb_io-5.0.1.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
20
|
+
biobb_io-5.0.1.dist-info/METADATA,sha256=fbV5Ca_iWW37qv4RVIsre4cCvwBx7BPtwUGWduZBsk4,6713
|
|
21
|
+
biobb_io-5.0.1.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
22
|
+
biobb_io-5.0.1.dist-info/entry_points.txt,sha256=UdQz4F28f13ergWXqKMrx15mH05nX7G85xBaP8W2Wdw,614
|
|
23
|
+
biobb_io-5.0.1.dist-info/top_level.txt,sha256=1VPldlX2AnFaqODGFJK10WN8AOQuulpX88bLSaQdoS8,9
|
|
24
|
+
biobb_io-5.0.1.dist-info/RECORD,,
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
alphafold = biobb_io.api.alphafold:main
|
|
3
3
|
api_binding_site = biobb_io.api.api_binding_site:main
|
|
4
4
|
canonical_fasta = biobb_io.api.canonical_fasta:main
|
|
5
|
-
drugbank = biobb_io.api.drugbank:main
|
|
6
5
|
ideal_sdf = biobb_io.api.ideal_sdf:main
|
|
7
6
|
ligand = biobb_io.api.ligand:main
|
|
8
7
|
memprotmd_sim = biobb_io.api.memprotmd_sim:main
|
biobb_io/api/drugbank.py
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
|
|
3
|
-
"""Module containing the Drugbank class and the command line interface."""
|
|
4
|
-
import argparse
|
|
5
|
-
from biobb_common.generic.biobb_object import BiobbObject
|
|
6
|
-
from biobb_common.configuration import settings
|
|
7
|
-
from biobb_common.tools.file_utils import launchlogger
|
|
8
|
-
from biobb_io.api.common import check_output_path, check_mandatory_property, download_drugbank, write_sdf
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class Drugbank(BiobbObject):
|
|
12
|
-
"""
|
|
13
|
-
| biobb_io Drugbank
|
|
14
|
-
| This class is a wrapper for the `Drugbank <https://www.drugbank.ca/>`_ REST API.
|
|
15
|
-
| Download a single component in SDF format from the `Drugbank <https://www.drugbank.ca/>`_ REST API.
|
|
16
|
-
|
|
17
|
-
Args:
|
|
18
|
-
output_sdf_path (str): Path to the output SDF component file. File type: output. `Sample file <https://github.com/bioexcel/biobb_io/raw/master/biobb_io/test/reference/api/output_drugbank.sdf>`_. Accepted formats: sdf (edam:format_3814).
|
|
19
|
-
properties (dic - Python dictionary object containing the tool parameters, not input/output files):
|
|
20
|
-
* **drugbank_id** (*str*) - (None) Drugbank component id.
|
|
21
|
-
* **remove_tmp** (*bool*) - (True) [WF property] Remove temporal files.
|
|
22
|
-
* **restart** (*bool*) - (False) [WF property] Do not execute if output files exist.
|
|
23
|
-
|
|
24
|
-
Examples:
|
|
25
|
-
This is a use example of how to use the building block from Python::
|
|
26
|
-
|
|
27
|
-
from biobb_io.api.drugbank import drugbank
|
|
28
|
-
prop = {
|
|
29
|
-
'drugbank_id': 'DB00530'
|
|
30
|
-
}
|
|
31
|
-
drugbank(output_sdf_path='/path/to/newComponent.sdf',
|
|
32
|
-
properties=prop)
|
|
33
|
-
|
|
34
|
-
Info:
|
|
35
|
-
* wrapped_software:
|
|
36
|
-
* name: Drugbank
|
|
37
|
-
* license: Creative Commons
|
|
38
|
-
* ontology:
|
|
39
|
-
* name: EDAM
|
|
40
|
-
* schema: http://edamontology.org/EDAM.owl
|
|
41
|
-
|
|
42
|
-
"""
|
|
43
|
-
|
|
44
|
-
def __init__(self, output_sdf_path,
|
|
45
|
-
properties=None, **kwargs) -> None:
|
|
46
|
-
properties = properties or {}
|
|
47
|
-
|
|
48
|
-
# Call parent class constructor
|
|
49
|
-
super().__init__(properties)
|
|
50
|
-
self.locals_var_dict = locals().copy()
|
|
51
|
-
|
|
52
|
-
# Input/Output files
|
|
53
|
-
self.io_dict = {
|
|
54
|
-
"out": {"output_sdf_path": output_sdf_path}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
# Properties specific for BB
|
|
58
|
-
self.drugbank_id = properties.get('drugbank_id', None)
|
|
59
|
-
self.properties = properties
|
|
60
|
-
|
|
61
|
-
# Check the properties
|
|
62
|
-
self.check_properties(properties)
|
|
63
|
-
self.check_arguments()
|
|
64
|
-
|
|
65
|
-
def check_data_params(self, out_log, err_log):
|
|
66
|
-
""" Checks all the input/output paths and parameters """
|
|
67
|
-
self.output_sdf_path = check_output_path(self.io_dict["out"]["output_sdf_path"], "output_sdf_path", False, out_log, self.__class__.__name__)
|
|
68
|
-
|
|
69
|
-
@launchlogger
|
|
70
|
-
def launch(self) -> int:
|
|
71
|
-
"""Execute the :class:`Drugbank <api.drugbank.Drugbank>` api.drugbank.Drugbank object."""
|
|
72
|
-
|
|
73
|
-
# check input/output paths and parameters
|
|
74
|
-
self.check_data_params(self.out_log, self.err_log)
|
|
75
|
-
|
|
76
|
-
# Setup Biobb
|
|
77
|
-
if self.check_restart():
|
|
78
|
-
return 0
|
|
79
|
-
|
|
80
|
-
check_mandatory_property(self.drugbank_id, 'drugbank_id', self.out_log, self.__class__.__name__)
|
|
81
|
-
|
|
82
|
-
self.drugbank_id = self.drugbank_id.strip().lower()
|
|
83
|
-
url = "https://www.drugbank.ca/structures/small_molecule_drugs/%s.sdf?type=3d"
|
|
84
|
-
|
|
85
|
-
# Downloading SDF file
|
|
86
|
-
sdf_string = download_drugbank(self.drugbank_id, url, self.out_log, self.global_log)
|
|
87
|
-
write_sdf(sdf_string, self.output_sdf_path, self.out_log, self.global_log)
|
|
88
|
-
|
|
89
|
-
self.check_arguments(output_files_created=True, raise_exception=False)
|
|
90
|
-
|
|
91
|
-
return 0
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
def drugbank(output_sdf_path: str, properties: dict = None, **kwargs) -> int:
|
|
95
|
-
"""Execute the :class:`Drugbank <api.drugbank.Drugbank>` class and
|
|
96
|
-
execute the :meth:`launch() <api.drugbank.Drugbank.launch>` method."""
|
|
97
|
-
|
|
98
|
-
return Drugbank(output_sdf_path=output_sdf_path,
|
|
99
|
-
properties=properties, **kwargs).launch()
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
def main():
|
|
103
|
-
"""Command line execution of this building block. Please check the command line documentation."""
|
|
104
|
-
parser = argparse.ArgumentParser(description="Download a component in SDF format from the Drugbank (https://www.drugbank.ca/).", formatter_class=lambda prog: argparse.RawTextHelpFormatter(prog, width=99999))
|
|
105
|
-
parser.add_argument('-c', '--config', required=False, help="This file can be a YAML file, JSON file or JSON string")
|
|
106
|
-
|
|
107
|
-
# Specific args of each building block
|
|
108
|
-
required_args = parser.add_argument_group('required arguments')
|
|
109
|
-
required_args.add_argument('-o', '--output_sdf_path', required=True, help="Path to the output SDF component file. Accepted formats: sdf.")
|
|
110
|
-
|
|
111
|
-
args = parser.parse_args()
|
|
112
|
-
config = args.config if args.config else None
|
|
113
|
-
properties = settings.ConfReader(config=config).get_prop_dic()
|
|
114
|
-
|
|
115
|
-
# Specific call of each building block
|
|
116
|
-
drugbank(output_sdf_path=args.output_sdf_path,
|
|
117
|
-
properties=properties)
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
if __name__ == '__main__':
|
|
121
|
-
main()
|