Communitygithub.com

tiledbvcf

TileDBを用いたゲノムバリアントデータの効率的な保存と取得。スケーラブルなVCF/BCF取り込み、サンプルの追加、圧縮ストレージ、並列クエリ、集団ゲノミクス向けエクスポート機能。

tiledbvcf とは?

TileDB-VCFは、ゲノムバリアントコールデータ(VCF/BCF)の効率的な保存と取得を実現する、C++ライブラリをベースとした高性能ツールです。PythonおよびCLIインターフェースを提供し、TileDBのスパース配列技術を活用することで、スケーラブルなデータ取り込み、増分サンプル追加、圧縮ストレージ、そして並列クエリを可能にします。このスキルは、集団ゲノミクス研究やコホート研究におけるバリアントデータベース構築に特に適しており、ローカル環境だけでなくS3、Azure、GCSなどのクラウドストレージともシームレスに連携します。ユーザーは、特定のゲノム領域やサンプルに対する高速なクエリ、VCF/BCF形式へのエクスポート、アレル頻度解析やサンプル品質管理といった高度な分析ワークフローを、直感的なPython APIまたはCLIコマンドを通じて実行できます。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/K-Dense-AI/scientific-agent-skills/tree/main/skills/tiledbvcf

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

TileDB-VCF

概要

TileDB-VCFは、ゲノムバリアントコールデータの効率的な保存と取得のための、C++ライブラリをベースにPythonおよびCLIインターフェースを備えた高性能ライブラリです。TileDBのスパース配列技術を基盤としており、VCF/BCFファイルのスケーラブルな取り込み、高コストなマージ操作を必要としない増分サンプル追加、そしてローカルまたはクラウドに保存されたバリアントデータに対する効率的な並列クエリを可能にします。

このスキルを使用するタイミング

このスキルは、以下の場合に使用します:

  • TileDB-VCFの概念とワークフローを学習する場合
  • ゲノミクス解析とパイプラインのプロトタイピングを行う場合
  • 小~中規模データセット(< 1000サンプル)を扱う場合
  • 既存のデータセットに新しいサンプルを増分追加する必要がある場合
  • 多くのサンプルにわたって特定のゲノム領域を効率的にクエリする必要がある場合
  • クラウドストレージ(S3、Azure、GCS)上のバリアントデータを扱う場合
  • 大規模VCFデータセットのサブセットをエクスポートする必要がある場合
  • コホート研究のためのバリアントデータベースを構築する場合
  • 教育プロジェクトやメソッド開発
  • バリアントデータ操作においてパフォーマンスが重要な場合

クイックスタート

インストール

推奨方法: Conda/Mamba

# M1 Macの場合、以下の2行を入力してください
CONDA_SUBDIR=osx-64
conda config --env --set subdir osx-64

# conda環境を作成
conda create -n tiledb-vcf "python<3.10"
conda activate tiledb-vcf

# Mambaはcondaよりも高速で信頼性の高い代替手段です
conda install -c conda-forge mamba

# TileDB-Py、TileDB-VCFをインストールし、他の便利なライブラリと揃えます
mamba install -y -c conda-forge -c bioconda -c tiledb tiledb-py tiledbvcf-py pandas pyarrow numpy

代替方法: Dockerイメージ

docker pull tiledb/tiledbvcf-py     # Pythonインターフェース
docker pull tiledb/tiledbvcf-cli    # コマンドラインインターフェース

基本的な例

データセットの作成とデータ投入:

import tiledbvcf

# 新しいデータセットを作成
ds = tiledbvcf.Dataset(uri="my_dataset", mode="w",
                      cfg=tiledbvcf.ReadConfig(memory_budget=1024))

# VCFファイルを取り込む(インデックス付きのシングルサンプルである必要があります)
# 要件:
# - VCFはシングルサンプルである必要があります(マルチサンプルは不可)
# - インデックスが必要: .csi (bcftools) または .tbi (tabix)
ds.ingest_samples(["sample1.vcf.gz", "sample2.vcf.gz"])

