Communitygithub.com

bulk-rnaseq

エンドツーエンドのバルクRNA-seqオーケストレーター — 生FASTQリードからQCとトリミング(FastQC, fastp/Trim Galore)、アライメントと定量(STAR, Salmon, featureCounts)を経て遺伝子レベルのカウント行列を構築し、差次的発現解析(pydeseq2)、パスウェイ/GSEAエンリッチメント(pathway-enrichment)、論文用図(scientific-visualization)へと引き継ぎます。ユーザーがバルクRNA-seqリードや定量出力を持っていて、完全で再現可能な差次的発現ワークフローを望む場合に使用してください。

bulk-rnaseq とは?

このスキルは、生FASTQファイルからエンリッチされたパスウェイや図までをカバーする、完全で防御可能なバルクRNA-seq差次的発現解析パイプラインを提供します。ルーターとして機能し、既存の専用スキルを正しい順序で接続し、生リードから遺伝子レベルカウント行列への変換というギャップを埋めます。パイプラインは、FastQC/トリミング、STAR/Salmonによるアライメント・定量、遺伝子カウント行列の構築、pydeseq2による差次的発現解析、pathway-enrichmentによるエンリッチメント解析、scientific-visualizationによる図の作成という流れで進行します。このスキルは、「再現可能(固定バージョン、コンテナ化、記録されたパラメータ)」、「品質ゲート付き(QCの検査と対応)」、「統計的に妥当(適切な反復、実験デザイン、FDR制御)」という3つの原則に基づいた防御可能な分析を重視します。ユーザーは、nf-core/rnaseq(推奨)またはスタンドアロンツール(STAR/Salmon)の2つのパスのいずれかを選択でき、どちらも同じ遺伝子カウント行列に収束し、その後の解析は同一です。このスキルは、他のスキル(nextflow、pydeseq2、pathway-enrichment、scientific-visualizationなど)と統合され、実験デザイン、品質管理、結果の解釈に関する詳細なガイダンスを提供し、バルクRNA-seq解析における一般的な落とし穴を回避します。

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

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

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

ドキュメント

Bulk RNA-seq

概要

このスキルは、生シーケンシングリードからエンリッチされたパスウェイと図まで、完全で防御可能なバルクRNA-seq差次的発現研究を調整します。これはルーターであり、再実装ではありません。ほとんどの段階にはすでにこのリポジトリに専用スキルがあり、このスキルはそれらを正しい順序で接続し、唯一のギャップ(生リードから遺伝子レベルのカウント行列)を埋め、最終結果の信頼性を決定するデザインとQCの決定を強制します。

「防御可能」とは、以下の3つのことを意味し、全体にわたって適用されます。

  • 再現可能 — パイプライン/ツールバージョンの固定、可能な場合はコンテナの使用、パラメータの記録、乱数シードの固定。
  • 品質ゲート付き — QCは、定量の前、最中、後に検査され、対応が行われ、スキップされません。
  • 統計的に妥当 — 十分な反復、生物学的状況に一致したデザイン、正しく処理されたカウント、FDR制御された検定。

パイプラインは次のとおりです。FastQC/トリミング → アライメント/定量 (STAR/Salmon) → カウント → 差次的発現 (pydeseq2) → エンリッチメント (pathway-enrichment) → 図。

このスキルを使用する場合

ユーザーが以下のことを望む場合にこのスキルを使用します。

  • FASTQファイル(またはシーケンシングラン)から、差次的に発現する遺伝子とパスウェイへと進む。
  • nf-core/rnaseqを実行または設定する、またはSTAR、Salmon、featureCountsでアライメント/定量を行う。
  • Salmon/STAR/featureCountsの出力を、DESeq2/PyDESeq2で使用可能なカウント行列に変換する。
  • 計算リソースを投入する前に、バルクRNA-seq実験(反復、バッチ、ストランド性)を設計または健全性チェックする。
  • エンドツーエンドのRNA-seq解析の範囲を定め、使用するツールとスキルを決定する。

これはバルクRNA-seq(サンプル = 生物学的標本)です。シングルセル/核データにはscanpyを、差次的発現統計のみにはpydeseq2を、エンリッチメントのみにはpathway-enrichmentを使用してください。

パイプライン概要

