Skip to main content

BGE 开放平台 SDK - Python 版

GitHub forks GitHub forks GitHub forks

GitHub release (latest by date) GitHub top language GitHub code size in bytes GitHub commit activity PyPI - Downloads

    ____  ____________   ______  __________  ______  _   __   _____ ____  __ __
   / __ )/ ____/ ____/  / __ \ \/ /_  __/ / / / __ \/ | / /  / ___// __ \/ //_/
  / __  / / __/ __/    / /_/ /\  / / / / /_/ / / / /  |/ /   \__ \/ / / / ,<   
 / /_/ / /_/ / /___   / ____/ / / / / / __  / /_/ / /|  /   ___/ / /_/ / /| |  
/_____/\____/_____/  /_/     /_/ /_/ /_/ /_/\____/_/ |_/   /____/_____/_/ |_| 

BGE 开放平台 是一个跨越多级数据的(多)组学数据平台,开发者在获得用户授权后,将可以通过开放平台提供的 API 访问关联用户的(多)组学数据,甚至写入数据。

基于开放平台 API,开发者可避免重复开发采样、提取、测序和生信分析等繁复的流程,直接使用清洁的结构化数据。

开发者可以通过开放平台提供的 API 创建极具创意性的(多)组学应用,如:

  • 包含药物代谢或药物服用建议的应用
  • 包含体检数据和营养代谢基因的餐饮应用
  • 包含肠道菌群数据和痛风相关基因的痛风管理应用
  • 基于祖源成分的社交网络应用,等等

BGE 开放平台 API 基于 OAuth 2.0 开发,并使用 SSL/TLS 加密传输,确保用户数据正确无误地授权,并安全地传输到第三方应用,确保用户数据不会被未经授权的应用获得。

安装

推荐使用 pip 进行安装。

$ pip install -U bge-python-sdk

或者

$ make install

再或者

$ python setup.py install

SDK 文档

更加详细的 SDK 文档请查看 SDK Documents。

快速开始

BGE 开放平台支持 OAuth2 的两种模式,分别是用户授权模式、客户端模式。

详情请参考开放平台文档 https://api.bge.genomics.cn/doc 。

ENDPOINTS

BGE 开放平台提供了如下可用的 endpoint。

endpoint 解释
https://api.bge.genomics.cn 线上环境 主域名地址
https://api.bge.omgut.com 线上环境 副域名地址,主域名地址不可用时可替换此域名地址

授权码模式

from bgesdk import OAuth2, API

code = '???????'  # 用户确认授权后平台返回的授权码
client_id = 'demo'
client_secret = 'demo'
redirect_uri = 'http://test.cn'
oauth2 = OAuth2(
    client_id, client_secret,
    endpoint='https://api.bge.genomics.cn', max_retries=3, timeout=16,
    verbose=False)
token = oauth2.exchange_authorization_code(code, redirect_uri)

api = oauth2.get_api(token.access_token)
print(api.get_user())

api = API(token.access_token)
print(api.get_user())

客户端模式

from bgesdk import OAuth2, API

client_id = 'demo'
client_secret = 'demo'
oauth2 = OAuth2(
    client_id, client_secret,
    endpoint='https://api.bge.genomics.cn', max_retries=3, timeout=16,
    verbose=False)
token = oauth2.get_credentials_token()

api = oauth2.get_api(token.access_token)
print(api.get_variants('E-B1243433', 'rs333'))

api = API(token.access_token)
print(api.get_variants('E-B1243433', 'rs333'))

Contributors

Release files for bge-python-sdk 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bge-python-sdk 1.0.0
File Size Uploaded
bge-python-sdk-1.0.0.tar.gz 56.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bge-python-sdk 1.0.0
File Interpreter ABI Platform
bge_python_sdk-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 140.3 kB

Release files / bge-python-sdk-1.0.0.tar.gz

Download URL bge-python-sdk-1.0.0.tar.gz
Size 56.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c2b3080bdf18b4692425bc30f2baf03446f9f13966953d9f56c9b6f0976f2781
BLAKE2b-256 checksum
How to use checksums
06d30f92261c9eda1f3c5fde3a489723c6dc0b3a56e2688b0626664b06b30328
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.8.12

Release files / bge_python_sdk-1.0.0-py3-none-any.whl

Download URL bge_python_sdk-1.0.0-py3-none-any.whl
Size 83.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6e4351b17912c41cc19686fc61be4f5cb15b30da3a508da57e6bcba450090516
BLAKE2b-256 checksum
How to use checksums
17320aebb6ff56f6c3190b2810f78c581e797a257762e111e7ff957d3f2a0c02
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.8.12

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.7.0

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

3 release files

0.5.1

2 release files

0.4.0

3 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2

3 release files

0.1.5

3 release files

0.1.4

3 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

3 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page