バリアントデータのクエリ:

# 読み取り用に既存のデータセットを開く
ds = tiledbvcf.Dataset(uri="my_dataset", mode="r")

# 特定の領域とサンプルをクエリ
df = ds.read(
    attrs=["sample_name", "pos_start", "pos_end", "alleles", "fmt_GT"],
    regions=["chr1:1000000-2000000", "chr2:500000-1500000"],
    samples=["sample1", "sample2", "sample3"]
)
print(df.head())

VCFへのエクスポート:

import os

# 2つのVCFサンプルをエクスポート
ds.export(
    regions=["chr21:8220186-8405573"],
    samples=["HG00101", "HG00097"],
    output_format="v",
    output_dir=os.path.expanduser("~"),
)

コア機能

1. データセットの作成と取り込み

TileDB-VCFデータセットを作成し、複数のVCF/BCFファイルからバリアントデータを増分的に取り込みます。これは、集団ゲノミクスデータベースやコホート研究の構築に適しています。

要件:

  • シングルサンプルVCFのみ: マルチサンプルVCFはサポートされていません
  • インデックスファイル必須: VCF/BCFファイルにはインデックス(.csi または .tbi)が必要です

一般的な操作:

  • 最適化された配列スキーマで新しいデータセットを作成
  • 単一または複数のVCF/BCFファイルを並列に取り込む
  • 既存のデータを再処理せずに新しいサンプルを増分的に追加
  • メモリ使用量と圧縮設定を構成
  • さまざまなVCF形式とINFO/FORMATフィールドを処理
  • 中断された取り込みプロセスを再開
  • 取り込み中のデータ整合性を検証

2. 効率的なクエリとフィルタリング

ゲノム領域、サンプル、バリアント属性にわたって、高性能でバリアントデータをクエリします。これは、関連研究、バリアント発見、集団分析に適しています。

一般的な操作:

  • 特定のゲノム領域をクエリ(単一または複数)
  • サンプル名またはサンプルグループでフィルタリング
  • 特定のバリアント属性(位置、対立遺伝子、遺伝子型、品質)を抽出
  • INFOおよびFORMATフィールドに効率的にアクセス
  • 空間フィルタリングと属性フィルタリングを組み合わせる
  • 大規模なクエリ結果をストリーミング
  • サンプルまたは領域をまたいだ集計を実行

3. データエクスポートと相互運用性

ダウンストリーム解析や他のゲノミクスツールとの統合のために、さまざまな形式でデータをエクスポートします。これは、データセットの共有、分析サブセットの作成、または他のパイプラインへのフィードに適しています。

一般的な操作:

  • 標準VCF/BCF形式にエクスポート
  • 選択したフィールドでTSVファイルを生成
  • サンプル/領域固有のサブセットを作成
  • データの来歴とメタデータを維持
  • すべてのアノテーションを保持するロスレスデータエクスポート
  • 圧縮された出力形式
  • 大規模データセットのストリーミングエクスポート

4. 集団ゲノミクスワークフロー

TileDB-VCFは、多数のサンプルとゲノム領域にわたるバリアントデータへの効率的なアクセスを必要とする大規模集団ゲノミクス解析に優れています。

一般的なワークフロー:

  • ゲノムワイド関連研究(GWAS)データ準備
  • 稀なバリアント負荷テスト
  • 集団層別解析
  • 集団間の対立遺伝子頻度計算
  • 大規模コホートの品質管理
  • バリアントアノテーションとフィルタリング
  • 集団間比較分析

主要な概念

配列スキーマとデータモデル

TileDB-VCFデータモデル:

  • バリアントは、ゲノム座標を次元とするスパース配列として保存されます
  • サンプルは属性として保存され、サンプル固有の効率的なクエリを可能にします
  • INFOおよびFORMATフィールドは元のデータ型で保持されます
  • 最適なストレージのための自動圧縮とチャンク分割

スキーマ構成:

# 特定のタイル範囲を持つカスタムスキーマ
config = tiledbvcf.ReadConfig(
    memory_budget=2048,  # MB
    region_partition=(0, 3095677412),  # 全ゲノム
    sample_partition=(0, 10000)  # 最大1万サンプル
)

座標系と領域

重要: TileDB-VCFはVCF標準に従い、1-basedのゲノム座標を使用します:

  • 位置は1-basedです(最初の塩基は位置1)
  • 範囲は両端を含みます
  • 領域 "chr1:1000-2000" は位置1000から2000(合計1001塩基)を含みます

領域指定形式:

# 単一領域
regions = ["chr1:1000000-2000000"]

# 複数領域
regions = ["chr1:1000000-2000000", "chr2:500000-1500000"]

# 全染色体
regions = ["chr1"]

# BEDスタイル(0-based、半開区間、内部で変換)
regions = ["chr1:999999-2000000"]  # 1-basedのchr1:1000000-2000000と同等

メモリ管理

パフォーマンスに関する考慮事項:

  1. 利用可能なシステムメモリに基づいて適切なメモリ予算を設定します
  2. 非常に大きな結果セットにはストリーミングクエリを使用します
  3. メモリ枯渇を避けるために大規模な取り込みを分割します
  4. 繰り返し領域にアクセスするためにタイルキャッシュを構成します
  5. 複数ファイルに対して並列取り込みを使用します
  6. 近くの領域を結合して領域クエリを最適化します

クラウドストレージ統合

TileDB-VCFはクラウドストレージとシームレスに連携します:

# S3データセット
ds = tiledbvcf.Dataset(uri="s3://bucket/dataset", mode="r")

# Azure Blob Storage
ds = tiledbvcf.Dataset(uri="azure://container/dataset", mode="r")

# Google Cloud Storage
ds = tiledbvcf.Dataset(uri="gcs://bucket/dataset", mode="r")

よくある落とし穴

  1. 取り込み時のメモリ枯渇: 大きなVCFファイルには適切なメモリ予算とバッチ処理を使用します
  2. 非効率的な領域クエリ: 多くの個別クエリではなく、近くの領域を結合します
  3. サンプル名の欠落: VCFヘッダーのサンプル名がクエリのサンプル指定と一致していることを確認します
  4. 座標系の混乱: TileDB-VCFはVCF標準と同様に1-based座標を使用することを覚えておいてください
  5. 大きな結果セット: 数百万のバリアントを返すクエリにはストリーミングまたはページネーションを使用します
  6. クラウド権限: クラウドストレージアクセスには適切な認証を確認します
  7. 同時アクセス: 同じデータセットへの複数ライターは破損を引き起こす可能性があります—適切なロックを使用します

CLIの使用法

TileDB-VCFは、以下のサブコマンドを持つコマンドラインインターフェースを提供します:

利用可能なサブコマンド:

  • create - 空のTileDB-VCFデータセットを作成します
  • store - サンプルをTileDB-VCFデータセットに取り込みます
  • export - TileDB-VCFデータセットからデータをエクスポートします
  • list - TileDB-VCFデータセット内のすべてのサンプル名をリストします
  • stat - TileDB-VCFデータセットに関する高レベルの統計情報を表示します
  • utils - TileDB-VCFデータセットを操作するためのユーティリティ
  • version - バージョン情報を表示して終了します
# 空のデータセットを作成
tiledbvcf create --uri my_dataset

# サンプルを取り込む(インデックス付きのシングルサンプルVCFが必要)
tiledbvcf store --uri my_dataset --samples sample1.vcf.gz,sample2.vcf.gz

# データをエクスポート
tiledbvcf export --uri my_dataset \
  --regions "chr1:1000000-2000000" \
  --sample-names "sample1,sample2"

# すべてのサンプルをリスト
tiledbvcf list --uri my_dataset

# データセット統計を表示
tiledbvcf stat --uri my_dataset

高度な機能

対立遺伝子頻度解析