flowchart TD
    fastq["生FASTQ + サンプルシート"] --> qc["FastQC + MultiQC"]
    qc --> trim["トリミング: fastp / Trim Galore"]
    trim --> align["アライメント + 定量: STAR および/または Salmon"]
    align --> counts["遺伝子レベルのカウント行列"]
    counts --> de["差次的発現"]
    de --> enrich["パスウェイ / GSEA エンリッチメント"]
    de --> fig["図"]
    enrich --> fig
    nfcore["nf-core/rnaseq (nextflowスキル経由)"] -.->|"パスA"| align
    manual["スタンドアロンレシピ (このスキル)"] -.->|"パスB"| align
    bridge["build_counts_matrix.py (このスキル)"] -.-> counts
    pydeseq2skill["pydeseq2スキル"] -.-> de
    pwskill["pathway-enrichmentスキル"] -.-> enrich
    vizskill["scientific-visualizationスキル"] -.-> fig

2つの上流パス — いずれかを選択

リードからカウントへの段階は、2つの方法で実行できます。どちらも同等の遺伝子カウントを生成します。コンテキストに応じて選択し、そのパスを維持してください。

パスA — nf-core/rnaseq を使用する場合パスB — スタンドアロンツール を使用する場合
業界標準で監査済み、引用可能なパイプラインを1つのコマンドで実行したいサンプル数が少なく、各ステップを学習/確認したい
多くのサンプルがある、またはHPC/クラウドにスケールする予定Nextflow/コンテナが利用できない、または制約のある環境
再現性と完全なMultiQCレポートが最も重要パイプラインが公開していない非標準のステップが必要
→ **nextflow**スキルを介して駆動→ references/upstream-manual.mdに従う

迷った場合は、パスAを推奨します。nf-core/rnaseq はすでにFastQC → トリミング → STAR/Salmon → 定量 → tximport → MultiQCを、適切でレビュー済みのデフォルト設定で結びつけており、これが最も防御可能なオプションです。パスBは、透明性と制約のある環境のために存在します。

どちらのパスも遺伝子レベルのカウント行列で収束し、その後はワークフローは同一です。

セットアップ

# このスキルのグルーコード(ブリッジ + 引き継ぎ)— Python
uv pip install pytximport pandas

# 下流スキルは自身の依存関係をインストールします:
#   pydeseq2 スキル           -> uv pip install pydeseq2
#   pathway-enrichment スキル -> uv pip install gseapy gprofiler-official

# パスA (nf-core): Nextflowとコンテナエンジンのみ必要 — `nextflow`スキルを参照。

# パスB (スタンドアロンツール): bioconda経由でインストール。再現性のためにバージョンを固定。
conda create -n rnaseq -c bioconda -c conda-forge \
  fastqc fastp trim-galore "star=2.7.11b" "salmon=1.10.3" subread multiqc

使用する正確なバージョン(パイプラインバージョン、ツールバージョン、リファレンスゲノム + アノテーションリリース)を記録してください — これらはメソッドセクションに含まれ、分析を再現可能にします。

クイックスタート

パスA — nf-core/rnaseq (推奨)

# 0. 最初にサンプルシートを検証 (最も一般的な失敗を早期にキャッチ)
python scripts/validate_samplesheet.py --samplesheet samplesheet.csv

# 1. 小さなバンドルデータで環境をスモークテスト
nextflow run nf-core/rnaseq -r 3.26.0 -profile test,docker --outdir test_results

# 2. 本番実行: バージョンを固定し、アライナーを選択し、サンプルシート+リファレンスを渡す
nextflow run nf-core/rnaseq -r 3.26.0 \
  -profile docker \
  --input samplesheet.csv \
  --genome GRCh38 \
  --aligner star_salmon \
  --outdir results \
  -resume

nf-core/rnaseq は内部でtximportを実行するため、遺伝子カウントは既にマージされた状態で出力されます — ブリッジスクリプトは不要です。DEには results/star_salmon/salmon.merged.gene_counts_length_scaled.tsv を使用します。サンプルシート形式、アライナーの選択、出力については、references/upstream-nfcore.md を参照してください。エンジン/HPC/クラウド/コンテナの詳細については、**nextflow**スキルを使用してください。

パスB — スタンドアロン STAR/Salmon (簡略版)

