tiledbvcf
它能做什么
这个工具用于整理和检索基因变异数据。它适合高效存储 DNA 信息并快速查询,尤其适用于大规模基因组数据集。
适用场景
- ✓你有大量来自不同样本的基因数据(VCF/BCF),并想对其进行整理时。
- ✓需要在特定 DNA 区域或特定样本中搜索基因信息时。
- ✓需要导出部分基因数据用于进一步分析时。
技能链接
https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/tiledbvcf/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“为样本 S1 和 S2 整理区域 chr1:1000-2000 的基因数据。”
每周 5 个新技能,1 分钟读完。
工作原理
工具会把基因数据存储为一种名为 TileDB 的优化格式。这样,AI 就能比使用传统基因文件更快地访问和提取特定信息。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
TileDB-VCF
When to use
Use for cohort variant storage, incremental sample ingestion, interval queries, and exporting subsets for downstream genomics. TileDB-VCF stores records; it does not perform joint variant calling, association testing, normalization, or population structure adjustment. Dataset size alone does not determine whether cloud execution is appropriate: benchmark the intended sample, region, and attribute workload.
This skill targets released TileDB-VCF 0.40.3. Native Python/CLI checks used two synthetic single-sample VCFs on macOS ARM64. Cloud client 0.14.4 contracts were checked against its released wheel and mocked dispatch; hosted queries and jobs were not executed. See installation and verification notes.
Install and verify the native stack
The tiledbvcf Python distribution is not published on PyPI at this review. The
official tiledb Conda channel supplies tiledbvcf-py 0.40.3 for macOS ARM64,
macOS x86-64, and Linux x86-64, with Python 3.9-3.12 builds. tiledb on PyPI is
TileDB-Py and does not install TileDB-VCF. Native Apple Silicon no longer requires
forcing CONDA_SUBDIR=osx-64.
For the tested macOS ARM64 environment, pins below avoid versioned-library import failures in the otherwise successful current Conda solve:
conda create -n tiledb-vcf -c tiledb -c conda-forge \
python=3.12 tiledbvcf-py=0.40.3 \
azure-core-cpp=1.16.2 azure-storage-blobs-cpp=12.16.0 \
azure-storage-files-datalake-cpp=12.14.0 capnproto=1.4.0 c-blosc2=2.23.1
conda activate tiledb-vcf
python -c 'import tiledbvcf; print(tiledbvcf.version)'
tiledbvcf version
The equivalent Micromamba solve/install was executed. These extra ABI pins are a verified macOS ARM64 workaround, not a claim about all platforms. Preserve the resolved environment for production. Other-platform installation and official Docker images are alternatives documented upstream, not tested here.
Prepare and create a cohort
- Record reference assembly, contig naming/lengths, callers, normalization rules,
sample identity, and file checksums. Do not mix assemblies or assume
1andchr1are equivalent. Confirm compatible headers across inputs. - Each input must contain one sample, be coordinate sorted, and have an index.
Use BGZF-compressed VCF or BCF with a matching
.csi/.tbi. Inspectbcftools query -l sample1.vcf.gz; filenames are not sample identifiers. - Create the dataset explicitly, then ingest. Opening
mode="w"alone does not create its schema. Materialize frequently read fields at creation time. - Validate a small known interval and a round-trip export before scaling.
For existing sorted plain-text VCFs (run once per input; output names must be new):
bcftools view -Oz -o sample1.vcf.gz sample1.vcf
bcftools index -c sample1.vcf.gz
bcftools view -Oz -o sample2.vcf.gz sample2.vcf
bcftools index -c sample2.vcf.gz
The following local examples were exercised with sample IDs S1 and S2, contig
chr1, and coordinates 1-100; substitute the verified IDs and intervals in real data.
import tiledbvcf
uri = "cohort"
config = {"sm.compute_concurrency_level": "2", "sm.io_concurrency_level": "2"}
with tiledbvcf.Dataset(uri, mode="w", tiledb_config=config) as ds:
ds.create_dataset(extra_attrs=["fmt_GT", "fmt_DP"])
ds.ingest_samples(
["sample1.vcf.gz"], threads=2, total_memory_budget_mb=512
)
# Incremental ingestion uses the existing dataset; do not call create_dataset again.
with tiledbvcf.Dataset(uri, mode="w", tiledb_config=config) as ds:
ds.ingest_samples(
["sample2.vcf.gz"], threads=2, total_memory_budget_mb=512
)
The schema-v4 data array has contig, start-coordinate, and sample dimensions;
headers and optional statistics are separate arrays in the dataset group. Fields
not explicitly materialized remain in the INFO/FORMAT payloads. Query names such
as pos_start need not match raw storage column names.
Upstream supports parallel thread/process ingestion. Assign distinct sample work
and coordinate lifecycle/maintenance operations; do not blindly re-ingest samples.
resume=True supports interrupted ingestion, not arbitrary duplicate correction.
Query completely and interpret coordinates correctly
| Surface | Coordinate convention |
|---|---|
Python regions=["chr1:10-14"] |
1-based, closed interval |
…
常见问题
什么是基因变异数据(VCF/BCF)?
这些文件记录了个体 DNA 与参考序列相比存在的差异(即变异)信息。
我可以用这个工具发现新的基因变异吗?
不可以。这个工具用于整理和查询已有的基因数据,而不是用来发现新的变异。
什么是 TileDB?
它是一种专门用于高效存储和查询多维数据的数据库系统,非常适合基因组学等科学数据。
详情
作者的原始描述
Stores and retrieves genomic variant calls with TileDB-VCF. Use for indexed single-sample VCF/BCF ingestion, incremental cohorts, region and sample queries, streaming results, allele statistics, QC, and VCF/BCF export locally or through TileDB Cloud.
热度
- GitHub 星标
- 51k
- 排名
- #3582
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …