genos-client 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.
Potentially problematic release.
This version of genos-client might be problematic. Click here for more details.
- genos_client-0.1.0/LICENSE +21 -0
- genos_client-0.1.0/PKG-INFO +247 -0
- genos_client-0.1.0/README.md +213 -0
- genos_client-0.1.0/docs/conf.py +106 -0
- genos_client-0.1.0/genos/__init__.py +28 -0
- genos_client-0.1.0/genos/api/__init__.py +19 -0
- genos_client-0.1.0/genos/api/embedding_extractor.py +118 -0
- genos_client-0.1.0/genos/api/health.py +123 -0
- genos_client-0.1.0/genos/api/rna_seq_coverage_track_prediction.py +139 -0
- genos_client-0.1.0/genos/api/variant_predictor.py +124 -0
- genos_client-0.1.0/genos/client.py +124 -0
- genos_client-0.1.0/genos/config.py +81 -0
- genos_client-0.1.0/genos/exceptions.py +54 -0
- genos_client-0.1.0/genos/plots/__init__.py +3 -0
- genos_client-0.1.0/genos/plots/genomic_track_viewer.py +315 -0
- genos_client-0.1.0/genos/utils/__init__.py +2 -0
- genos_client-0.1.0/genos/utils/genomic_track_utils.py +308 -0
- genos_client-0.1.0/genos_client.egg-info/PKG-INFO +247 -0
- genos_client-0.1.0/genos_client.egg-info/SOURCES.txt +22 -0
- genos_client-0.1.0/genos_client.egg-info/dependency_links.txt +1 -0
- genos_client-0.1.0/genos_client.egg-info/requires.txt +16 -0
- genos_client-0.1.0/genos_client.egg-info/top_level.txt +3 -0
- genos_client-0.1.0/pyproject.toml +53 -0
- genos_client-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 qiupinghust
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: genos-client
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Genos API client for accessing genomic analysis services
|
|
5
|
+
Author-email: qiuping1 <qiuping1@genomics.cn>, chenjunhong <chenjunhong@genomics.cn>, tianyongjing <tianyongjing@genomics.cn>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/BGI-HangzhouAI/Genos
|
|
8
|
+
Project-URL: Documentation, https://genos-client.readthedocs.io/
|
|
9
|
+
Project-URL: Source, https://github.com/BGI-HangzhouAI/Genos/tree/main/sdk
|
|
10
|
+
Project-URL: Issues, https://github.com/BGI-HangzhouAI/Genos/issues
|
|
11
|
+
Keywords: genomics,variant,prediction,api,client,visualization
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
16
|
+
Requires-Python: >=3.10
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Requires-Dist: requests
|
|
20
|
+
Requires-Dist: numpy
|
|
21
|
+
Requires-Dist: matplotlib
|
|
22
|
+
Requires-Dist: pandas
|
|
23
|
+
Requires-Dist: pyfaidx
|
|
24
|
+
Requires-Dist: pyBigWig
|
|
25
|
+
Requires-Dist: torch
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: black; extra == "dev"
|
|
28
|
+
Requires-Dist: pytest; extra == "dev"
|
|
29
|
+
Requires-Dist: flake8; extra == "dev"
|
|
30
|
+
Provides-Extra: viz
|
|
31
|
+
Requires-Dist: matplotlib; extra == "viz"
|
|
32
|
+
Requires-Dist: pandas; extra == "viz"
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+

