protein-quest 0.10.0__py3-none-any.whl → 0.10.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.
@@ -1,2 +1,2 @@
1
- __version__ = "0.10.0"
1
+ __version__ = "0.10.1"
2
2
  """The version of the package."""
@@ -114,7 +114,6 @@ class AlphaFoldEntry:
114
114
  """Convert paths in an AlphaFoldEntry to be relative to the session directory.
115
115
 
116
116
  Args:
117
- entry: An AlphaFoldEntry instance with absolute paths.
118
117
  session_dir: The session directory to which the paths should be made relative.
119
118
 
120
119
  Returns:
@@ -483,6 +482,7 @@ def fetch_many_async(
483
482
  )
484
483
 
485
484
 
485
+ # jscpd:ignore-start # noqa: ERA001
486
486
  def fetch_many(
487
487
  uniprot_accessions: Iterable[str],
488
488
  save_dir: Path,
@@ -492,6 +492,7 @@ def fetch_many(
492
492
  cacher: Cacher | None = None,
493
493
  gzip_files: bool = False,
494
494
  all_isoforms: bool = False,
495
+ # jscpd:ignore-end # noqa: ERA001
495
496
  ) -> list[AlphaFoldEntry]:
496
497
  """Synchronously fetches summaries and/or files like cif from AlphaFold Protein Structure Database.
497
498
 
protein_quest/parallel.py CHANGED
@@ -2,13 +2,19 @@
2
2
 
3
3
  import logging
4
4
  import os
5
+ import sys
6
+ import warnings
5
7
  from collections.abc import Callable, Collection, Iterator
6
- from contextlib import contextmanager
8
+ from contextlib import contextmanager, suppress
7
9
  from typing import Concatenate, ParamSpec, cast
8
10
 
9
- from dask.distributed import Client, LocalCluster, progress
11
+ from dask.distributed import Client, LocalCluster
10
12
  from distributed.deploy.cluster import Cluster
13
+ from distributed.diagnostics.progress import format_time
14
+ from distributed.diagnostics.progressbar import ProgressBar
15
+ from distributed.utils import LoopRunner
11
16
  from psutil import cpu_count
17
+ from tornado.ioloop import IOLoop
12
18
 
13
19
  logger = logging.getLogger(__name__)
14
20
 
@@ -84,6 +90,60 @@ def _configure_cpu_dask_scheduler(nproc: int, name: str) -> LocalCluster:
84
90
  P = ParamSpec("P")
85
91
 
86
92
 
