
完整開發者指南
透過我們的 Python SDK 和 REST API,將強大的 DNA 序列分析和變異效應預測整合到您的應用程式中。
幾分鐘內即可開始使用 AlphaGenome
使用 pip 安裝 Python 套件
pip install dr7-alphagenome設定您的身份驗證憑證
export DR7_API_KEY=your_key從命令列進行首次預測
alphagenome predict seq.fafrom dr7_alphagenome import AlphaGenome
# Initialize the client
client = AlphaGenome(api_key="your_api_key")
# Predict from DNA sequence
sequence = "ATCGATCG..." * 125000 # 1Mb sequence
results = client.predict(
sequence=sequence,
modalities=["CAGE", "ATAC", "ChIP"],
cell_types=["K562", "HepG2"]
)
# Get variant effect predictions
variant_effect = client.score_variant(
chromosome="chr1",
position=12345,
ref="A",
alt="G"
)
print(f"Variant effect score: {variant_effect.score}")
print(f"Affected tracks: {variant_effect.top_affected_tracks}")用於全面基因體分析的強大端點
POST /v1/alphagenome/predict
從原始 DNA 序列預測功能效應。傳回涵蓋基因表現、染色質可及性等 5,930 個軌道的預測結果。
POST /v1/alphagenome/variant
評估遺傳變異的功能影響。比較參考對偶基因和替代對偶基因的預測以量化變異效應。
POST /v1/alphagenome/batch
在單一請求中處理多個序列或變異。非常適合 VCF 檔案或全基因體研究。
GET /v1/alphagenome/region
查詢特定基因體區域的預測。適用於在基因體瀏覽器中視覺化預測結果。
透過這些常見用例學習
from dr7_alphagenome import AlphaGenome
client = AlphaGenome()
# Load sequence from FASTA file
results = client.predict_from_fasta(
"input.fa",
modalities=["CAGE", "ATAC", "DNase", "H3K27ac"],
output_format="bigwig"
)
# Results are saved as BigWig files for visualization
for track in results.tracks:
print(f"Saved: {track.output_path}")from dr7_alphagenome import AlphaGenome
client = AlphaGenome()
# Score a single variant
effect = client.score_variant(
chromosome="chr17",
position=7674220, # Near TP53 gene
ref="G",
alt="A",
window_size=100000 # Context around variant
)
print(f"Overall effect score: {effect.score:.4f}")
print(f"Gene expression change: {effect.expression_delta:.4f}")
print("Top affected cell types:")
for ct in effect.top_cell_types[:5]:
print(f" {ct.name}: {ct.score:.4f}")from dr7_alphagenome import AlphaGenome
client = AlphaGenome()
# Score variants from VCF file
results = client.score_vcf(
"variants.vcf",
reference="hg38",
output_file="scored_variants.tsv",
include_tracks=["CAGE", "enhancer_activity"],
parallel=True
)
print(f"Scored {results.total_variants} variants")
print(f"High-impact variants: {results.high_impact_count}")
# Filter for regulatory variants
regulatory = results.filter(
min_score=0.5,
affected_elements=["enhancer", "promoter"]
)
regulatory.to_dataframe().to_csv("regulatory_variants.csv")# REST API Example with curl
# Predict from sequence
curl -X POST https://api.dr7.ai/v1/alphagenome/predict \
-H "Authorization: Bearer $DR7_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"sequence": "ATCGATCG...",
"modalities": ["CAGE", "ATAC"],
"cell_types": ["K562"]
}'
# Score variant
curl -X POST https://api.dr7.ai/v1/alphagenome/variant \
-H "Authorization: Bearer $DR7_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"chromosome": "chr1",
"position": 12345,
"ref": "A",
"alt": "G"
}'向我們的 AI 助理尋求程式碼範例、疑難排解或整合問題的幫助
體驗基因組學 AI
最佳化您的 AlphaGenome API 使用
平衡上下文長度與處理時間以獲得最佳結果。
選擇相關的細胞類型以聚焦您的分析。
使用批次端點高效處理大型資料集。
透過適當的錯誤處理建立穩健的應用程式。
關於 AlphaGenome API 的常見技術問題
免費版:100 次請求/天。標準版:10,000 次請求/天。專業版:100,000 次請求/天。企業版:可自訂限制。所有 API 回應中都包含速率限制標頭。
API 接受原始 DNA 序列(A、T、C、G 字元)、FASTA 格式、基因體座標(hg38)以及用於批次變異評分的 VCF 檔案。序列長度最多可達 1Mb。
對於超過 1Mb 的序列,將它們分成重疊的視窗並合併預測。SDK 提供了 sliding_window() 輔助函式,可自動處理此操作。
JSON(預設)用於程式化存取,BigWig 用於基因體瀏覽器視覺化,BedGraph 用於基於文字的分析,TSV 用於表格輸出。批次工作還可以輸出壓縮檔案。
使用 Bearer 權杖和您的 API 金鑰進行身份驗證。設定 DR7_API_KEY 環境變數或直接將其傳遞給用戶端建構函式。API 金鑰可在您的 Dr7.ai 控制台中管理。
有!使用 'pip install dr7-alphagenome' 安裝。SDK 為所有 API 端點提供高階介面、自動重試、串流支援和常見工作流程的輔助函式。