biobb-io 4.2.0__tar.gz → 5.0.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.
Files changed (34) hide show
  1. {biobb_io-4.2.0 → biobb_io-5.0.0}/PKG-INFO +14 -15
  2. {biobb_io-4.2.0 → biobb_io-5.0.0}/README.md +9 -9
  3. biobb_io-5.0.0/biobb_io/__init__.py +5 -0
  4. biobb_io-5.0.0/biobb_io/api/__init__.py +34 -0
  5. {biobb_io-4.2.0 → biobb_io-5.0.0}/biobb_io/api/alphafold.py +53 -22
  6. {biobb_io-4.2.0 → biobb_io-5.0.0}/biobb_io/api/api_binding_site.py +59 -23
  7. {biobb_io-4.2.0 → biobb_io-5.0.0}/biobb_io/api/canonical_fasta.py +55 -23
  8. {biobb_io-4.2.0 → biobb_io-5.0.0}/biobb_io/api/common.py +185 -103
  9. {biobb_io-4.2.0 → biobb_io-5.0.0}/biobb_io/api/drugbank.py +52 -22
  10. {biobb_io-4.2.0 → biobb_io-5.0.0}/biobb_io/api/ideal_sdf.py +53 -23
  11. {biobb_io-4.2.0 → biobb_io-5.0.0}/biobb_io/api/ligand.py +53 -23
  12. {biobb_io-4.2.0 → biobb_io-5.0.0}/biobb_io/api/memprotmd_sim.py +53 -22
  13. {biobb_io-4.2.0 → biobb_io-5.0.0}/biobb_io/api/memprotmd_sim_list.py +44 -18
  14. {biobb_io-4.2.0 → biobb_io-5.0.0}/biobb_io/api/memprotmd_sim_search.py +48 -21
  15. {biobb_io-4.2.0 → biobb_io-5.0.0}/biobb_io/api/mmcif.py +53 -23
  16. {biobb_io-4.2.0 → biobb_io-5.0.0}/biobb_io/api/pdb.py +57 -25
  17. {biobb_io-4.2.0 → biobb_io-5.0.0}/biobb_io/api/pdb_cluster_zip.py +70 -32
  18. biobb_io-5.0.0/biobb_io/api/pdb_variants.py +216 -0
  19. {biobb_io-4.2.0 → biobb_io-5.0.0}/biobb_io/api/structure_info.py +54 -22
  20. biobb_io-4.2.0/biobb_io/test/__init__.py → biobb_io-5.0.0/biobb_io/py.typed +0 -0
  21. biobb_io-5.0.0/biobb_io/test/__init__.py +0 -0
  22. {biobb_io-4.2.0 → biobb_io-5.0.0}/biobb_io.egg-info/PKG-INFO +15 -16
  23. {biobb_io-4.2.0 → biobb_io-5.0.0}/biobb_io.egg-info/SOURCES.txt +1 -0
  24. biobb_io-5.0.0/biobb_io.egg-info/requires.txt +1 -0
  25. {biobb_io-4.2.0 → biobb_io-5.0.0}/setup.py +11 -11
  26. biobb_io-4.2.0/biobb_io/__init__.py +0 -3
  27. biobb_io-4.2.0/biobb_io/api/__init__.py +0 -2
  28. biobb_io-4.2.0/biobb_io/api/pdb_variants.py +0 -148
  29. biobb_io-4.2.0/biobb_io.egg-info/requires.txt +0 -1
  30. {biobb_io-4.2.0 → biobb_io-5.0.0}/LICENSE +0 -0
  31. {biobb_io-4.2.0 → biobb_io-5.0.0}/biobb_io.egg-info/dependency_links.txt +0 -0
  32. {biobb_io-4.2.0 → biobb_io-5.0.0}/biobb_io.egg-info/entry_points.txt +0 -0
  33. {biobb_io-4.2.0 → biobb_io-5.0.0}/biobb_io.egg-info/top_level.txt +0 -0
  34. {biobb_io-4.2.0 → biobb_io-5.0.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: biobb_io
3
- Version: 4.2.0
3
+ Version: 5.0.0
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 :: 3 - Alpha
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
- Requires-Python: >=3.8
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==4.2.0
20
+ Requires-Dist: biobb_common==5.0.0
22
21
 
23
22
  [![](https://img.shields.io/github/v/tag/bioexcel/biobb_io?label=Version)](https://GitHub.com/bioexcel/biobb_io/tags/)
24
23
  [![](https://img.shields.io/pypi/v/biobb-io.svg?label=Pypi)](https://pypi.python.org/pypi/biobb-io/)
25
24
  [![](https://img.shields.io/conda/vn/bioconda/biobb_io?label=Conda)](https://anaconda.org/bioconda/biobb_io)
26
25
  [![](https://img.shields.io/conda/dn/bioconda/biobb_io?label=Conda%20Downloads)](https://anaconda.org/bioconda/biobb_io)
27
26
  [![](https://img.shields.io/badge/Docker-Quay.io-blue)](https://quay.io/repository/biocontainers/biobb_io?tab=tags)
28
- [![](https://img.shields.io/badge/Singularity-GalaxyProject-blue)](https://depot.galaxyproject.org/singularity/biobb_io:4.2.0--pyhdfd78af_0)
27
+ [![](https://img.shields.io/badge/Singularity-GalaxyProject-blue)](https://depot.galaxyproject.org/singularity/biobb_io:5.0.0--pyhdfd78af_0)
29
28
 
30
29
  [![](https://img.shields.io/badge/OS-Unix%20%7C%20MacOS-blue)](https://github.com/bioexcel/biobb_io)
31
30
  [![](https://img.shields.io/pypi/pyversions/biobb-io.svg?label=Python%20Versions)](https://pypi.org/project/biobb-io/)
@@ -34,7 +33,7 @@ Requires-Dist: biobb_common==4.2.0
34
33
 
35
34
  [![](https://readthedocs.org/projects/biobb-io/badge/?version=latest&label=Docs)](https://biobb-io.readthedocs.io/en/latest/?badge=latest)
36
35
  [![](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)
36
+ [![](https://img.shields.io/badge/Youtube-tutorials-blue?logo=youtube&logoColor=red)](https://www.youtube.com/@BioExcelCoE/search?query=biobb)
38
37
  [![](https://zenodo.org/badge/DOI/10.1038/s41597-019-0177-4.svg)](https://doi.org/10.1038/s41597-019-0177-4)
39
38
  [![](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
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
- v4.2.0 2024.1
65
+ v5.0.0 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==4.2.0"
76
-
74
+ pip install "biobb_io==5.0.0"
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==4.2.0"
82
+ conda install -c bioconda "biobb_io==5.0.0"
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:4.2.0--pyhdfd78af_0
91
+ docker pull quay.io/biocontainers/biobb_io:5.0.0--pyhdfd78af_0
93
92
 
94
93
  * Usage:
95
94
 
96
95
 
97
- docker run quay.io/biocontainers/biobb_io:4.2.0--pyhdfd78af_0 <command>
96
+ docker run quay.io/biocontainers/biobb_io:5.0.0--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:4.2.0--pyhdfd78af_0
108
+ singularity pull --name biobb_io.sif https://depot.galaxyproject.org/singularity/biobb_io:5.0.0--pyhdfd78af_0
110
109
 
111
110
 
112
111
  * Usage:
@@ -3,7 +3,7 @@
3
3
  [![](https://img.shields.io/conda/vn/bioconda/biobb_io?label=Conda)](https://anaconda.org/bioconda/biobb_io)
4
4
  [![](https://img.shields.io/conda/dn/bioconda/biobb_io?label=Conda%20Downloads)](https://anaconda.org/bioconda/biobb_io)
5
5
  [![](https://img.shields.io/badge/Docker-Quay.io-blue)](https://quay.io/repository/biocontainers/biobb_io?tab=tags)
6
- [![](https://img.shields.io/badge/Singularity-GalaxyProject-blue)](https://depot.galaxyproject.org/singularity/biobb_io:4.2.0--pyhdfd78af_0)
6
+ [![](https://img.shields.io/badge/Singularity-GalaxyProject-blue)](https://depot.galaxyproject.org/singularity/biobb_io:5.0.0--pyhdfd78af_0)
7
7
 
8
8
  [![](https://img.shields.io/badge/OS-Unix%20%7C%20MacOS-blue)](https://github.com/bioexcel/biobb_io)
9
9
  [![](https://img.shields.io/pypi/pyversions/biobb-io.svg?label=Python%20Versions)](https://pypi.org/project/biobb-io/)
@@ -12,7 +12,7 @@
12
12
 
13
13
  [![](https://readthedocs.org/projects/biobb-io/badge/?version=latest&label=Docs)](https://biobb-io.readthedocs.io/en/latest/?badge=latest)
14
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)
15
+ [![](https://img.shields.io/badge/Youtube-tutorials-blue?logo=youtube&logoColor=red)](https://www.youtube.com/@BioExcelCoE/search?query=biobb)
16
16
  [![](https://zenodo.org/badge/DOI/10.1038/s41597-019-0177-4.svg)](https://doi.org/10.1038/s41597-019-0177-4)
17
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
18
 
@@ -41,7 +41,7 @@ The latest documentation of this package can be found in our readthedocs site:
41
41
  [latest API documentation](http://biobb-io.readthedocs.io/en/latest/).
42
42
 
43
43
  ### Version
44
- v4.2.0 2024.1
44
+ v5.0.0 2024.2
45
45
 
46
46
  ### Installation
47
47
  Using PIP:
@@ -50,15 +50,15 @@ Using PIP:
50
50
 
51
51
  * Installation:
52
52
 
53
- pip install "biobb_io==4.2.0"
54
-
53
+ pip install "biobb_io==5.0.0"
54
+
55
55
  * Usage: [Python API documentation](https://biobb-io.readthedocs.io/en/latest/modules.html)
56
56
 
57
57
  Using ANACONDA:
58
58
  * Installation:
59
59
 
60
60
 
61
- conda install -c bioconda "biobb_io==4.2.0"
61
+ conda install -c bioconda "biobb_io==5.0.0"
62
62
 
63
63
 
64
64
  * 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)
@@ -67,12 +67,12 @@ Using DOCKER:
67
67
  * Installation:
68
68
 
69
69
 
70
- docker pull quay.io/biocontainers/biobb_io:4.2.0--pyhdfd78af_0
70
+ docker pull quay.io/biocontainers/biobb_io:5.0.0--pyhdfd78af_0
71
71
 
72
72
  * Usage:
73
73
 
74
74
 
75
- docker run quay.io/biocontainers/biobb_io:4.2.0--pyhdfd78af_0 <command>
75
+ docker run quay.io/biocontainers/biobb_io:5.0.0--pyhdfd78af_0 <command>
76
76
 
77
77
 
78
78
  The command list and specification can be found at the [Command Line documentation](https://biobb-io.readthedocs.io/en/latest/command_line.html).
@@ -84,7 +84,7 @@ Using SINGULARITY:
84
84
  * Installation:
85
85
 
86
86
 
87
- singularity pull --name biobb_io.sif https://depot.galaxyproject.org/singularity/biobb_io:4.2.0--pyhdfd78af_0
87
+ singularity pull --name biobb_io.sif https://depot.galaxyproject.org/singularity/biobb_io:5.0.0--pyhdfd78af_0
88
88
 
89
89
 
90
90
  * Usage:
@@ -0,0 +1,5 @@
1
+ from . import api
2
+
3
+ name = "biobb_io"
4
+ __all__ = ["api"]
5
+ __version__ = "5.0.0"
@@ -0,0 +1,34 @@
1
+ from . import (
2
+ alphafold,
3
+ api_binding_site,
4
+ canonical_fasta,
5
+ drugbank,
6
+ ideal_sdf,
7
+ ligand,
8
+ memprotmd_sim,
9
+ memprotmd_sim_list,
10
+ memprotmd_sim_search,
11
+ mmcif,
12
+ pdb,
13
+ pdb_cluster_zip,
14
+ pdb_variants,
15
+ structure_info,
16
+ )
17
+
18
+ name = "api"
19
+ __all__ = [
20
+ "drugbank",
21
+ "ligand",
22
+ "pdb",
23
+ "alphafold",
24
+ "pdb_cluster_zip",
25
+ "pdb_variants",
26
+ "memprotmd_sim_list",
27
+ "memprotmd_sim_search",
28
+ "memprotmd_sim",
29
+ "api_binding_site",
30
+ "canonical_fasta",
31
+ "mmcif",
32
+ "ideal_sdf",
33
+ "structure_info",
34
+ ]
@@ -1,11 +1,21 @@
1
1
  #!/usr/bin/env python
2
2
 
3
3
  """Module containing the AlphaFold class and the command line interface."""
4
+
4
5
  import argparse
5
- from biobb_common.generic.biobb_object import BiobbObject
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
- from biobb_io.api.common import check_output_path, check_mandatory_property, check_uniprot_code, download_af, write_pdb
11
+
12
+ from biobb_io.api.common import (
13
+ check_mandatory_property,
14
+ check_output_path,
15
+ check_uniprot_code,
16
+ download_af,
17
+ write_pdb,
18
+ )
9
19
 
10
20
 
11
21
  class AlphaFold(BiobbObject):
@@ -20,6 +30,7 @@ class AlphaFold(BiobbObject):
20
30
  * **uniprot_code** (*str*) - (None) Uniprot code.
21
31
  * **remove_tmp** (*bool*) - (True) [WF property] Remove temporal files.
22
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.
23
34
 
24
35
  Examples:
25
36
  This is a use example of how to use the building block from Python::
@@ -41,8 +52,7 @@ class AlphaFold(BiobbObject):
41
52
 
42
53
  """
43
54
 
44
- def __init__(self, output_pdb_path,
45
- properties=None, **kwargs) -> None:
55
+ def __init__(self, output_pdb_path, properties=None, **kwargs) -> None:
46
56
  properties = properties or {}
47
57
 
48
58
  # Call parent class constructor
@@ -50,12 +60,10 @@ class AlphaFold(BiobbObject):
50
60
  self.locals_var_dict = locals().copy()
51
61
 
52
62
  # Input/Output files
53
- self.io_dict = {
54
- "out": {"output_pdb_path": output_pdb_path}
55
- }
63
+ self.io_dict = {"out": {"output_pdb_path": output_pdb_path}}
56
64
 
57
65
  # Properties specific for BB
58
- self.uniprot_code = properties.get('uniprot_code', None)
66
+ self.uniprot_code = properties.get("uniprot_code", None)
59
67
  self.properties = properties
60
68
 
61
69
  # Check the properties
@@ -63,8 +71,14 @@ class AlphaFold(BiobbObject):
63
71
  self.check_arguments()
64
72
 
65
73
  def check_data_params(self, out_log, err_log):
66
- """ Checks all the input/output paths and parameters """
67
- self.output_pdb_path = check_output_path(self.io_dict["out"]["output_pdb_path"], "output_pdb_path", False, out_log, self.__class__.__name__)
74
+ """Checks all the input/output paths and parameters"""
75
+ self.output_pdb_path = check_output_path(
76
+ self.io_dict["out"]["output_pdb_path"],
77
+ "output_pdb_path",
78
+ False,
79
+ out_log,
80
+ self.__class__.__name__,
81
+ )
68
82
 
69
83
  @launchlogger
70
84
  def launch(self) -> int:
@@ -77,14 +91,18 @@ class AlphaFold(BiobbObject):
77
91
  if self.check_restart():
78
92
  return 0
79
93
 
80
- check_mandatory_property(self.uniprot_code, 'uniprot_code', self.out_log, self.__class__.__name__)
94
+ check_mandatory_property(
95
+ self.uniprot_code, "uniprot_code", self.out_log, self.__class__.__name__
96
+ )
81
97
 
82
98
  self.uniprot_code = self.uniprot_code.strip().upper()
83
99
 
84
100
  check_uniprot_code(self.uniprot_code, self.out_log, self.__class__.__name__)
85
101
 
86
102
  # Downloading PDB file
87
- pdb_string = download_af(self.uniprot_code, self.out_log, self.global_log, self.__class__.__name__)
103
+ pdb_string = download_af(
104
+ self.uniprot_code, self.out_log, self.global_log, self.__class__.__name__
105
+ )
88
106
  write_pdb(pdb_string, self.output_pdb_path, None, self.out_log, self.global_log)
89
107
 
90
108
  self.check_arguments(output_files_created=True, raise_exception=False)
@@ -92,31 +110,44 @@ class AlphaFold(BiobbObject):
92
110
  return 0
93
111
 
94
112
 
95
- def alphafold(output_pdb_path: str, properties: dict = None, **kwargs) -> int:
113
+ def alphafold(output_pdb_path: str, properties: Optional[dict] = None, **kwargs) -> int:
96
114
  """Execute the :class:`AlphaFold <api.alphafold.AlphaFold>` class and
97
115
  execute the :meth:`launch() <api.alphafold.AlphaFold.launch>` method."""
98
116
 
99
- return AlphaFold(output_pdb_path=output_pdb_path,
100
- properties=properties, **kwargs).launch()
117
+ return AlphaFold(
118
+ output_pdb_path=output_pdb_path, properties=properties, **kwargs
119
+ ).launch()
101
120
 
102
121
 
103
122
  def main():
104
123
  """Command line execution of this building block. Please check the command line documentation."""
105
- parser = argparse.ArgumentParser(description="This class is a wrapper for downloading a PDB structure from the Protein Data Bank.", formatter_class=lambda prog: argparse.RawTextHelpFormatter(prog, width=99999))
106
- parser.add_argument('-c', '--config', required=False, help="This file can be a YAML file, JSON file or JSON string")
124
+ parser = argparse.ArgumentParser(
125
+ description="This class is a wrapper for downloading a PDB 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
+ )
107
134
 
108
135
  # Specific args of each building block
109
- required_args = parser.add_argument_group('required arguments')
110
- required_args.add_argument('-o', '--output_pdb_path', required=True, help="Path to the output PDB file. Accepted formats: pdb.")
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 file. Accepted formats: pdb.",
142
+ )
111
143
 
112
144
  args = parser.parse_args()
113
145
  config = args.config if args.config else None
114
146
  properties = settings.ConfReader(config=config).get_prop_dic()
115
147
 
116
148
  # Specific call of each building block
117
- alphafold(output_pdb_path=args.output_pdb_path,
118
- properties=properties)
149
+ alphafold(output_pdb_path=args.output_pdb_path, properties=properties)
119
150
 
120
151
 
121
- if __name__ == '__main__':
152
+ if __name__ == "__main__":
122
153
  main()
@@ -1,13 +1,22 @@
1
1
  #!/usr/bin/env python
2
2
 
3
3
  """Module containing the ApiBindingSite class and the command line interface."""
4
+
4
5
  import argparse
5
6
  import json
6
- from biobb_common.generic.biobb_object import BiobbObject
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
- from biobb_io.api.common import check_output_path, check_mandatory_property, download_binding_site, write_json
13
+
14
+ from biobb_io.api.common import (
15
+ check_mandatory_property,
16
+ check_output_path,
17
+ download_binding_site,
18
+ write_json,
19
+ )
11
20
 
12
21
 
13
22
  class ApiBindingSite(BiobbObject):
@@ -22,6 +31,7 @@ class ApiBindingSite(BiobbObject):
22
31
  * **pdb_code** (*str*) - (None) RSCB PDB code.
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::
@@ -43,8 +53,7 @@ class ApiBindingSite(BiobbObject):
43
53
 
44
54
  """
45
55
 
46
- def __init__(self, output_json_path,
47
- properties=None, **kwargs) -> None:
56
+ def __init__(self, output_json_path, properties=None, **kwargs) -> None:
48
57
  properties = properties or {}
49
58
 
50
59
  # Call parent class constructor
@@ -52,12 +61,10 @@ class ApiBindingSite(BiobbObject):
52
61
  self.locals_var_dict = locals().copy()
53
62
 
54
63
  # Input/Output files
55
- self.io_dict = {
56
- "out": {"output_json_path": output_json_path}
57
- }
64
+ self.io_dict = {"out": {"output_json_path": output_json_path}}
58
65
 
59
66
  # Properties specific for BB
60
- self.pdb_code = properties.get('pdb_code', None)
67
+ self.pdb_code = properties.get("pdb_code", None)
61
68
  self.properties = properties
62
69
 
63
70
  # Check the properties
@@ -65,8 +72,14 @@ class ApiBindingSite(BiobbObject):
65
72
  self.check_arguments()
66
73
 
67
74
  def check_data_params(self, out_log, err_log):
68
- """ Checks all the input/output paths and parameters """
69
- self.output_json_path = check_output_path(self.io_dict["out"]["output_json_path"], "output_json_path", False, out_log, self.__class__.__name__)
75
+ """Checks all the input/output paths and parameters"""
76
+ self.output_json_path = check_output_path(
77
+ self.io_dict["out"]["output_json_path"],
78
+ "output_json_path",
79
+ False,
80
+ out_log,
81
+ self.__class__.__name__,
82
+ )
70
83
 
71
84
  @launchlogger
72
85
  def launch(self) -> int:
@@ -80,16 +93,24 @@ class ApiBindingSite(BiobbObject):
80
93
  return 0
81
94
  # self.stage_files()
82
95
 
83
- check_mandatory_property(self.pdb_code, 'pdb_code', self.out_log, self.__class__.__name__)
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
  url = "https://www.ebi.ac.uk/pdbe/api/pdb/entry/binding_sites/%s"
87
102
 
88
103
  # get JSON object
89
- json_string = download_binding_site(self.pdb_code, url, self.out_log, self.global_log)
104
+ json_string = download_binding_site(
105
+ self.pdb_code, url, self.out_log, self.global_log
106
+ )
90
107
 
91
108
  # get number of binding sites
92
- fu.log('%d binding sites found' % (len(json.loads(json_string)[self.pdb_code])), self.out_log, self.global_log)
109
+ fu.log(
110
+ "%d binding sites found" % (len(json.loads(json_string)[self.pdb_code])),
111
+ self.out_log,
112
+ self.global_log,
113
+ )
93
114
 
94
115
  # write JSON file
95
116
  write_json(json_string, self.output_json_path, self.out_log, self.global_log)
@@ -99,31 +120,46 @@ class ApiBindingSite(BiobbObject):
99
120
  return 0
100
121
 
101
122
 
102
- def api_binding_site(output_json_path: str, properties: dict = None, **kwargs) -> int:
123
+ def api_binding_site(
124
+ output_json_path: str, properties: Optional[dict] = None, **kwargs
125
+ ) -> int:
103
126
  """Execute the :class:`ApiBindingSite <api.api_binding_site.ApiBindingSite>` class and
104
127
  execute the :meth:`launch() <api.api_binding_site.ApiBindingSite.launch>` method."""
105
128
 
106
- return ApiBindingSite(output_json_path=output_json_path,
107
- properties=properties, **kwargs).launch()
129
+ return ApiBindingSite(
130
+ output_json_path=output_json_path, properties=properties, **kwargs
131
+ ).launch()
108
132
 
109
133
 
110
134
  def main():
111
135
  """Command line execution of this building block. Please check the command line documentation."""
112
- parser = argparse.ArgumentParser(description="This class is a wrapper for the PDBe REST API Binding Sites endpoint", formatter_class=lambda prog: argparse.RawTextHelpFormatter(prog, width=99999))
113
- parser.add_argument('-c', '--config', required=False, help="This file can be a YAML file, JSON file or JSON string")
136
+ parser = argparse.ArgumentParser(
137
+ description="This class is a wrapper for the PDBe REST API Binding Sites endpoint",
138
+ formatter_class=lambda prog: argparse.RawTextHelpFormatter(prog, width=99999),
139
+ )
140
+ parser.add_argument(
141
+ "-c",
142
+ "--config",
143
+ required=False,
144
+ help="This file can be a YAML file, JSON file or JSON string",
145
+ )
114
146
 
115
147
  # Specific args of each building block
116
- required_args = parser.add_argument_group('required arguments')
117
- required_args.add_argument('-o', '--output_json_path', required=True, help="Path to the JSON file with the binding sites for the requested structure. Accepted formats: json.")
148
+ required_args = parser.add_argument_group("required arguments")
149
+ required_args.add_argument(
150
+ "-o",
151
+ "--output_json_path",
152
+ required=True,
153
+ help="Path to the JSON file with the binding sites for the requested structure. Accepted formats: json.",
154
+ )
118
155
 
119
156
  args = parser.parse_args()
120
157
  config = args.config if args.config else None
121
158
  properties = settings.ConfReader(config=config).get_prop_dic()
122
159
 
123
160
  # Specific call of each building block
124
- api_binding_site(output_json_path=args.output_json_path,
125
- properties=properties)
161
+ api_binding_site(output_json_path=args.output_json_path, properties=properties)
126
162
 
127
163
 
128
- if __name__ == '__main__':
164
+ if __name__ == "__main__":
129
165
  main()
@@ -1,11 +1,20 @@
1
1
  #!/usr/bin/env python
2
2
 
3
3
  """Module containing the CanonicalFasta class and the command line interface."""
4
+
4
5
  import argparse
5
- from biobb_common.generic.biobb_object import BiobbObject
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
- from biobb_io.api.common import check_output_path, check_mandatory_property, download_fasta, write_fasta
11
+
12
+ from biobb_io.api.common import (
13
+ check_mandatory_property,
14
+ check_output_path,
15
+ download_fasta,
16
+ write_fasta,
17
+ )
9
18
 
10
19
 
11
20
  class CanonicalFasta(BiobbObject):
@@ -21,6 +30,7 @@ class CanonicalFasta(BiobbObject):
21
30
  * **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/>`_).
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 CanonicalFasta(BiobbObject):
43
53
 
44
54
  """
45
55
 
46
- def __init__(self, output_fasta_path,
47
- properties=None, **kwargs) -> None:
56
+ def __init__(self, output_fasta_path, properties=None, **kwargs) -> None:
48
57
  properties = properties or {}
49
58
 
50
59
  # Call parent class constructor
@@ -52,13 +61,11 @@ class CanonicalFasta(BiobbObject):
52
61
  self.locals_var_dict = locals().copy()
53
62
 
54
63
  # Input/Output files
55
- self.io_dict = {
56
- "out": {"output_fasta_path": output_fasta_path}
57
- }
64
+ self.io_dict = {"out": {"output_fasta_path": output_fasta_path}}
58
65
 
59
66
  # Properties specific for BB
60
- self.pdb_code = properties.get('pdb_code', None)
61
- self.api_id = properties.get('api_id', 'pdbe')
67
+ self.pdb_code = properties.get("pdb_code", None)
68
+ self.api_id = properties.get("api_id", "pdbe")
62
69
  self.properties = properties
63
70
 
64
71
  # Check the properties
@@ -66,8 +73,14 @@ class CanonicalFasta(BiobbObject):
66
73
  self.check_arguments()
67
74
 
68
75
  def check_data_params(self, out_log, err_log):
69
- """ Checks all the input/output paths and parameters """
70
- self.output_fasta_path = check_output_path(self.io_dict["out"]["output_fasta_path"], "output_fasta_path", False, out_log, self.__class__.__name__)
76
+ """Checks all the input/output paths and parameters"""
77
+ self.output_fasta_path = check_output_path(
78
+ self.io_dict["out"]["output_fasta_path"],
79
+ "output_fasta_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 CanonicalFasta(BiobbObject):
80
93
  if self.check_restart():
81
94
  return 0
82
95
 
83
- check_mandatory_property(self.pdb_code, 'pdb_code', self.out_log, self.__class__.__name__)
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
- pdb_string = download_fasta(self.pdb_code, self.api_id, self.out_log, self.global_log)
103
+ pdb_string = download_fasta(
104
+ self.pdb_code, self.api_id, self.out_log, self.global_log
105
+ )
89
106
  write_fasta(pdb_string, self.output_fasta_path, self.out_log, self.global_log)
90
107
 
91
108
  self.check_arguments(output_files_created=True, raise_exception=False)
@@ -93,31 +110,46 @@ class CanonicalFasta(BiobbObject):
93
110
  return 0
94
111
 
95
112
 
96
- def canonical_fasta(output_fasta_path: str, properties: dict = None, **kwargs) -> int:
113
+ def canonical_fasta(
114
+ output_fasta_path: str, properties: Optional[dict] = None, **kwargs
115
+ ) -> int:
97
116
  """Execute the :class:`CanonicalFasta <api.canonical_fasta.CanonicalFasta>` class and
98
117
  execute the :meth:`launch() <api.canonical_fasta.CanonicalFasta.launch>` method."""
99
118
 
100
- return CanonicalFasta(output_fasta_path=output_fasta_path,
101
- properties=properties, **kwargs).launch()
119
+ return CanonicalFasta(
120
+ output_fasta_path=output_fasta_path, properties=properties, **kwargs
121
+ ).launch()
102
122
 
103
123
 
104
124
  def main():
105
125
  """Command line execution of this building block. Please check the command line documentation."""
106
- parser = argparse.ArgumentParser(description="This class is a wrapper for downloading a FASTA structure from the Protein Data Bank.", formatter_class=lambda prog: argparse.RawTextHelpFormatter(prog, width=99999))
107
- parser.add_argument('-c', '--config', required=False, help="This file can be a YAML file, JSON file or JSON string")
126
+ parser = argparse.ArgumentParser(
127
+ description="This class is a wrapper for downloading a FASTA structure from the Protein Data Bank.",
128
+ formatter_class=lambda prog: argparse.RawTextHelpFormatter(prog, width=99999),
129
+ )
130
+ parser.add_argument(
131
+ "-c",
132
+ "--config",
133
+ required=False,
134
+ help="This file can be a YAML file, JSON file or JSON string",
135
+ )
108
136
 
109
137
  # Specific args of each building block
110
- required_args = parser.add_argument_group('required arguments')
111
- required_args.add_argument('-o', '--output_fasta_path', required=True, help="Path to the canonical FASTA file. Accepted formats: fasta.")
138
+ required_args = parser.add_argument_group("required arguments")
139
+ required_args.add_argument(
140
+ "-o",
141
+ "--output_fasta_path",
142
+ required=True,
143
+ help="Path to the canonical FASTA file. Accepted formats: fasta.",
144
+ )
112
145
 
113
146
  args = parser.parse_args()
114
147
  config = args.config if args.config else None
115
148
  properties = settings.ConfReader(config=config).get_prop_dic()
116
149
 
117
150
  # Specific call of each building block
118
- canonical_fasta(output_fasta_path=args.output_fasta_path,
119
- properties=properties)
151
+ canonical_fasta(output_fasta_path=args.output_fasta_path, properties=properties)
120
152
 
121
153
 
122
- if __name__ == '__main__':
154
+ if __name__ == "__main__":
123
155
  main()