93
+ class _StderrTextProgressBar(ProgressBar):
94
+ """Copy of distributed.diagnostics.progressbar.TextProgressBar that prints to stderr instead of stdout."""
95
+
96
+ __loop: IOLoop | None = None
97
+
98
+ def __init__(
99
+ self,
100
+ keys,
101
+ scheduler=None,
102
+ interval="100ms",
103
+ width=40,
104
+ loop=None,
105
+ complete=True,
106
+ start=True,
107
+ **kwargs, # noqa: ARG002
108
+ ):
109
+ self._loop_runner = loop_runner = LoopRunner(loop=loop)
110
+ super().__init__(keys, scheduler, interval, complete)
111
+ self.width = width
112
+
113
+ if start:
114
+ loop_runner.run_sync(self.listen)
115
+
116
+ @property
117
+ def loop(self) -> IOLoop | None:
118
+ loop = self.__loop
119
+ if loop is None:
120
+ # If the loop is not running when this is called, the LoopRunner.loop
121
+ # property will raise a DeprecationWarning
122
+ # However subsequent calls might occur - eg atexit, where a stopped
123
+ # loop is still acceptable - so we cache access to the loop.
124
+ self.__loop = loop = self._loop_runner.loop
125
+ return loop
126
+
127
+ @loop.setter
128
+ def loop(self, value: IOLoop) -> None:
129
+ warnings.warn("setting the loop property is deprecated", DeprecationWarning, stacklevel=2)
130
+ self.__loop = value
131
+
132
+ def _draw_bar(self, remaining, all, **kwargs): # noqa: A002, ARG002
133
+ frac = (1 - remaining / all) if all else 1.0
134
+ bar = "#" * int(self.width * frac)
135
+ percent = int(100 * frac)
136
+ elapsed = format_time(self.elapsed)
137
+ msg = "\r[{0:<{1}}] | {2}% Completed | {3}".format(bar, self.width, percent, elapsed)
138
+ with suppress(ValueError):
139
+ sys.stderr.write(msg)
140
+ sys.stderr.flush()
141
+
142
+ def _draw_stop(self, **kwargs): # noqa: ARG002
143
+ sys.stderr.write("\33[2K\r")
144
+ sys.stderr.flush()
145
+
146
+
87
147
  def dask_map_with_progress[T, R, **P](
88
148
  client: Client,
89
149
  func: Callable[Concatenate[T, P], R],
@@ -109,6 +169,6 @@ def dask_map_with_progress[T, R, **P](
109
169
  if client.dashboard_link:
110
170
  logger.info(f"Follow progress on dask dashboard at: {client.dashboard_link}")
111
171
  futures = client.map(func, iterable, *args, **kwargs)
112
- progress(futures)
172
+ _StderrTextProgressBar(futures)
113
173
  results = client.gather(futures)
114
174
  return cast("list[R]", results)
@@ -132,6 +132,18 @@ class ChainNotFoundError(IndexError):
132
132
  """Helper for pickling the exception."""
133
133
  return (self.__class__, (self.chain_id, self.file, self.available_chains))
134
134
 
135
+ def __eq__(self, other):
136
+ if not isinstance(other, ChainNotFoundError):
137
+ return NotImplemented
138
+ return (
139
+ self.chain_id == other.chain_id
140
+ and self.file == other.file
141
+ and self.available_chains == other.available_chains
142
+ )
143
+
144
+ def __hash__(self):
145
+ return hash((self.chain_id, str(self.file), frozenset(self.available_chains)))
146
+
135
147
 
136
148
  def write_single_chain_structure_file(
137
149
  input_file: Path,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: protein_quest
3
- Version: 0.10.0
3
+ Version: 0.10.1
4
4
  Summary: Search/retrieve/filter proteins and protein structures
5
5
  Project-URL: Homepage, https://github.com/haddocking/protein-quest
6
6
  Project-URL: Issues, https://github.com/haddocking/protein-quest/issues
@@ -35,9 +35,14 @@ Description-Content-Type: text/markdown
35
35
  [![Documentation](https://img.shields.io/badge/Documentation-bonvinlab.org-blue?style=flat-square&logo=gitbook)](https://www.bonvinlab.org/protein-quest/)
36
36
  [![CI](https://github.com/haddocking/protein-quest/actions/workflows/ci.yml/badge.svg)](https://github.com/haddocking/protein-quest/actions/workflows/ci.yml)
37
37
  [![Research Software Directory Badge](https://img.shields.io/badge/rsd-00a3e3.svg)](https://www.research-software.nl/software/protein-quest)
38
+ [![bio.tools](https://img.shields.io/badge/bio.tools-protein--quest-009fdf.svg)](https://bio.tools/protein-quest)
38
39
  [![PyPI](https://img.shields.io/pypi/v/protein-quest)](https://pypi.org/project/protein-quest/)
39
40
  [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.16941288.svg)](https://doi.org/10.5281/zenodo.16941288)
40
41
  [![Codacy Badge](https://app.codacy.com/project/badge/Coverage/7a3f3f1fe64640d583a5e50fe7ba828e)](https://app.codacy.com/gh/haddocking/protein-quest/coverage?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage)
42
+ [![FAIR checklist badge](https://fairsoftwarechecklist.net/badge.svg)](https://fairsoftwarechecklist.net/v0.2?f=31&a=32113&i=32121&r=133)
43
+ [![fair-software.eu](https://img.shields.io/badge/fair--software.eu-%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F-green)](https://fair-software.eu)
44
+ [![Copy/paste detector](https://raw.githubusercontent.com/kucherenko/jscpd/refs/tags/v3.5.10/assets/jscpd-badge.svg?sanitize=true)](https://github.com/kucherenko/jscpd/)
45
+
41
46
 
42
47
  Python package to search/retrieve/filter proteins and protein structures.
43
48
 
@@ -104,7 +109,7 @@ pip install git+https://github.com/haddocking/protein-quest.git
104
109
 
105
110
  The main entry point is the `protein-quest` command line tool which has multiple subcommands to perform actions.
106
111
 
107
- To use programmaticly, see the [Jupyter notebooks](https://www.bonvinlab.org/protein-quest/notebooks) and [API documentation](https://www.bonvinlab.org/protein-quest/autoapi/summary/).
112
+ To use programmaticly, see the [Jupyter notebooks](https://www.bonvinlab.org/protein-quest/notebooks) and [API documentation](https://www.bonvinlab.org/protein-quest/autoapi/protein_quest/).
108
113
 
109
114
  While downloading or copying files it uses a global cache (located at `~/.cache/protein-quest`) and hardlinks to save disk space and improve speed.
110
115
  This behavior can be customized with the `--no-cache`, `--cache-dir`, and `--copy-method` command line arguments.
@@ -302,7 +307,7 @@ The mcp server contains an prompt template to search/retrieve/filter candidate s
302
307
 
303
308
  ## Shell autocompletion
304
309
 
305
- The `protein-quest` command line tool supports shell autocompletion using [shtab](https://shtab.readthedocs.io/).
310
+ The `protein-quest` command line tool supports shell autocompletion using [shtab](https://docs.iterative.ai/shtab).
306
311
 
307
312
  Initialize for bash shell with:
308
313
 
@@ -1,5 +1,5 @@
1
1
  protein_quest/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- protein_quest/__version__.py,sha256=AIIGmZhye-n6ZBXgJwVTpnPgeDGiFc6274smYYsnbv0,57
2
+ protein_quest/__version__.py,sha256=qCmLtq4uktEgR1D3vZFBaO_0UsYFvPWt7gmxqgWwku0,57
3
3
  protein_quest/cli.py,sha256=aWqdAeseUm7s8UGmrPFNfJPW6W83RmpJAsEy4sZscQY,57506
4
4
  protein_quest/converter.py,sha256=Y-Oxf7lDNbEicL6GS-IpNWDwaAiHgIgs5bFAcEHCKdQ,1441
5
5
  protein_quest/emdb.py,sha256=641c6RwNYnu-0GBFyCFBiI58fNc0jMkd0ZZ9MW9-Jmc,1501
@@ -7,21 +7,21 @@ protein_quest/filters.py,sha256=em1FYD7Y9z98ZSaJGYCv1VCGRADLbat8FfSOlNJNAJM,5663
7
7
  protein_quest/go.py,sha256=lZNEcw8nTc9wpV3cl4y2FG9Lsj8wsXQ6zemmAQs_DWE,5650
8
8
  protein_quest/io.py,sha256=ngV_HU2HIQFO-bP2xQj_fhgv0MYjW4puqz_9CxGpBv8,13017
9
9
  protein_quest/mcp_server.py,sha256=ZmEs18crS_Ce1-b_PM4m5kmS5C8lLlcrgpocTt7GVrg,8551
10
- protein_quest/parallel.py,sha256=3sbc8ZSpI2T0TF6b3DCZSE490-uQAGc0s-TDOwA11NE,3780
10
+ protein_quest/parallel.py,sha256=uf26nD5l1Gp4Z5AFgb0K3vNBUlzvfFh8NSDbGzePSr0,5856
11
11
  protein_quest/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  protein_quest/ss.py,sha256=4ZGIHfjTlodYTXqGUKhMnGbgaStYOGaWg2oYrWIjdgo,10118
13
- protein_quest/structure.py,sha256=AYEZ0C0PbUZ4LFw-1Qan0tqbazPNsTNthlDOfuERE3Y,8696
13
+ protein_quest/structure.py,sha256=3TdzrXbGpmnskp3gjwVevwD1tfhKfAUPOHWi9ViaheM,9101
14
14
  protein_quest/taxonomy.py,sha256=4mKv8zll4mX02Ow8CTvyqMJE2KJZvcq3QlTjjjLOJJk,5072
15
15
  protein_quest/uniprot.py,sha256=kV1lOZ_ugcF-LUff9hvmJPaGwA_uaHPJCL_3DLBIvSE,36798
16
16
  protein_quest/utils.py,sha256=5Ncdid-dslggy-Ti1yhOHwdAM7Bxpyia7Re-xDkc2P0,19909
17
17
  protein_quest/alphafold/__init__.py,sha256=Ktasi5BRp71wO7-PpOGDpIRRtBEefs8knIdlKQeLQpk,51
18
18
  protein_quest/alphafold/confidence.py,sha256=UtS2MJEReaZ1kTXbQf8Vrc9gzGjAOiGLYs4glqN-1do,8098
19
19
  protein_quest/alphafold/entry_summary.py,sha256=Qhnw75RXFaoOU332g7axg_jYbbdZbUpsGPUOwPNDSeU,2114
20
- protein_quest/alphafold/fetch.py,sha256=eKCQHkAMko-d36VvRHLCllLxuAXBdbBUhUONOSCPsds,21970
20
+ protein_quest/alphafold/fetch.py,sha256=D-RWKWo5kWpCko_LNT_sslzrpeR3HX9nu5F4MUOFRtI,21979
21
21
  protein_quest/pdbe/__init__.py,sha256=eNNHtN60NAGea7gvRkIzkoTXsYPK99s-ldIcKWYO6So,61
22
22
  protein_quest/pdbe/fetch.py,sha256=e8CHWDX2QzWnVLmYXCfNrscw1UcN1lI9Uz6Z5HmEOEQ,2510
23
- protein_quest-0.10.0.dist-info/METADATA,sha256=vmhFgKOJFwHZ5O2kzN7AKXVT8M7rjLCsBF05g4kQj4E,11336
24
- protein_quest-0.10.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
25
- protein_quest-0.10.0.dist-info/entry_points.txt,sha256=f1RtOxv9TFBO3w01EMEuFXBTMsqKsQcKlkxmj9zE-0g,57
26
- protein_quest-0.10.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
27
- protein_quest-0.10.0.dist-info/RECORD,,
23
+ protein_quest-0.10.1.dist-info/METADATA,sha256=Mz2JLKRAqBvcbMsr1I1rdeYlJK8lTUXCX3AwBpSywxI,11939
24
+ protein_quest-0.10.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
25
+ protein_quest-0.10.1.dist-info/entry_points.txt,sha256=f1RtOxv9TFBO3w01EMEuFXBTMsqKsQcKlkxmj9zE-0g,57
26
+ protein_quest-0.10.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
27
+ protein_quest-0.10.1.dist-info/RECORD,,