dnaerys 0.1.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 (38) hide show
  1. dnaerys-0.1.0/LICENSE +202 -0
  2. dnaerys-0.1.0/PKG-INFO +106 -0
  3. dnaerys-0.1.0/README.md +81 -0
  4. dnaerys-0.1.0/pyproject.toml +43 -0
  5. dnaerys-0.1.0/setup.cfg +4 -0
  6. dnaerys-0.1.0/src/dnaerys/__init__.py +137 -0
  7. dnaerys-0.1.0/src/dnaerys/_channel.py +54 -0
  8. dnaerys-0.1.0/src/dnaerys/_client.py +1124 -0
  9. dnaerys-0.1.0/src/dnaerys/_convert.py +464 -0
  10. dnaerys-0.1.0/src/dnaerys/_dispatch.py +620 -0
  11. dnaerys-0.1.0/src/dnaerys/_enums.py +522 -0
  12. dnaerys-0.1.0/src/dnaerys/_exceptions.py +188 -0
  13. dnaerys-0.1.0/src/dnaerys/_pagination.py +188 -0
  14. dnaerys-0.1.0/src/dnaerys/_proto/__init__.py +0 -0
  15. dnaerys-0.1.0/src/dnaerys/_proto/dnaerys_pb2.py +163 -0
  16. dnaerys-0.1.0/src/dnaerys/_proto/dnaerys_pb2.pyi +1527 -0
  17. dnaerys-0.1.0/src/dnaerys/_proto/dnaerys_pb2_grpc.py +1717 -0
  18. dnaerys-0.1.0/src/dnaerys/_stream.py +523 -0
  19. dnaerys-0.1.0/src/dnaerys/_types.py +998 -0
  20. dnaerys-0.1.0/src/dnaerys/py.typed +0 -0
  21. dnaerys-0.1.0/src/dnaerys.egg-info/PKG-INFO +106 -0
  22. dnaerys-0.1.0/src/dnaerys.egg-info/SOURCES.txt +36 -0
  23. dnaerys-0.1.0/src/dnaerys.egg-info/dependency_links.txt +1 -0
  24. dnaerys-0.1.0/src/dnaerys.egg-info/requires.txt +11 -0
  25. dnaerys-0.1.0/src/dnaerys.egg-info/top_level.txt +1 -0
  26. dnaerys-0.1.0/tests/test_client_integration.py +640 -0
  27. dnaerys-0.1.0/tests/test_convert.py +729 -0
  28. dnaerys-0.1.0/tests/test_dispatch.py +373 -0
  29. dnaerys-0.1.0/tests/test_e2e.py +120 -0
  30. dnaerys-0.1.0/tests/test_enums.py +223 -0
  31. dnaerys-0.1.0/tests/test_exceptions.py +89 -0
  32. dnaerys-0.1.0/tests/test_paginate_integration.py +209 -0
  33. dnaerys-0.1.0/tests/test_pagination.py +452 -0
  34. dnaerys-0.1.0/tests/test_proto_coverage.py +107 -0
  35. dnaerys-0.1.0/tests/test_public_api.py +90 -0
  36. dnaerys-0.1.0/tests/test_stream.py +522 -0
  37. dnaerys-0.1.0/tests/test_thread_safety.py +60 -0
  38. dnaerys-0.1.0/tests/test_types.py +618 -0