# 対立遺伝子頻度を計算
af_df = tiledbvcf.read_allele_frequency(
    uri="my_dataset",
    regions=["chr1:1000000-2000000"],
    samples=["sample1", "sample2", "sample3"]
)

サンプル品質管理

# サンプルQCを実行
qc_results = tiledbvcf.sample_qc(
    uri="my_dataset",
    samples=["sample1", "sample2"]
)

カスタム構成

# 高度な構成
config = tiledbvcf.ReadConfig(
    memory_budget=4096,
    tiledb_config={
        "sm.tile_cache_size": "1000000000",
        "vfs.s3.region": "us-east-1"
    }
)

リソース

ヘルプの入手

オープンソースTileDB-VCFリソース

オープンソースドキュメント:

TileDB-Cloudリソース

大規模/本番ゲノミクス向け:

はじめに:

TileDB-Cloudへのスケーリング

ゲノミクスワークロードがシングルノード処理を超えた場合、TileDB-Cloudは本番ゲノミクスパイプライン向けのエンタープライズ規模の機能を提供します。

注意: このセクションでは、利用可能なドキュメントに基づいてTileDB-Cloudの機能を説明しています。完全なAPIの詳細と現在の機能については、公式のTileDB-CloudドキュメントとAPIリファレンスを参照してください。

TileDB-Cloudのセットアップ

1. アカウント作成とAPIトークンの取得

# https://cloud.tiledb.com でサインアップ
# アカウント設定でAPIトークンを生成

2. TileDB-Cloud Pythonクライアントのインストール

# ベースインストール
uv pip install tiledb-cloud

# ゲノミクス固有の機能を含める場合
uv pip install tiledb-cloud[life-sciences]

3. 認証の構成

# APIトークンを環境変数に設定
export TILEDB_REST_TOKEN="your_api_token"
import tiledb.cloud

# TILEDB_REST_TOKENにより認証は自動です
# コード内での明示的なログインは不要です

オープンソースからTileDB-Cloudへの移行

大規模取り込み

# TileDB-Cloud: 分散VCF取り込み
import tiledb.cloud.vcf

# 専用のVCF取り込みモジュールを使用
# 注: 正確なAPIはTileDB-Cloudドキュメントを参照
# これは利用可能な機能構成を示しています
tiledb.cloud.vcf.ingestion.ingest_vcf_dataset(
    source="s3://my-bucket/vcf-files/",
    output="tiledb://my-namespace/large-dataset",
    namespace="my-namespace",
    acn="my-s3-credentials",
    ingest_resources={"cpu": "16", "memory": "64Gi"}
)

分散クエリ処理

# TileDB-Cloud: 分散ストレージ全体でのVCFクエリ
import tiledb.cloud.vcf
import tiledbvcf

# データセットURIを定義
dataset_uri = "tiledb://TileDB-Inc/gvcf-1kg-dragen-v376"

# データセットからすべてのサンプルを取得
ds = tiledbvcf.Dataset(dataset_uri, tiledb_config=cfg)
samples = ds.samples()

# クエリする属性と範囲を定義
attrs = ["sample_name", "fmt_GT", "fmt_AD", "fmt_DP"]
regions = ["chr13:32396898-32397044", "chr13:32398162-32400268"]

# 読み取りを実行(分散方式で実行されます)
df = tiledb.cloud.vcf.read(
    dataset_uri=dataset_uri,
    regions=regions,
    samples=samples,
    attrs=attrs,
    namespace="my-namespace",  # 課金するアカウントを指定
)
df.to_pandas()

エンタープライズ機能

データ共有とコラボレーション

# TileDB-Cloudは、名前空間ベースの権限とグループ管理を通じて
# エンタープライズデータ共有機能を提供します

# TileDB-Cloud URIs経由で共有データセットにアクセス
dataset_uri = "tiledb://shared-namespace/population-study"

# 共有ノートブックとコンピュートリソースを通じてコラボレーション
# (具体的なAPIはTileDB-Cloudドキュメントを参照)