|
|
36
|
+
|
|
37
|
+
# Genos
|
|
38
|
+
|
|
39
|
+
[**Get API key**](#get-api-key) |
|
|
40
|
+
[**Quick start**](#quick-start)
|
|
41
|
+
|
|
42
|
+
**Genos** is a Python SDK for accessing genomic analysis models through the GeneOS platform. It provides a unified interface for variant pathogenicity prediction, DNA sequence embedding extraction, RNA-seq coverage track prediction, and genomic visualization.
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
## Features
|
|
46
|
+
|
|
47
|
+
- 🧬 **Variant Prediction**: Assess pathogenicity of genetic variants
|
|
48
|
+
- 🔬 **Embedding Extraction**: Extract deep learning embeddings from DNA sequences
|
|
49
|
+
- 🧪 **RNA-seq Coverage Track Prediction**: Predict RNA-seq coverage tracks from genomic coordinates
|
|
50
|
+
- 📊 **Genomic Visualization**: Plot and analyze genomic tracks
|
|
51
|
+
- 🚀 **Easy to Use**: Simple, intuitive API with comprehensive error handling
|
|
52
|
+
- 🔐 **Robust Authentication**: Automatic token validation and payment checking
|
|
53
|
+
- ⚠️ **Comprehensive Error Handling**: Specific exceptions for different error types
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
## Get API Key
|
|
58
|
+
|
|
59
|
+
To use Genos, you need an API key from the DCS Cloud.
|
|
60
|
+
|
|
61
|
+
### Request Access
|
|
62
|
+
1. Log in to the [DCS Clould](https://cloud.stomics.tech/#/login) and navigate to **Personal Center → API Key Management**.
|
|
63
|
+
2. Click **“Create API Key”**.
|
|
64
|
+
3. Read the **“API Usage Notice”** and confirm your agreement.
|
|
65
|
+
4. The system will automatically generate your exclusive API Key — **copy and keep it safe**.
|
|
66
|
+
> ⚠️ Please store your key securely and avoid any unauthorized disclosure.
|
|
67
|
+
|
|
68
|
+
### Usage Policy
|
|
69
|
+
* The API Key is **for personal use only** — sharing, transferring, or publishing is strictly prohibited.
|
|
70
|
+
* If the key is **leaked, misused, or used for illegal purposes**, the platform reserves the right to **immediately disable it**.
|
|
71
|
+
* You can **manually deactivate** your key in the control panel at any time.
|
|
72
|
+
|
|
73
|
+
## Installation
|
|
74
|
+
### Install from Source
|
|
75
|
+
```bash
|
|
76
|
+
git clone https://github.com/BGI-HangzhouAI/Genos.git
|
|
77
|
+
cd sdk
|
|
78
|
+
pip install -e .
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Install from Pypi
|
|
82
|
+
```bash
|
|
83
|
+
pip install genos
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Requirements
|
|
87
|
+
|
|
88
|
+
- Python 3.8 or higher
|
|
89
|
+
- pip package manager
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
## Quick Start
|
|
94
|
+
|
|
95
|
+
### Basic Usage
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
from genos import create_client
|
|
99
|
+
|
|
100
|
+
# Create client (uses GENOS_API_TOKEN environment variable)
|
|
101
|
+
client = create_client()
|
|
102
|
+
|
|
103
|
+
# Or provide token explicitly
|
|
104
|
+
client = create_client(token="your_api_token_here")
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### 1. Variant Pathogenicity Prediction
|
|
108
|
+
|
|
109
|
+
Predict whether a genetic variant is pathogenic or benign:
|
|
110
|
+
|
|
111
|
+
```python
|
|
112
|
+
# Predict variant pathogenicity
|
|
113
|
+
result = client.variant_predict("hg19", "chr6", 51484075, "T", "G")['result']
|
|
114
|
+
|
|
115
|
+
print(f"Variant: {result['variant']}")
|
|
116
|
+
print(f"Prediction: {result['prediction']}")
|
|
117
|
+
print(f"Pathogenic Score: {result['score_Pathogenic']:.4f}")
|
|
118
|
+
print(f"Benign Score: {result['score_Benign']:.4f}")
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### 2. DNA Sequence Embedding Extraction
|
|
122
|
+
|
|
123
|
+
Extract deep learning embeddings from DNA sequences:
|
|
124
|
+
|
|
125
|
+
```python
|
|
126
|
+
# Extract embedding for a single sequence
|
|
127
|
+
sequence = "ATCGATCGATCGATCGATCGATCGATCG"
|
|
128
|
+
result = client.get_embedding(sequence, model_name="Genos-1.2B")['result']
|
|
129
|
+
|
|
130
|
+
print(f"Sequence Length: {result['sequence_length']}")
|
|
131
|
+
print(f"Embedding Dimension: {result['embedding_dim']}")
|
|
132
|
+
print(f"Embedding Shape: {result['embedding_shape']}")
|
|
133
|
+
|
|
134
|
+
# Access the embedding vector
|
|
135
|
+
embedding_vector = result['embedding'] # List of floats
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**Available Models:**
|
|
139
|
+
- `Genos-1.2B`: 1.2 billion parameter model
|
|
140
|
+
- `Genos-10B`: 10 billion parameter model
|
|
141
|
+
|
|
142
|
+
**Pooling Methods:**
|
|
143
|
+
- `mean`: Average pooling across sequence
|
|
144
|
+
- `max`: Max pooling
|
|
145
|
+
- `last`: Use last token embedding
|
|
146
|
+
- `none`: Return all token embeddings
|
|
147
|
+
|
|
148
|
+
### 3. RNA-seq Coverage Track Prediction
|
|
149
|
+
|
|
150
|
+
Predict RNA-seq coverage tracks based on genomic coordinates:
|
|
151
|
+
|
|
152
|
+
```python
|
|
153
|
+
# Predict RNA-seq coverage track
|
|
154
|
+
result = client.rna_coverage_track_pred(chrom="chr6", start_pos=51484075)['result']
|
|
155
|
+
|
|
156
|
+
print(f"Predicted coverage track: {result}")
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
## Advanced Configuration
|
|
161
|
+
|
|
162
|
+
### Custom Embedding Service
|
|
163
|
+
|
|
164
|
+
GenosClient allows users to configure a **custom embedding API endpoint**.
|
|
165
|
+
This is useful if you want to deploy your own embedding service locally or within your organization.
|
|
166
|
+
|
|
167
|
+
**Note:** Now, the variant prediction and RNA-seq coverage track prediction models are **not open-source** and cannot be self-hosted. Only the embedding service can be customized.
|
|
168
|
+
|
|
169
|
+
```python
|
|
170
|
+
from genos import GenosClient
|
|
171
|
+
|
|
172
|
+
# Initialize the client with a custom embedding endpoint
|
|
173
|
+
client = GenosClient(
|
|
174
|
+
token="your_custom_token", # Your token for authenticating with your own embedding service
|
|
175
|
+
api_map={
|
|
176
|
+
# Only the embedding service can be customized
|
|
177
|
+
"embedding": "https://custom-embed-api.example.com/predict"
|
|
178
|
+
}
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
# Calls to variant and RNA APIs will still use the official hosted services
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Timeout Configuration
|
|
185
|
+
|
|
186
|
+
Adjust request timeout for long-running operations:
|
|
187
|
+
|
|
188
|
+
```python
|
|
189
|
+
# Set 60-second timeout
|
|
190
|
+
client = create_client(token="your_token", timeout=60)
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Error Handling
|
|
194
|
+
|
|
195
|
+
Genos provides comprehensive error handling with specific exception types for different scenarios. All API responses follow a consistent format.
|
|
196
|
+
|
|
197
|
+
### Error Response Format
|
|
198
|
+
|
|
199
|
+
All error responses from the Genos API follow this structure:
|
|
200
|
+
|
|
201
|
+
```json
|
|
202
|
+
{
|
|
203
|
+
"result": {},
|
|
204
|
+
"status": "<HTTP_STATUS_CODE>",
|
|
205
|
+
"messages": "<ERROR_MESSAGE>"
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### Common Error Codes
|
|
210
|
+
|
|
211
|
+
| Status Code | Error Message | Description |
|
|
212
|
+
|-------------|---------------|-------------|
|
|
213
|
+
| 400 | Insufficient balance | Your account balance is insufficient for the requested operation |
|
|
214
|
+
| 401 | Invalid API Key | The provided API key is invalid or expired |
|
|
215
|
+
| 500 | Internal server error | An unexpected error occurred on the server side |
|
|
216
|
+
|
|
217
|
+
## Examples
|
|
218
|
+
|
|
219
|
+
Complete examples are available in the [`examples/`](examples/) directory:
|
|
220
|
+
|
|
221
|
+
- [`predict_variant.py`](examples/predict_variant.py): Variant pathogenicity prediction
|
|
222
|
+
- [`embedding_extract.py`](examples/embedding_extract.py): DNA Sequence Embedding Extraction
|
|
223
|
+
- [`rna_generator.py`](examples/rna_generator.py): RNA-seq Coverage Track Prediction
|
|
224
|
+
- [`error_handling_demo.py`](examples/error_handling_demo.py): Comprehensive error handling examples
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
## Primary Paper(**Replace with real information**)
|
|
229
|
+
|
|
230
|
+
xxx, xxx, *et al.*
|
|
231
|
+
*Genos: A Unified Foundation Model for Genomic Sequence Understanding and Variant Interpretation.(ju)*
|
|
232
|
+
_GigaScience_, 2025.
|
|
233
|
+
[https://doi.org/10.xxxx/genos.2025.12345](https://doi.org/10.xxxx/genos.2025.12345)
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
## How to Cite (**Replace with real information**)
|
|
237
|
+
|
|
238
|
+
If you use the SDK, please include the following citation in your work:
|
|
239
|
+
|
|
240
|
+
```bibtex
|
|
241
|
+
@article{he2025genos,
|
|
242
|
+
title = {Genos: A Unified Foundation Model for Genomic Sequence Understanding and Variant Interpretation},
|
|
243
|
+
author = {xxx},
|
|
244
|
+
journal = {GigaSience},
|
|
245
|
+
year = {2025},
|
|
246
|
+
doi = {10.xxxx/genos.2025.12345}
|
|
247
|
+
}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# Genos
|
|
4
|
+
|
|
5
|
+
[**Get API key**](#get-api-key) |
|
|
6
|
+
[**Quick start**](#quick-start)
|
|
7
|
+
|
|
8
|
+
**Genos** is a Python SDK for accessing genomic analysis models through the GeneOS platform. It provides a unified interface for variant pathogenicity prediction, DNA sequence embedding extraction, RNA-seq coverage track prediction, and genomic visualization.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- 🧬 **Variant Prediction**: Assess pathogenicity of genetic variants
|
|
14
|
+
- 🔬 **Embedding Extraction**: Extract deep learning embeddings from DNA sequences
|
|
15
|
+
- 🧪 **RNA-seq Coverage Track Prediction**: Predict RNA-seq coverage tracks from genomic coordinates
|
|
16
|
+
- 📊 **Genomic Visualization**: Plot and analyze genomic tracks
|
|
17
|
+
- 🚀 **Easy to Use**: Simple, intuitive API with comprehensive error handling
|
|
18
|
+
- 🔐 **Robust Authentication**: Automatic token validation and payment checking
|
|
19
|
+
- ⚠️ **Comprehensive Error Handling**: Specific exceptions for different error types
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## Get API Key
|
|
24
|
+
|
|
25
|
+
To use Genos, you need an API key from the DCS Cloud.
|
|
26
|
+
|
|
27
|
+
### Request Access
|
|
28
|
+
1. Log in to the [DCS Clould](https://cloud.stomics.tech/#/login) and navigate to **Personal Center → API Key Management**.
|
|
29
|
+
2. Click **“Create API Key”**.
|
|
30
|
+
3. Read the **“API Usage Notice”** and confirm your agreement.
|
|
31
|
+
4. The system will automatically generate your exclusive API Key — **copy and keep it safe**.
|
|
32
|
+
> ⚠️ Please store your key securely and avoid any unauthorized disclosure.
|
|
33
|
+
|
|
34
|
+
### Usage Policy
|
|
35
|
+
* The API Key is **for personal use only** — sharing, transferring, or publishing is strictly prohibited.
|
|
36
|
+
* If the key is **leaked, misused, or used for illegal purposes**, the platform reserves the right to **immediately disable it**.
|
|
37
|
+
* You can **manually deactivate** your key in the control panel at any time.
|
|
38
|
+
|
|
39
|
+
## Installation
|
|
40
|
+
### Install from Source
|
|
41
|
+
```bash
|
|
42
|
+
git clone https://github.com/BGI-HangzhouAI/Genos.git
|
|
43
|
+
cd sdk
|
|
44
|
+
pip install -e .
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Install from Pypi
|
|
48
|
+
```bash
|
|
49
|
+
pip install genos
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Requirements
|
|
53
|
+
|
|
54
|
+
- Python 3.8 or higher
|
|
55
|
+
- pip package manager
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
## Quick Start
|
|
60
|
+
|
|
61
|
+
### Basic Usage
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
from genos import create_client
|
|
65
|
+
|
|
66
|
+
# Create client (uses GENOS_API_TOKEN environment variable)
|
|
67
|
+
client = create_client()
|
|
68
|
+
|
|
69
|
+
# Or provide token explicitly
|
|
70
|
+
client = create_client(token="your_api_token_here")
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### 1. Variant Pathogenicity Prediction
|
|
74
|
+
|
|
75
|
+
Predict whether a genetic variant is pathogenic or benign:
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
# Predict variant pathogenicity
|
|
79
|
+
result = client.variant_predict("hg19", "chr6", 51484075, "T", "G")['result']
|
|
80
|
+
|
|
81
|
+
print(f"Variant: {result['variant']}")
|
|
82
|
+
print(f"Prediction: {result['prediction']}")
|
|
83
|
+
print(f"Pathogenic Score: {result['score_Pathogenic']:.4f}")
|
|
84
|
+
print(f"Benign Score: {result['score_Benign']:.4f}")
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 2. DNA Sequence Embedding Extraction
|
|
88
|
+
|
|
89
|
+
Extract deep learning embeddings from DNA sequences:
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
# Extract embedding for a single sequence
|
|
93
|
+
sequence = "ATCGATCGATCGATCGATCGATCGATCG"
|
|
94
|
+
result = client.get_embedding(sequence, model_name="Genos-1.2B")['result']
|
|
95
|
+
|
|
96
|
+
print(f"Sequence Length: {result['sequence_length']}")
|
|
97
|
+
print(f"Embedding Dimension: {result['embedding_dim']}")
|
|
98
|
+
print(f"Embedding Shape: {result['embedding_shape']}")
|
|
99
|
+
|
|
100
|
+
# Access the embedding vector
|
|
101
|
+
embedding_vector = result['embedding'] # List of floats
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Available Models:**
|
|
105
|
+
- `Genos-1.2B`: 1.2 billion parameter model
|
|
106
|
+
- `Genos-10B`: 10 billion parameter model
|
|
107
|
+
|
|
108
|
+
**Pooling Methods:**
|
|
109
|
+
- `mean`: Average pooling across sequence
|
|
110
|
+
- `max`: Max pooling
|
|
111
|
+
- `last`: Use last token embedding
|
|
112
|
+
- `none`: Return all token embeddings
|
|
113
|
+
|
|
114
|
+
### 3. RNA-seq Coverage Track Prediction
|
|
115
|
+
|
|
116
|
+
Predict RNA-seq coverage tracks based on genomic coordinates:
|
|
117
|
+
|
|
118
|
+
```python
|
|
119
|
+
# Predict RNA-seq coverage track
|
|
120
|
+
result = client.rna_coverage_track_pred(chrom="chr6", start_pos=51484075)['result']
|
|
121
|
+
|
|
122
|
+
print(f"Predicted coverage track: {result}")
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
## Advanced Configuration
|
|
127
|
+
|
|
128
|
+
### Custom Embedding Service
|
|
129
|
+
|
|
130
|
+
GenosClient allows users to configure a **custom embedding API endpoint**.
|
|
131
|
+
This is useful if you want to deploy your own embedding service locally or within your organization.
|
|
132
|
+
|
|
133
|
+
**Note:** Now, the variant prediction and RNA-seq coverage track prediction models are **not open-source** and cannot be self-hosted. Only the embedding service can be customized.
|
|
134
|
+
|
|
135
|
+
```python
|
|
136
|
+
from genos import GenosClient
|
|
137
|
+
|
|
138
|
+
# Initialize the client with a custom embedding endpoint
|
|
139
|
+
client = GenosClient(
|
|
140
|
+
token="your_custom_token", # Your token for authenticating with your own embedding service
|
|
141
|
+
api_map={
|
|
142
|
+
# Only the embedding service can be customized
|
|
143
|
+
"embedding": "https://custom-embed-api.example.com/predict"
|
|
144
|
+
}
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
# Calls to variant and RNA APIs will still use the official hosted services
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Timeout Configuration
|
|
151
|
+
|
|
152
|
+
Adjust request timeout for long-running operations:
|
|
153
|
+
|
|
154
|
+
```python
|
|
155
|
+
# Set 60-second timeout
|
|
156
|
+
client = create_client(token="your_token", timeout=60)
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Error Handling
|
|
160
|
+
|
|
161
|
+
Genos provides comprehensive error handling with specific exception types for different scenarios. All API responses follow a consistent format.
|
|
162
|
+
|
|
163
|
+
### Error Response Format
|
|
164
|
+
|
|
165
|
+
All error responses from the Genos API follow this structure:
|
|
166
|
+
|
|
167
|
+
```json
|
|
168
|
+
{
|
|
169
|
+
"result": {},
|
|
170
|
+
"status": "<HTTP_STATUS_CODE>",
|
|
171
|
+
"messages": "<ERROR_MESSAGE>"
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Common Error Codes
|
|
176
|
+
|
|
177
|
+
| Status Code | Error Message | Description |
|
|
178
|
+
|-------------|---------------|-------------|
|
|
179
|
+
| 400 | Insufficient balance | Your account balance is insufficient for the requested operation |
|
|
180
|
+
| 401 | Invalid API Key | The provided API key is invalid or expired |
|
|
181
|
+
| 500 | Internal server error | An unexpected error occurred on the server side |
|
|
182
|
+
|
|
183
|
+
## Examples
|
|
184
|
+
|
|
185
|
+
Complete examples are available in the [`examples/`](examples/) directory:
|
|
186
|
+
|
|
187
|
+
- [`predict_variant.py`](examples/predict_variant.py): Variant pathogenicity prediction
|
|
188
|
+
- [`embedding_extract.py`](examples/embedding_extract.py): DNA Sequence Embedding Extraction
|
|
189
|
+
- [`rna_generator.py`](examples/rna_generator.py): RNA-seq Coverage Track Prediction
|
|
190
|
+
- [`error_handling_demo.py`](examples/error_handling_demo.py): Comprehensive error handling examples
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
## Primary Paper(**Replace with real information**)
|
|
195
|
+
|
|
196
|
+
xxx, xxx, *et al.*
|
|
197
|
+
*Genos: A Unified Foundation Model for Genomic Sequence Understanding and Variant Interpretation.(ju)*
|
|
198
|
+
_GigaScience_, 2025.
|
|
199
|
+
[https://doi.org/10.xxxx/genos.2025.12345](https://doi.org/10.xxxx/genos.2025.12345)
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
## How to Cite (**Replace with real information**)
|
|
203
|
+
|
|
204
|
+
If you use the SDK, please include the following citation in your work:
|
|
205
|
+
|
|
206
|
+
```bibtex
|
|
207
|
+
@article{he2025genos,
|
|
208
|
+
title = {Genos: A Unified Foundation Model for Genomic Sequence Understanding and Variant Interpretation},
|
|
209
|
+
author = {xxx},
|
|
210
|
+
journal = {GigaSience},
|
|
211
|
+
year = {2025},
|
|
212
|
+
doi = {10.xxxx/genos.2025.12345}
|
|
213
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Configuration file for the Sphinx documentation builder
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import sys
|
|
5
|
+
from datetime import datetime
|
|
6
|
+
from sphinx.ext.autodoc import between
|
|
7
|
+
|
|
8
|
+
# -- Path setup --------------------------------------------------------------
|
|
9
|
+
# Add the project root to sys.path so Sphinx can find modules
|
|
10
|
+
sys.path.insert(0, os.path.abspath('../..')) # Assuming docs/ is inside genos/docs/
|
|
11
|
+
|
|
12
|
+
# -- Project information -----------------------------------------------------
|
|
13
|
+
project = 'Genos SDK'
|
|
14
|
+
author = 'Genos Team'
|
|
15
|
+
copyright = f'{datetime.now().year}, {author}'
|
|
16
|
+
release = '0.1.0'
|
|
17
|
+
|
|
18
|
+
# -- General configuration ---------------------------------------------------
|
|
19
|
+
extensions = [
|
|
20
|
+
'sphinx.ext.autodoc', # Automatically generate documentation from docstrings
|
|
21
|
+
'sphinx.ext.viewcode', # Add links to highlighted source code
|
|
22
|
+
'sphinx.ext.napoleon', # Support for Google/NumPy style docstrings
|
|
23
|
+
'sphinx.ext.todo', # Support for TODO directives
|
|
24
|
+
'sphinx.ext.autosummary', # Generate API summary automatically
|
|
25
|
+
'myst_parser', # Support Markdown files
|
|
26
|
+
'nbsphinx', # Support Jupyter Notebooks
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
# Recognized source file suffixes
|
|
30
|
+
source_suffix = {
|
|
31
|
+
'.rst': 'restructuredtext',
|
|
32
|
+
'.md': 'markdown',
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
# Automatically generate summary tables
|
|
36
|
+
autosummary_generate = True
|
|
37
|
+
autodoc_default_options = {
|
|
38
|
+
'members': True,
|
|
39
|
+
'undoc-members': True,
|
|
40
|
+
'private-members': False,
|
|
41
|
+
'special-members': '__init__',
|
|
42
|
+
'inherited-members': True,
|
|
43
|
+
'show-inheritance': True,
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
# Notebook execution settings
|
|
48
|
+
nbsphinx_execute = 'never' # Do not execute notebook cells
|
|
49
|
+
nbsphinx_allow_errors = True # Ignore execution errors
|
|
50
|
+
|
|
51
|
+
# Avoid adding module names as prefixes to class names
|
|
52
|
+
add_module_names = False
|
|
53
|
+
|
|
54
|
+
# Autodoc default options
|
|
55
|
+
autodoc_default_options = {
|
|
56
|
+
'members': True,
|
|
57
|
+
'undoc-members': True,
|
|
58
|
+
'show-inheritance': True,
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
# Do not add "View page source" link at the top
|
|
62
|
+
html_show_sourcelink = False
|
|
63
|
+
|
|
64
|
+
# Source code view settings
|
|
65
|
+
viewcode_follow_imported_members = False
|
|
66
|
+
|
|
67
|
+
# Enable TODOs in the documentation
|
|
68
|
+
todo_include_todos = True
|
|
69
|
+
|
|
70
|
+
# -- Options for HTML output -------------------------------------------------
|
|
71
|
+
html_theme = 'sphinx_rtd_theme'
|
|
72
|
+
html_theme_options = {
|
|
73
|
+
'collapse_navigation': False,
|
|
74
|
+
'navigation_depth': 4,
|
|
75
|
+
'style_nav_header_background': '#343131',
|
|
76
|
+
}
|
|
77
|
+
html_static_path = ['_static']
|
|
78
|
+
|
|
79
|
+
# -- Autodoc settings --------------------------------------------------------
|
|
80
|
+
autoclass_content = 'class' # Show only the class docstring, not __init__
|
|
81
|
+
autodoc_member_order = 'bysource' # Display members in source code order
|
|
82
|
+
|
|
83
|
+
# -- Suppress specific warnings ----------------------------------------------
|
|
84
|
+
suppress_warnings = [
|
|
85
|
+
'toc.not_readable',
|
|
86
|
+
]
|
|
87
|
+
|
|
88
|
+
# -- Napoleon settings ------------------------------------------------------
|
|
89
|
+
napoleon_google_docstring = True
|
|
90
|
+
napoleon_numpy_docstring = True
|
|
91
|
+
napoleon_include_init_with_doc = False
|
|
92
|
+
napoleon_use_ivar = True
|
|
93
|
+
napoleon_use_param = True
|
|
94
|
+
napoleon_use_rtype = True
|
|
95
|
+
|
|
96
|
+
# -- Custom docstring processing --------------------------------------------
|
|
97
|
+
# Remove unnecessary metadata lines like @File, @Author, @Date, @Desc
|
|
98
|
+
def process_docstring(app, what, name, obj, options, lines):
|
|
99
|
+
filtered = [
|
|
100
|
+
line for line in lines
|
|
101
|
+
if not line.startswith(("@File", "@Author", "@Mail", "@Date", "@Desc"))
|
|
102
|
+
]
|
|
103
|
+
lines[:] = filtered
|
|
104
|
+
|
|
105
|
+
def setup(app):
|
|
106
|
+
app.connect("autodoc-process-docstring", process_docstring)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
from .client import GenosClient
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def create_client(token: str = None, timeout: int = 30) -> GenosClient:
|
|
7
|
+
"""
|
|
8
|
+
Factory function to create a GenosClient instance.
|
|
9
|
+
|
|
10
|
+
Example:
|
|
11
|
+
>>> from genos import create_client
|
|
12
|
+
>>> client = create_client(token="your_token")
|
|
13
|
+
>>> result = client.variant_predict("hg19", "chr6", 51484075, "T", "G")
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
token (str, optional): API access token. Default: None.
|
|
17
|
+
base_url (str, optional): Base URL of the Genos service.
|
|
18
|
+
Defaults to environment variable GENOS_API_URL or "http://localhost:5000".
|
|
19
|
+
timeout (int, optional): Request timeout in seconds. Default: 30.
|
|
20
|
+
|
|
21
|
+
Returns:
|
|
22
|
+
GenosClient: A configured client instance ready to make API calls.
|
|
23
|
+
"""
|
|
24
|
+
return GenosClient(token=token, timeout=timeout)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
__all__ = ["GenosClient", "create_client"]
|
|
28
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
# api/__init__.py
|
|
4
|
+
|
|
5
|
+
"""
|
|
6
|
+
Genos API subpackage.
|
|
7
|
+
|
|
8
|
+
This package contains modules that wrap individual Genos API endpoints:
|
|
9
|
+
- HealthAPI: /health endpoint
|
|
10
|
+
- VariantPredictorAPI: /predict endpoint
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from .health import HealthAPI
|
|
14
|
+
from .variant_predictor import VariantPredictorAPI
|
|
15
|
+
from .embedding_extractor import EmbeddingExtractorAPI
|
|
16
|
+
from .rna_seq_coverage_track_prediction import RNASeqCoverageTrackPredictionAPI
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
__all__ = ["HealthAPI", "VariantPredictorAPI", "EmbeddingExtractorAPI", "RNASeqCoverageTrackPredictionAPI"]
|