dnaerys-0.1.0/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ https://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ https://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
dnaerys-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,106 @@
1
+ Metadata-Version: 2.4
2
+ Name: dnaerys
3
+ Version: 0.1.0
4
+ Summary: Python client library for the Dnaerys genome variant store
5
+ Author-email: Dnaerys <info@dnaerys.org>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/dnaerys/dnaerys-python
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.12
10
+ Classifier: Programming Language :: Python :: 3.13
11
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
12
+ Requires-Python: >=3.12
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: grpcio>=1.78.0
16
+ Requires-Dist: protobuf>=6.33.5
17
+ Provides-Extra: pandas
18
+ Requires-Dist: pandas>=2.0; extra == "pandas"
19
+ Provides-Extra: dev
20
+ Requires-Dist: pytest>=8.0; extra == "dev"
21
+ Requires-Dist: grpcio-tools>=1.78.0; extra == "dev"
22
+ Requires-Dist: build>=1.0; extra == "dev"
23
+ Requires-Dist: twine>=5.0; extra == "dev"
24
+ Dynamic: license-file
25
+
26
+ [![PyPI version](https://img.shields.io/pypi/v/dnaerys)](https://pypi.org/project/dnaerys/) [![Python versions](https://img.shields.io/pypi/pyversions/dnaerys)](https://pypi.org/project/dnaerys/) [![License](https://img.shields.io/badge/license-Apache%202.0-blue)](LICENSE) [![Documentation](https://readthedocs.org/projects/dnaerys/badge/)](https://dnaerys-python.readthedocs.io)
27
+
28
+ # Dnaerys Python Client
29
+
30
+ Python client library for [Dnaerys](https://dnaerys.org/), a high-performance
31
+ distributed genome variant database. Dnaerys stores indexed variant and sample
32
+ data for large cohorts and serves queries with millisecond latency, including
33
+ VEP annotations, allele frequencies, and pathogenicity predictions. This library
34
+ wraps the gRPC API into Pythonic methods with streaming iteration, pagination,
35
+ and frozen dataclass results. It is designed for bioinformaticians and data
36
+ scientists working with cohort-scale genomic data.
37
+
38
+ **Full documentation:** [dnaerys-python.readthedocs.io](https://dnaerys-python.readthedocs.io)
39
+
40
+ ## Requirements
41
+
42
+ Python 3.12 or later.
43
+
44
+ ## Installation
45
+
46
+ ```bash
47
+ pip install dnaerys
48
+ pip install dnaerys[pandas] # for to_dataframe() support
49
+ ```
50
+
51
+ ## Quick Start
52
+
53
+ ```python
54
+ from dnaerys import (
55
+ DnaerysClient, Region, AnnotationFilter, Consequence, Impact,
56
+ )
57
+
58
+ tp53 = Region("chr17", 7661779, 7687546)
59
+
60
+ with DnaerysClient("db.dnaerys.org:443") as client:
61
+ ann = AnnotationFilter(
62
+ impact=[Impact.HIGH, Impact.MODERATE],
63
+ consequence=[Consequence.MISSENSE_VARIANT],
64
+ clin_significance=["PATHOGENIC", "LIKELY_PATHOGENIC"],
65
+ )
66
+
67
+ stream = client.select_variants(
68
+ region=tp53,
69
+ annotations=ann,
70
+ limit=10,
71
+ )
72
+
73
+ for variant in stream:
74
+ print(variant)
75
+
76
+ # Check response metadata
77
+ print(f"Elapsed: {stream.metadata.elapsed_ms}ms")
78
+ ```
79
+
80
+ ## Features
81
+
82
+ - **Streaming iteration** — variant results arrive as lazy iterators with constant memory usage.
83
+ - **Pagination** — `paginate_*` methods serve fixed-size pages with transparent buffer refills.
84
+ - **Annotation filtering** — filter by VEP annotations, AF, CADD, AlphaMissense, PolyPhen, SIFT, ClinVar significance, and more.
85
+ - **Inheritance queries** — detect de novo, heterozygous dominant, and homozygous recessive variants across trios.
86
+ - **Kinship analysis** — KING-based kinship estimation for cohorts, duos, trios, and external samples.
87
+ - **Frozen dataclasses** — all result types are immutable, slotted, and hashable; safe to cache, copy, and use as dict keys.
88
+ - **Clean exception hierarchy** — gRPC status codes map to specific exception classes with `is_retryable` flags.
89
+ - **pandas integration** — call `to_dataframe()` on any variant stream to get a DataFrame.
90
+
91
+ ## Documentation
92
+
93
+ Full documentation including API reference, pagination guide, annotation filter
94
+ reference, and connection options is available at
95
+ [dnaerys-python.readthedocs.io](https://dnaerys-python.readthedocs.io). The API reference
96
+ covers all 27 public methods on `DnaerysClient`.
97
+
98
+ ## License
99
+
100
+ Apache License 2.0 — see [LICENSE](LICENSE) for details.
101
+
102
+ ## Contributing
103
+
104
+ Contributions are welcome. Please open an issue to discuss proposed changes
105
+ before submitting a pull request. Bug reports and feature requests can be
106
+ filed at [github.com/dnaerys/dnaerys-python/issues](https://github.com/dnaerys/dnaerys-python/issues).
@@ -0,0 +1,81 @@
1
+ [![PyPI version](https://img.shields.io/pypi/v/dnaerys)](https://pypi.org/project/dnaerys/) [![Python versions](https://img.shields.io/pypi/pyversions/dnaerys)](https://pypi.org/project/dnaerys/) [![License](https://img.shields.io/badge/license-Apache%202.0-blue)](LICENSE) [![Documentation](https://readthedocs.org/projects/dnaerys/badge/)](https://dnaerys-python.readthedocs.io)
2
+
3
+ # Dnaerys Python Client
4
+
5
+ Python client library for [Dnaerys](https://dnaerys.org/), a high-performance
6
+ distributed genome variant database. Dnaerys stores indexed variant and sample
7
+ data for large cohorts and serves queries with millisecond latency, including
8
+ VEP annotations, allele frequencies, and pathogenicity predictions. This library
9
+ wraps the gRPC API into Pythonic methods with streaming iteration, pagination,
10
+ and frozen dataclass results. It is designed for bioinformaticians and data
11
+ scientists working with cohort-scale genomic data.
12
+
13
+ **Full documentation:** [dnaerys-python.readthedocs.io](https://dnaerys-python.readthedocs.io)
14
+
15
+ ## Requirements
16
+
17
+ Python 3.12 or later.
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ pip install dnaerys
23
+ pip install dnaerys[pandas] # for to_dataframe() support
24
+ ```
25
+
26
+ ## Quick Start
27
+
28
+ ```python
29
+ from dnaerys import (
30
+ DnaerysClient, Region, AnnotationFilter, Consequence, Impact,
31
+ )
32
+
33
+ tp53 = Region("chr17", 7661779, 7687546)
34
+
35
+ with DnaerysClient("db.dnaerys.org:443") as client:
36
+ ann = AnnotationFilter(
37
+ impact=[Impact.HIGH, Impact.MODERATE],
38
+ consequence=[Consequence.MISSENSE_VARIANT],
39
+ clin_significance=["PATHOGENIC", "LIKELY_PATHOGENIC"],
40
+ )
41
+
42
+ stream = client.select_variants(
43
+ region=tp53,
44
+ annotations=ann,
45
+ limit=10,
46
+ )
47
+
48
+ for variant in stream:
49
+ print(variant)
50
+
51
+ # Check response metadata
52
+ print(f"Elapsed: {stream.metadata.elapsed_ms}ms")
53
+ ```
54
+
55
+ ## Features
56
+
57
+ - **Streaming iteration** — variant results arrive as lazy iterators with constant memory usage.
58
+ - **Pagination** — `paginate_*` methods serve fixed-size pages with transparent buffer refills.
59
+ - **Annotation filtering** — filter by VEP annotations, AF, CADD, AlphaMissense, PolyPhen, SIFT, ClinVar significance, and more.
60
+ - **Inheritance queries** — detect de novo, heterozygous dominant, and homozygous recessive variants across trios.
61
+ - **Kinship analysis** — KING-based kinship estimation for cohorts, duos, trios, and external samples.
62
+ - **Frozen dataclasses** — all result types are immutable, slotted, and hashable; safe to cache, copy, and use as dict keys.
63
+ - **Clean exception hierarchy** — gRPC status codes map to specific exception classes with `is_retryable` flags.
64
+ - **pandas integration** — call `to_dataframe()` on any variant stream to get a DataFrame.
65
+
66
+ ## Documentation
67
+
68
+ Full documentation including API reference, pagination guide, annotation filter
69
+ reference, and connection options is available at
70
+ [dnaerys-python.readthedocs.io](https://dnaerys-python.readthedocs.io). The API reference
71
+ covers all 27 public methods on `DnaerysClient`.
72
+
73
+ ## License
74
+
75
+ Apache License 2.0 — see [LICENSE](LICENSE) for details.
76
+
77
+ ## Contributing
78
+
79
+ Contributions are welcome. Please open an issue to discuss proposed changes
80
+ before submitting a pull request. Bug reports and feature requests can be
81
+ filed at [github.com/dnaerys/dnaerys-python/issues](https://github.com/dnaerys/dnaerys-python/issues).
@@ -0,0 +1,43 @@
1
+ [project]
2
+ name = "dnaerys"
3
+ version = "0.1.0"
4
+ description = "Python client library for the Dnaerys genome variant store"
5
+ authors = [{name = "Dnaerys", email = "info@dnaerys.org"}]
6
+ readme = "README.md"
7
+ license = "Apache-2.0"
8
+ requires-python = ">=3.12"
9
+ classifiers = [
10
+ "Programming Language :: Python :: 3",
11
+ "Programming Language :: Python :: 3.12",
12
+ "Programming Language :: Python :: 3.13",
13
+ "Topic :: Scientific/Engineering :: Bio-Informatics",
14
+ ]
15
+ dependencies = [
16
+ "grpcio>=1.78.0",
17
+ "protobuf>=6.33.5",
18
+ ]
19
+
20
+ [project.urls]
21
+ Homepage = "https://github.com/dnaerys/dnaerys-python"
22
+
23
+ [project.optional-dependencies]
24
+ pandas = ["pandas>=2.0"]
25
+ dev = [
26
+ "pytest>=8.0",
27
+ "grpcio-tools>=1.78.0",
28
+ "build>=1.0",
29
+ "twine>=5.0",
30
+ ]
31
+
32
+ [build-system]
33
+ requires = ["setuptools>=68.0"]
34
+ build-backend = "setuptools.build_meta"
35
+
36
+ [tool.setuptools.packages.find]
37
+ where = ["src"]
38
+
39
+ [tool.pytest.ini_options]
40
+ testpaths = ["tests"]
41
+ markers = [
42
+ "e2e: end-to-end tests against a real Dnaerys cluster (deselect with '-m \"not e2e\"')",
43
+ ]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,137 @@
1
+ """Dnaerys Python client library for the Dnaerys genomic data service.
2
+
3
+ This library provides a Pythonic interface to the Dnaerys gRPC service,
4
+ which offers high-performance variant and sample queries over indexed
5
+ genomic datasets.
6
+
7
+ Proto version: R1.17.8
8
+ """
9
+
10
+ from dnaerys._enums import (
11
+ AlphaMissense,
12
+ BioType,
13
+ Chromosome,
14
+ ClinSignificance,
15
+ Consequence,
16
+ FeatureType,
17
+ Impact,
18
+ KinshipDegree,
19
+ PolyPhen,
20
+ RefAssembly,
21
+ SIFT,
22
+ VariantType,
23
+ resolve_assembly,
24
+ resolve_chromosome,
25
+ resolve_enum,
26
+ )
27
+ from dnaerys._exceptions import (
28
+ DnaerysAuthenticationError,
29
+ DnaerysConnectionError,
30
+ DnaerysError,
31
+ DnaerysIncompleteResultWarning,
32
+ DnaerysInvalidRequestError,
33
+ DnaerysNotFoundError,
34
+ DnaerysResourceExhausted,
35
+ DnaerysServerError,
36
+ )
37
+ from dnaerys._client import DnaerysClient
38
+ from dnaerys._pagination import Page, PaginatedQuery
39
+ from dnaerys._stream import (
40
+ VariantStream,
41
+ VariantWithStatsStream,
42
+ )
43
+ from dnaerys._types import (
44
+ AnnotationFilter,
45
+ Bracket,
46
+ ClusterNodesResult,
47
+ Cohort,
48
+ CountResult,
49
+ DatasetInfo,
50
+ FstatXResult,
51
+ HealthResult,
52
+ KinshipResult,
53
+ PrsInfo,
54
+ PrsResult,
55
+ Region,
56
+ Relatedness,
57
+ ResponseMetadata,
58
+ SampleKinshipResult,
59
+ SampleRelatedness,
60
+ SampleScore,
61
+ SamplesResult,
62
+ SampleStat,
63
+ SexMismatchResult,
64
+ TopChi2Result,
65
+ TopHweResult,
66
+ Variant,
67
+ VariantWithStats,
68
+ )
69
+
70
+ PROTO_VERSION: str = "R1.17.8"
71
+ """Protocol buffer schema version that this library targets."""
72
+
73
+ __all__ = [
74
+ # Proto version
75
+ "PROTO_VERSION",
76
+ # Client
77
+ "DnaerysClient",
78
+ # Enums
79
+ "Chromosome",
80
+ "RefAssembly",
81
+ "VariantType",
82
+ "FeatureType",
83
+ "BioType",
84
+ "Consequence",
85
+ "Impact",
86
+ "SIFT",
87
+ "PolyPhen",
88
+ "ClinSignificance",
89
+ "AlphaMissense",
90
+ "KinshipDegree",
91
+ # Enum resolution
92
+ "resolve_chromosome",
93
+ "resolve_enum",
94
+ "resolve_assembly",
95
+ # Input types
96
+ "Region",
97
+ "Bracket",
98
+ "AnnotationFilter",
99
+ # Core result types
100
+ "Variant",
101
+ "VariantWithStats",
102
+ # Stream wrappers
103
+ "VariantStream",
104
+ "VariantWithStatsStream",
105
+ # Pagination
106
+ "Page",
107
+ "PaginatedQuery",
108
+ # Response wrappers
109
+ "ResponseMetadata",
110
+ "CountResult",
111
+ "SamplesResult",
112
+ "HealthResult",
113
+ "ClusterNodesResult",
114
+ "DatasetInfo",
115
+ "Cohort",
116
+ "PrsInfo",
117
+ "PrsResult",
118
+ "SampleScore",
119
+ "SexMismatchResult",
120
+ "SampleStat",
121
+ "FstatXResult",
122
+ "KinshipResult",
123
+ "Relatedness",
124
+ "SampleKinshipResult",
125
+ "SampleRelatedness",
126
+ "TopHweResult",
127
+ "TopChi2Result",
128
+ # Exceptions
129
+ "DnaerysError",
130
+ "DnaerysConnectionError",
131
+ "DnaerysAuthenticationError",
132
+ "DnaerysNotFoundError",
133
+ "DnaerysInvalidRequestError",
134
+ "DnaerysServerError",
135
+ "DnaerysResourceExhausted",
136
+ "DnaerysIncompleteResultWarning",
137
+ ]
@@ -0,0 +1,54 @@
1
+ """Channel creation for gRPC connections to the Dnaerys service."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any
6
+
7
+ import grpc
8
+
9
+
10
+ def create_channel(
11
+ target: str,
12
+ *,
13
+ tls: bool,
14
+ credentials: grpc.ChannelCredentials | None,
15
+ options: dict[str, Any] | None,
16
+ ) -> grpc.Channel:
17
+ """Create a gRPC channel to the Dnaerys service.
18
+
19
+ Parameters
20
+ ----------
21
+ target : str
22
+ Server address in ``host:port`` format.
23
+ tls : bool
24
+ If ``True``, create a secure channel. If ``False``, insecure.
25
+ credentials : grpc.ChannelCredentials | None
26
+ Custom TLS credentials. If ``None`` and *tls* is ``True``,
27
+ default SSL credentials are used.
28
+ options : dict[str, Any] | None
29
+ gRPC channel options as ``{key: value}`` pairs. Converted to
30
+ a list of ``(key, value)`` tuples for the gRPC channel constructor.
31
+
32
+ Returns
33
+ -------
34
+ grpc.Channel
35
+ The created gRPC channel.
36
+
37
+ Raises
38
+ ------
39
+ ValueError
40
+ If *credentials* is provided with ``tls=False`` (insecure channels
41
+ cannot use TLS credentials).
42
+ """
43
+ channel_options = list(options.items()) if options else None
44
+
45
+ if tls:
46
+ creds = credentials if credentials is not None else grpc.ssl_channel_credentials()
47
+ return grpc.secure_channel(target, creds, options=channel_options)
48
+ else:
49
+ if credentials is not None:
50
+ raise ValueError(
51
+ "credentials cannot be provided when tls=False; "
52
+ "use tls=True for secure channels"
53
+ )
54
+ return grpc.insecure_channel(target, options=channel_options)