コスト最適化

  • サーバーレスコンピュート: 実際のコンピュート時間に対してのみ支払い
  • 自動スケーリング: ワークロードに基づいて自動的にスケールアップ/ダウン
  • スポットインスタンス: バッチジョブにコスト最適化されたコンピュートを使用
  • データ階層化: 自動ホット/コールドストレージ管理

セキュリティとコンプライアンス

  • エンドツーエンド暗号化: 転送中および保存中のデータを暗号化
  • アクセス制御: きめ細かな権限と監査ログ
  • HIPAA/SOC2準拠: エンタープライズセキュリティ基準
  • VPCサポート: プライベートクラウド環境にデプロイ

移行タイミングのチェックリスト

✅ 以下の場合、TileDB-Cloudに移行します:

  • データセット > 1000サンプル
  • 100GBを超えるVCFデータを処理する必要がある
  • 分散コンピューティングが必要
  • 複数のチームメンバーがアクセスする必要がある
  • エンタープライズセキュリティ/コンプライアンスが必要
  • コスト最適化されたサーバーレスコンピュートを希望する
  • 24時間/7日の本番稼働が必要

TileDB-Cloudの開始方法

  1. 無料で開始: TileDB-Cloudは評価用に無料枠を提供しています
  2. 移行サポート: TileDBチームが移行を支援します
  3. トレーニング: ゲノミクス固有のチュートリアルにアクセス

…

[truncated for translation]

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

adaptyv

How to use the Adaptyv Bio Foundry API and Python SDK for protein experiment design, submission, and results retrieval. Use this skill whenever the user mentions Adaptyv, Foundry API, protein binding assays, protein screening experiments, BLI/SPR assays, thermostability assays, or wants to submit protein sequences for experimental characterization. Also trigger when code imports `adaptyv`, `adaptyv_sdk`, or `FoundryClient`, or references `foundry-api-public.adaptyvbio.com`.

aeon

This skill should be used for time series machine learning tasks including classification, regression, clustering, forecasting, anomaly detection, segmentation, and similarity search. Use when working with temporal data, sequential patterns, or time-indexed observations requiring specialized algorithms beyond standard ML approaches. Particularly suited for univariate and multivariate time series analysis with scikit-learn compatible APIs.

alphagenome

Look up precomputed AlphaGenome Atlas effects for any GRCh38 single-nucleotide variant (AVI score with Phred and 18 SHAP feature attributions, plus raw and quantile scores for RNA-seq, DNase, ATAC, ChIP-TF, ChIP-histone, CAGE, PRO-cap, splicing, polyadenylation and contact-map tracks), score variants or scan windows on demand with the AlphaGenome model for human and mouse (variant scoring, in silico mutagenesis, REF-versus-ALT track prediction), and build Atlas website deep links. Use when the user mentions AlphaGenome, AlphaGenome Atlas, AVI or AlphaGenome Variant Impact, DeepMind variant effect prediction, or wants to prioritise or mechanistically interpret non-coding, regulatory, splicing, enhancer, promoter, or chromatin-accessibility effects of SNVs from a VCF, credible set, or region. Research use only; not a clinical tool.

analytical-method-validation

Plan, execute, and document validation, verification, and transfer of analytical procedures under the governing framework - ICH Q2(R2) and Q14, USP <1220>/<1225>/<1226>, ICH M10 bioanalytical, CLSI EP, or ISO/IEC 17025. Use for HPLC, LC-MS/MS, GC, CE, ICP-MS, dissolution, qNMR, qPCR, NIR, and ligand binding or cell-based assays whenever the question is whether a procedure is fit for its intended purpose. Triggers include

anndata

Data structure for annotated matrices in single-cell analysis. Use when working with .h5ad files or integrating with the scverse ecosystem. This is the data format skill—for analysis workflows use scanpy; for probabilistic models use scvi-tools; for population-scale queries use cellxgene-census.

arbor

Autonomously improve a real artifact (code, training recipe, agent harness, data pipeline, prompt) against an objective and an evaluator, using Hypothesis Tree Refinement (HTR) from the Arbor paper. Use this whenever someone wants to iteratively optimize something over many experiments without overfitting — e.g.

arboreto

Infer gene regulatory networks (GRNs) from gene expression data using scalable algorithms (GRNBoost2, GENIE3). Use when analyzing transcriptomics data (bulk RNA-seq, single-cell RNA-seq) to identify transcription factor-target gene relationships and regulatory interactions. Supports distributed computation for large-scale datasets.

astropy

Core Python library for astronomy and astrophysics workflows that need Astropy APIs, including units/quantities, coordinates, FITS I/O, tables, time systems, WCS, and cosmology. Use when implementing or debugging astronomical data analysis code with Astropy.

autoskill

Observe the user

benchling-integration

Benchling Python SDK and REST API integration for registry entities, inventory, ELN entries, workflows, Benchling Apps, and Data Warehouse queries. Use when automating lab data with benchling-sdk or the v2 API.

bgpt-paper-search

Search scientific papers and retrieve structured experimental data extracted from full-text studies via the BGPT MCP server. Returns 25+ fields per paper including methods, results, sample sizes, quality scores, and conclusions. Use for literature reviews, evidence synthesis, and finding experimental details not available in abstracts alone.

bids

>

biopython

Comprehensive molecular biology toolkit. Use for sequence manipulation, file parsing (FASTA/GenBank/PDB), phylogenetics, and programmatic NCBI/PubMed access (Bio.Entrez). Best for batch processing, custom bioinformatics pipelines, BLAST automation. For quick lookups use gget; for multi-service integration use bioservices.

bioservices

Unified Python interface to 40+ bioinformatics services. Use when querying multiple databases (UniProt, KEGG, ChEMBL, Reactome) in a single workflow with consistent API. Best for cross-database analysis, ID mapping across services. For quick single-database lookups use gget; for sequence/file manipulation use biopython.

bulk-rnaseq

End-to-end bulk RNA-seq orchestrator — takes raw FASTQ reads through QC and trimming (FastQC, fastp/Trim Galore), alignment and quantification (STAR, Salmon, featureCounts), assembles a gene-level counts matrix, then hands off to differential expression (pydeseq2), pathway/GSEA enrichment (pathway-enrichment), and publication figures (scientific-visualization). Use whenever the user has bulk RNA-seq reads or quant output and wants a complete, reproducible differential-expression workflow — e.g.

cellxgene-census

Query the CZ CELLxGENE Census programmatically for versioned public single-cell and spatial transcriptomics data. Use when you need population-scale cell metadata, gene expression slices, Census summary counts, source H5AD URIs/downloads, embeddings, spatial Census data, or reference atlas comparisons across organisms, tissues, diseases, assays, and cell types. For analyzing your own local single-cell data use scanpy, anndata, or scvi-tools.

cirq

Google quantum computing framework. Use when targeting Google Quantum AI hardware, designing noise-aware circuits, or running quantum characterization experiments. Best for Google hardware, noise modeling, and low-level circuit design. For IBM hardware use qiskit; for quantum ML with autodiff use pennylane; for physics simulations use qutip.

citation-management

Comprehensive citation management for academic research. Search OpenAlex, PubMed, and Google Scholar for papers, extract accurate metadata, validate citations, and generate properly formatted BibTeX entries. This skill should be used when you need to find papers, verify citation information, convert DOIs to BibTeX, or ensure reference accuracy in scientific writing.

clinical-decision-support

Prepare and validate research-only clinical decision-support evaluation, evidence-profile, cohort, survival, biomarker/model, privacy, and governance artifacts. Use for aggregate or synthetic research documentation and traceability—not patient care or live clinical operation.

clinical-reports

Create safety-bounded draft structures and run local deterministic checks for clinical case, diagnostic, trial, safety, and aggregate research reports. Use only with synthetic, de-identified, or aggregate inputs and verified source-fact manifests; every output requires qualified review.

関連スキル