Genos API client for accessing genomic analysis services
Project description
Genos
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.
Features
- 🧬 Variant Prediction: Assess pathogenicity of genetic variants
- 🔬 Embedding Extraction: Extract deep learning embeddings from DNA sequences
- 🧪 RNA-seq Coverage Track Prediction: Predict RNA-seq coverage tracks from genomic coordinates
- 📊 Genomic Visualization: Plot and analyze genomic tracks
- 🚀 Easy to Use: Simple, intuitive API with comprehensive error handling
- 🔐 Robust Authentication: Automatic token validation and payment checking
- ⚠️ Comprehensive Error Handling: Specific exceptions for different error types
Get API Key
To use Genos, you need an API key from the DCS Cloud.
Request Access
- Log in to the DCS Clould and navigate to Personal Center → API Key Management.
- Click “Create API Key”.
- Read the “API Usage Notice” and confirm your agreement.
- The system will automatically generate your exclusive API Key — copy and keep it safe.
⚠️ Please store your key securely and avoid any unauthorized disclosure.
Usage Policy
- The API Key is for personal use only — sharing, transferring, or publishing is strictly prohibited.
- If the key is leaked, misused, or used for illegal purposes, the platform reserves the right to immediately disable it.
- You can manually deactivate your key in the control panel at any time.
Installation
Install from Source
git clone https://github.com/BGI-HangzhouAI/Genos.git
cd sdk
pip install -e .
Install from Pypi
pip install genos-client
Requirements
- Python 3.10 or higher
- pip package manager
Quick Start
Basic Usage
from genos import create_client
# Create client (uses GENOS_API_TOKEN environment variable)
client = create_client()
# Or provide token explicitly
client = create_client(token="your_api_token_here")
1. Variant Pathogenicity Prediction
Predict whether a genetic variant is pathogenic or benign:
# Predict variant pathogenicity
result = client.variant_predict("hg19", "chr6", 51484075, "T", "G")['result']
print(f"Variant: {result['variant']}")
print(f"Prediction: {result['prediction']}")
print(f"Pathogenic Score: {result['score_Pathogenic']:.4f}")
print(f"Benign Score: {result['score_Benign']:.4f}")
2. DNA Sequence Embedding Extraction
Extract deep learning embeddings from DNA sequences:
# Extract embedding for a single sequence
sequence = "ATCGATCGATCGATCGATCGATCGATCG"
result = client.get_embedding(sequence, model_name="Genos-1.2B")['result']
print(f"Sequence Length: {result['sequence_length']}")
print(f"Embedding Dimension: {result['embedding_dim']}")
print(f"Embedding Shape: {result['embedding_shape']}")
# Access the embedding vector
embedding_vector = result['embedding'] # List of floats
Available Models:
Genos-1.2B: 1.2 billion parameter modelGenos-10B: 10 billion parameter model
Pooling Methods:
mean: Average pooling across sequencemax: Max poolinglast: Use last token embeddingnone: Return all token embeddings
3. RNA-seq Coverage Track Prediction
Predict RNA-seq coverage tracks based on genomic coordinates:
# Predict RNA-seq coverage track
result = client.rna_coverage_track_pred(chrom="chr6", start_pos=51484075)['result']
print(f"Predicted coverage track: {result}")
Advanced Configuration
Custom Embedding Service
GenosClient allows users to configure a custom embedding API endpoint.
This is useful if you want to deploy your own embedding service locally or within your organization.
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.
from genos import GenosClient
# Initialize the client with a custom embedding endpoint
client = GenosClient(
token="your_custom_token", # Your token for authenticating with your own embedding service
api_map={
# Only the embedding service can be customized
"embedding": "https://custom-embed-api.example.com/predict"
}
)
# Calls to variant and RNA APIs will still use the official hosted services
Timeout Configuration
Adjust request timeout for long-running operations:
# Set 60-second timeout
client = create_client(token="your_token", timeout=60)
Error Handling
Genos provides comprehensive error handling with specific exception types for different scenarios. All API responses follow a consistent format.
Error Response Format
All error responses from the Genos API follow this structure:
{
"result": {},
"status": "<HTTP_STATUS_CODE>",
"messages": "<ERROR_MESSAGE>"
}
Common Error Codes
| Status Code | Error Message | Description |
|---|---|---|
| 400 | Insufficient balance | Your account balance is insufficient for the requested operation |
| 401 | Invalid API Key | The provided API key is invalid or expired |
| 500 | Internal server error | An unexpected error occurred on the server side |
Examples
Complete examples are available in the examples/ directory:
predict_variant.py: Variant pathogenicity predictionembedding_extract.py: DNA Sequence Embedding Extractionrna_generator.py: RNA-seq Coverage Track Predictionerror_handling_demo.py: Comprehensive error handling examples
Primary Paper
Genos: A Human-Centric Genomic Foundation Model
Adi Lin¹, Bin Xie¹, Cheng Ye¹,Cheng Wang¹, Duoyuan Chen¹, Ercheng Wang¹, Fanfeng Lu¹, Guirong Xue¹, Haiqiang Zhang¹, Jiajie Zhan¹, Jianfeng Zhang¹, Jiangshuan Pang¹, Jianqiang Liang¹, Jiawei Lin¹, Jiaxin Ma¹, Jie Hu¹, Jing Ma¹,Jingni Dong¹, Jiongzhen Li, Junchen Liu¹, Junhong Chen¹, Junyou Li¹, Kai Ding¹, Kaiwen Deng¹, Kui Chen¹, Lihui Wang¹, Longqi Liu¹, Ling Guo¹, Liwen Xiong¹, Luhao Yang¹, Ming Cheng¹, Nanning Chen¹, Renzhong Chen¹, Shanxin Sun¹, Shaoshuai Li¹, Shicheng Chen¹, Shiping Liu¹, Siwei Xie¹, Suyan Liu¹, Tao Zhou¹, Wangyang Tang¹, Weiqiang Zhang¹, Xianyue Jiang¹, Xianzhi Qi¹, Xin Jin¹, Xinjiang Tan¹, Xinyue Hu¹, Xun Xu¹, Xuyang Feng¹, Yafei Lu¹ ,Yifan Gao¹, Yong Shang¹, Youzhe He¹, Yue Yuan¹, Yufan Wang¹, Yuqi Liu1, Zhan Xiao¹, Zhangyuan Meng¹, Zhaorong Li¹, Zhe Zhao¹, Zheng Yang¹, Zilin Wang¹
GigaScience, 2025.
https://doi.org/10.1093/gigascience/giaf132
How to Cite
If you use the SDK, please include the following citation in your work:
@article{he2025genos,
title = {Genos: A Human-Centric Genomic Foundation Model},
author = {Adi Lin¹, Bin Xie¹, Cheng Ye¹,Cheng Wang¹, Duoyuan Chen¹, Ercheng Wang¹, Fanfeng Lu¹, Guirong Xue¹, Haiqiang Zhang¹, Jiajie Zhan¹, Jianfeng Zhang¹, Jiangshuan Pang¹, Jianqiang Liang¹, Jiawei Lin¹, Jiaxin Ma¹, Jie Hu¹, Jing Ma¹,Jingni Dong¹, Jiongzhen Li, Junchen Liu¹, Junhong Chen¹, Junyou Li¹, Kai Ding¹, Kaiwen Deng¹, Kui Chen¹, Lihui Wang¹, Longqi Liu¹, Ling Guo¹, Liwen Xiong¹, Luhao Yang¹, Ming Cheng¹, Nanning Chen¹, Renzhong Chen¹, Shanxin Sun¹, Shaoshuai Li¹, Shicheng Chen¹, Shiping Liu¹, Siwei Xie¹, Suyan Liu¹, Tao Zhou¹, Wangyang Tang¹, Weiqiang Zhang¹, Xianyue Jiang¹, Xianzhi Qi¹, Xin Jin¹, Xinjiang Tan¹, Xinyue Hu¹, Xun Xu¹, Xuyang Feng¹, Yafei Lu¹ ,Yifan Gao¹, Yong Shang¹, Youzhe He¹, Yue Yuan¹, Yufan Wang¹, Yuqi Liu1, Zhan Xiao¹, Zhangyuan Meng¹, Zhaorong Li¹, Zhe Zhao¹, Zheng Yang¹, Zilin Wang¹},
journal = {GigaSience},
year = {2025},
doi = {10.1093/gigascience/giaf132}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file genos-client-0.1.2.tar.gz.
File metadata
- Download URL: genos-client-0.1.2.tar.gz
- Upload date:
- Size: 72.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9a3c07fc7c9ce638762695e2d808f2c5d0e4115f4ec89773dfdcc9c48fb8652
|
|
| MD5 |
aa21733e70c1b1b480326b64a4c4e514
|
|
| BLAKE2b-256 |
09a86cb579fa9d9921766a391029373b3b785f19431cf40268c45da33e2dbc49
|
File details
Details for the file genos_client-0.1.2-py3-none-any.whl.
File metadata
- Download URL: genos_client-0.1.2-py3-none-any.whl
- Upload date:
- Size: 72.2 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49dade727f5e9258bfef1dd04b5d1c9d1daf333aafd856f1b67bb2d9def5ef76
|
|
| MD5 |
732d868ad6a91ad99ffe7db1c6757911
|
|
| BLAKE2b-256 |
025e83d55c703ab7515f9ec0f9f8311d9dd45374940005ffe8f3cbdd9c3a4e4e
|