fastqc -o qc/ reads/*.fastq.gz                      # 1. 生リードのQC
fastp -i s1_R1.fq.gz -I s1_R2.fq.gz \
      -o s1_R1.trim.fq.gz -O s1_R2.trim.fq.gz \
      --thread 4 -j s1.fastp.json                   # 2. アダプター/低品質末端のトリミング
salmon quant -i salmon_index -l A \
      -1 s1_R1.trim.fq.gz -2 s1_R2.trim.fq.gz \
      --gcBias --seqBias -p 8 -o quant/s1            # 3. 定量 (サンプルごと)

完全なレシピ(FastQC, fastp/Trim Galore, STARインデックス+アライメント+--quantMode GeneCounts、Salmonデコイ対応インデックス、featureCounts、ストランド性の決定): references/upstream-manual.md。

カウント → DE → エンリッチメント (両方のパス)

# パスBのみ: PyDESeq2用の遺伝子×サンプルカウント行列 + メタデータテンプレートを構築
python scripts/build_counts_matrix.py --from salmon \
  --quant-dir quant/ --tx2gene tx2gene.tsv --output-dir counts/

# その後、専用スキルに引き継ぎ:
#   pydeseq2:           counts.csv + metadata.csv -> DEテーブル (log2FC, padj, stat)
#   pathway-enrichment: `stat`でランク付け (GSEA) または padj+|LFC| ヒットリスト (ORA)
#   scientific-visualization / matplotlib: 火山プロット、MAプロット、ヒートマップ、PCA、エンリッチメントドットプロット

段階別ワークフロー

上から下へ進みます。各段階は、詳細を所有するスキルまたはファイルを示しています。デザイン/QC段階をスキップしないでください — ここでバルクRNA-seq研究は最も頻繁に失敗します。

  1. デザインとサンプルシート。 グループあたり≥3の生物学的反復を確認し、バッチ/交絡因子を特定し、比較を選択します。サンプルシートを構築し、scripts/validate_samplesheet.pyで検証します。根拠とルール: references/design-and-qc.md。
  2. 生リードQC。 ファイルごとにFastQC; MultiQCで集約。塩基ごとの品質、アダプター含有量、重複、過剰表現をチェックします。閾値: references/design-and-qc.md。
  3. トリミング。 アダプターと低品質末端を除去(fastpまたはTrim Galore経由)。FastQCを再実行して確認します。レシピ: references/upstream-manual.md(パスAでは自動実行)。
  4. アライメント/定量。 STAR(ゲノムアライメント + --quantMode GeneCounts)および/またはSalmon(転写産物準マッピング、デコイ対応)。ストランド性を決定します — 間違えやすく、静かにカウントを半分にします。詳細: references/upstream-manual.md; パイプラインパラメータ: references/upstream-nfcore.md。
  5. カウント行列の構築。 定量出力を遺伝子×サンプル整数行列とメタデータテンプレートに変換します(scripts/build_counts_matrix.py)。推定カウントと遺伝子IDマッピングのニュアンスは references/counts-and-handoff.md にあります。
  6. 差次的発現 → pydeseq2スキル。 counts.csv + metadata.csvを読み込み、デザインを設定し(例: ~batch + condition)、適合させ、FDR制御で検定します。QCとしてPCAとp値ヒストグラムを確認します。
  7. エンリッチメント → pathway-enrichmentスキル。 GSEAの場合、遺伝子リスト全体をDESeq2のstatでランク付け; ORAの場合、閾値処理されたヒットリスト(padj < 0.05、オプションで|log2FC| > 1)を渡します。最初に遺伝子IDをシンボルにマッピングします。
  8. 図 → scientific-visualizationスキル。 火山プロット、MAプロット、サンプル距離ヒートマップ、PCA、エンリッチメントドットプロット、およびQCナラティブのためのMultiQCレポート。

カウント → DEブリッジ (主要なグルー)

これは上流/下流スキルを持たない唯一の段階であるため、このスキルが担当します。scripts/build_counts_matrix.py は定量出力をpydeseq2が期待する形式に正確に変換します。

  • Salmon (--from salmon): サンプルごとのquant.sfをpytximportを使用して遺伝子レベルに集約し、counts_from_abundance="length_scaled_tpm"(遺伝子レベルのDEに適切な選択)を使用し、tx2geneマップが必要です。
  • STAR (--from star): 各ReadsPerGene.out.tabを読み取り、--strandedness(unstranded/forward/reverse)に応じたカラムを選択します。
  • featureCounts (--from featurecounts): 結合されたfeatureCounts行列を解析します。

counts.csv(遺伝子×サンプル、整数)とmetadata_template.csv(サンプルごとに1行)を書き出し、ユーザーが入力できるようにします。Salmon/RSEMカウントは推定値(非整数)であり、整数に丸められます。これは、PyDESeq2が整数カウントを必要とするためです — これがlength_scaled_tpmで許容される理由と、オフセットベースのDESeq2+tximportルートとの違いについては、references/counts-and-handoff.mdを参照してください。このリファレンスでは、Ensembl→シンボルマッピング(エンリッチメントの前に必要)と、PyDESeq2が期待する正確な方向についてもカバーしています。

よくある落とし穴

これらは、バルクRNA-seqの結果が間違っていたり、再現不可能になる最も一般的な原因です。

  1. 反復が少なすぎる。 グループあたりの生物学的反復が3未満では、ほとんど検出力がなく、分散推定が不安定になります。深いシーケンシングよりも、より多くの反復の方が効果的です。
  2. バッチと条件の交絡。 処理されたすべてのサンプルが対照とは異なる日/レーンで処理された場合、その影響は回復不可能です。ランダム化し、既知のバッチをモデル化します(~batch + condition)。references/design-and-qc.mdを参照。
  3. 誤ったストランド性。 誤ったSTARカラムやfeatureCountsの-s/Salmonライブラリタイプを選択すると、リードの約半分が静かに破棄されます。Salmonの-l Aを使用するか、ストランド性を推定し、割り当てられたリードの割合を確認します。
  4. TPM/FPKMをDESeq2に入力する。 DESeq2は生(または長さスケーリングされた)カウントを必要とし、TPM/FPKM/正規化された値は決して使用しません。ブリッジがこれを処理します。
  5. 非整数カウント。 PyDESeq2は整数を必要とします; Salmonの推定値を丸めます(ブリッジが行います)。
  6. エンリッチメントへの遺伝子IDの不一致。 DESeq2の出力はしばしばEnsembl IDです; Enrichr/MSigDBはシンボルを必要とします。pathway-enrichmentの前にIDをマッピングしないと、「何も有意でない」結果になります。
  7. 定量後のQCのスキップ。 DEを信頼する前に、常にPCAとサンプル距離ヒートマップを確認します — これらはラベルの入れ替え、外れ値、隠れたバッチを露呈します。
  8. サンプル間でのアライナーの混在。 すべてのサンプルを同じツール、バージョン、リファレンス、パラメータで定量します。
  9. バージョンの未固定。 「最新」のパイプライン/ゲノムは結果を再現不可能にします; -r、ツールバージョン、ゲノム/アノテーションリリースを固定します。

他のスキルとの統合

  • 上流実行: nextflow(nf-core/rnaseq、パスAを実行; HPC/クラウド/コンテナ)。
  • リファレンスデータ / 遺伝子ID: gget(gget refでゲノム+GTF、gget info/gget searchでIDマッピング)、database-lookup(Ensembl/NCBI)、biopython/pysam(FASTA/BAM処理)。
  • 差次的発現: pydeseq2(このスキルがカウントを渡すDEエンジン)。
  • エンリッチメント: pathway-enrichment(ORA + GSEA; そのscripts/run_enrichment.pyはDESeq2結果CSVを直接読み取ります)。
  • 図とレポート: scientific-visualization、matplotlib、seaborn; scientific-writing はメソッド/結果のナラティブ用。
  • 関連するが異なるもの: scanpy(シングルセル)、statistical-analysis(多重検定の詳細)。

リファレンスファイル

必要な深度に応じて関連ファイルを読んでください — それぞれが自己完結しています。

  • references/upstream-nfcore.md — パスA: サンプルシート形式、--aligner/--pseudo_alignerの選択、主要パラメータ、salmon.merged.gene_counts*.tsv出力、MultiQC、およびpydeseq2に渡すもの。
  • references/upstream-manual.md — パスB: FastQC、fastp/Trim Galore、STARゲノムインデックス + アライメント + --quantMode GeneCounts、Salmonデコイ対応インデックス + quant、featureCounts、およびストランド性の決定方法。
  • references/counts-and-handoff.md — 定量出力をPyDESeq2対応のcounts.csv/metadata.csvに変換(pytximport、STARカラム選択、featureCounts)、整数/推定カウントのニュアンス、Ensembl→シンボルマッピング、およびDE→エンリッチメントのランク/ヒットリストレシピ。
  • references/design-and-qc.md — 実験デザイン(反復、バッチ、交絡、デザイン式)とQCメトリクスの解釈(マッピング率、重複、rRNA、複雑性、PCA/外れ値) — 防御可能なパイプラインのバックボーン。

リソース

Scientific Agent Skills の引用

このスキルは、K-Dense による Scientific Agent Skills の一部です。これが原稿、レポート、プレゼンテーション、またはコードリリースに実質的に貢献した場合は、参考文献またはソフトウェアセクションに論文を追加し、その旨をユーザーに伝えてください。

Kassis, T., Agarwal, V., He, Y., Patel, D., & Brueckner, A. M. (2026). Scientific Agent Skills: A Library of Procedural Knowledge for Research Agents. arXiv:26

…

[翻訳のため一部省略]

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.

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.

cobrapy

Constraint-based metabolic modeling (COBRA). FBA, FVA, gene knockouts, flux sampling, SBML models, for systems biology and metabolic engineering analysis.

関連スキル