生信云平台 Python SDK,提供图表上传和文件存储功能
Project description
Lims2 SDK
生信云平台 Python SDK,提供图表上传和文件存储功能。
当前版本: v0.4.0
功能特性
- 图表服务:支持 Plotly、Cytoscape、图片、PDF 格式上传
- 文件存储:通过 STS 凭证上传文件到阿里云 OSS,支持断点续传
- 命令行工具:提供便捷的 CLI 命令
- 精度控制:使用 decimal 库精确四舍五入,默认保留3位小数,减少 JSON 文件大小(可减少 15-60%)
安装配置
推荐方式:从 PyPI 安装
pip install lims2-sdk
设置环境变量:
export LIMS2_API_URL="your-api"
export LIMS2_API_TOKEN="your-api-token"
命令行使用
** 详细参数说明使用 --help 查询 **
图表上传
# 上传图表文件(完整参数示例)
lims2 chart upload plot.json -p proj_001 -n "基因表达分析" -s sample_001 -t heatmap -d "差异表达热图" -c A_vs_B -a Expression_statistics --precision 3
文件存储
# 上传单个文件(完整参数示例)
lims2 storage upload results.csv -p proj_001 -a Expression_statistics -c results -s sample_001 -d "差异表达结果"
# 上传目录
lims2 storage upload-dir output/ -p proj_001 -a qc_analysis -c results -s sample_001
Python SDK 使用
from lims2 import Lims2Client
# 初始化客户端
client = Lims2Client()
# 上传图表(完整参数示例)
client.chart.upload(
data_source="plot.json", # 图表数据源:字典、文件路径或 Path 对象
project_id="proj_001", # 项目 ID(必需)
chart_name="基因表达分析", # 图表名称(必需)
sample_id="sample_001", # 样本 ID(可选)
chart_type="heatmap", # 图表类型(可选)
description="差异表达基因热图", # 图表描述(可选)
contrast="A_vs_B", # 对比策略(可选)
analysis_node="Expression_statistics", # 分析节点名称(可选)
precision=3 # 浮点数精度:0-10位小数(默认3)
)
# 上传文件(完整参数示例)
client.storage.upload_file(
file_path="results.csv", # 文件路径(必需)
project_id="proj_001", # 项目 ID(必需)
analysis_node="Expression_statistics", # 分析节点名称(必需)
file_category="results", # 文件分类(必需)
sample_id="sample_001", # 样本 ID(可选)
description="差异表达结果文件", # 文件描述(可选)
progress_callback=lambda consumed, total: print(f"进度: {consumed/total*100:.1f}%") # 进度回调函数(可选)
)
# 上传目录
client.storage.upload_directory(
dir_path="output/", # 目录路径(必需)
project_id="proj_001", # 项目 ID(必需)
analysis_node="qc_analysis", # 分析节点名称(必需)
file_category="results", # 文件分类(必需)
sample_id="sample_001", # 样本 ID(可选)
recursive=True # 是否递归上传子目录(默认 True)
)
支持的数据格式
图表格式
- Plotly: 包含
data和layout字段的字典 - Cytoscape: 包含
elements或nodes+edges字段的字典 - 图片: PNG, JPG, JPEG, SVG
- 其他: PDF
文件格式
- 支持任意格式的文件上传
- 自动处理大文件(>10MB)的断点续传
- 提供进度回调支持
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 lims2_sdk-0.4.0.tar.gz.
File metadata
- Download URL: lims2_sdk-0.4.0.tar.gz
- Upload date:
- Size: 23.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed64afb977b55c91c59a4cc8f5f32a0d0ff14ba3fc5875810ba2ca6ea100432f
|
|
| MD5 |
1e39902f7104c86e73793670f4904a09
|
|
| BLAKE2b-256 |
95e70d7ec4175345b19eb1d5cc37d1d2ac9f4c465622ea6a9ed20deca5a0d78f
|
Provenance
The following attestation bundles were made for lims2_sdk-0.4.0.tar.gz:
Publisher:
python-publish.yml on huangzhibo/lims2-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lims2_sdk-0.4.0.tar.gz -
Subject digest:
ed64afb977b55c91c59a4cc8f5f32a0d0ff14ba3fc5875810ba2ca6ea100432f - Sigstore transparency entry: 311827342
- Sigstore integration time:
-
Permalink:
huangzhibo/lims2-sdk@c005131d28e2bb456d4055de0146b99a9bbe7156 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/huangzhibo
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@c005131d28e2bb456d4055de0146b99a9bbe7156 -
Trigger Event:
release
-
Statement type:
File details
Details for the file lims2_sdk-0.4.0-py3-none-any.whl.
File metadata
- Download URL: lims2_sdk-0.4.0-py3-none-any.whl
- Upload date:
- Size: 20.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e65c3d18070eee555e66f53f7ea0c352d6e04b2ff7359bd56cdc907bd1fca18f
|
|
| MD5 |
0d103806bea9b61e6e0e8689dea6b916
|
|
| BLAKE2b-256 |
073013ffa9b8e422b8ae7c9a338285e9ff95f30bc67d9506d9fd590e924f9336
|
Provenance
The following attestation bundles were made for lims2_sdk-0.4.0-py3-none-any.whl:
Publisher:
python-publish.yml on huangzhibo/lims2-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lims2_sdk-0.4.0-py3-none-any.whl -
Subject digest:
e65c3d18070eee555e66f53f7ea0c352d6e04b2ff7359bd56cdc907bd1fca18f - Sigstore transparency entry: 311827356
- Sigstore integration time:
-
Permalink:
huangzhibo/lims2-sdk@c005131d28e2bb456d4055de0146b99a9bbe7156 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/huangzhibo
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@c005131d28e2bb456d4055de0146b99a9bbe7156 -
Trigger Event:
release
-
Statement type: