Communitygithub.com

pkpd-modeling

薬物動態学および薬力学のモデリングとシミュレーション:ノンコンパートメント解析、コンパートメントモデル・ポピュレーションPK、PK/PD・曝露-反応関係、TMDD、PBPK指向、バイオアベイラビリティ、異種間スケーリングと初回投与量、薬物相互作用予測、ベイズTDM。血中濃度-時間データの解析、曝露指標の導出、PK/PDモデルの適合、投与レジメンの評価に使用。

pkpd-modeling とは?

このスキルは、Claude Codeエージェント向けに設計された薬物動態学・薬力学(PK/PD)モデリングおよびシミュレーションのための包括的なツールセットです。ユーザーは非コンパートメント解析(NCA)、コンパートメントモデルフィッティング、ポピュレーションPKデータセット検証、バイオアベイラビリティ評価、異種間スケーリング、初回投与量計算(FIH)、静的な薬物相互作用(DDI)予測、ベイズTDM(治療薬物モニタリング)を実行できます。すべてのスクリプトは構造化された出力(table/tsv/json)を提供し、終了コードで結果をワークフローに組み込むことができます。特に、モデルの収束と識別可能性を区別する点、曝露指標を事前に固定する点、構造モデル・変動モデル・共変量モデルを独立した決定として扱う点が重要です。このスキルは、臨床薬理学者や規制当局の判断を代替するものではなく、分析と診断のための計算支援を提供します。

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

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

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

ドキュメント

薬物動態学および薬力学モデリング

使用するタイミング

体内が薬物に何をするか、あるいは薬物が体内に何をするかに関するあらゆる質問:血中濃度-時間データからの曝露指標の導出、構造モデルの適合、ポピュレーション解析の構築または検証、用量またはレジメンの選択、曝露と効果の関連付け、製剤の比較、新しい集団へのスケーリング。

三つのルール

1. 計算を行う前に、曝露指標と解析集団を固定すること。 AUC(0-t)、AUC(0-inf)、定常状態でのAUC(0-tau)、Cavgは異なる量であり、異なる質問に答えます。観測されたClastに基づくAUCinfと予測されたClastに基づくものでも同様です。結果を見てから選択することは、陰性試験を陽性にする方法です。

2. 構造モデル、変動モデル、共変量モデルは、それぞれ独立した決定事項である。 これらは常に混同されます。例えば、実際にはモデル化されていない時期間変動を吸収するためにコンパートメントを追加したり、実際には誤った吸収モデルを修正するために共変量を追加したりします。いずれかを変更する前に、どれが間違っているかを診断してください。

3. 収束は識別可能性ではない。 パラメータの相対標準誤差が200%のフィット、または二つのパラメータ間の相関が0.99のフィットは、データがそれらを分離できないことを示しています。ここにあるすべてのフィッティングスクリプトは、両方を報告しフラグを立てます。なぜなら、パラメータ表だけでは、まさにこの状況で問題なく見えるからです。

適用範囲

このスキルは、計算、診断、構造化を行います。製剤がバイオアベイラブルであると判断したり、試験の用量を選択したり、患者に用量を推奨したり、薬物にQTリスクがないと結論付けたり、資格のある薬物動態学者、臨床薬理学者、または規制当局の審査を代替することはしません。スクリプトは報告するものであり、結論を下すものではありません。特にtdm_bayes.pyはモデリング支援ツールであり、患者のレジメンの変更はすべて主治医の判断です。

スクリプト

cd skills/pkpd-modeling/scripts
スクリプト回答する質問
nca.py曝露指標は何か、また終末相はそれらを報告するのに十分か?
fit_compartmental.pyこれらのデータはどの構造モデルを支持し、そのパラメータは識別可能か?
simulate_regimen.pyこのレジメンは定常状態で何を行い、集団のどの割合に影響を与えるか?
check_popk_dataset.pyNONMEMはこのデータセットを私が思うように読み取るか?
exposure_response.py曝露-反応関係は存在するか、またプラトーはデータ内にあるか?
bioequivalence.py90%信頼区間は基準を満たしているか、またどの基準が適用されるか?
allometry_and_fih.py開始用量、またはより小さい/若い集団での用量は?
ddi_static.pyin vitroデータはICH M12に基づく臨床DDI試験をトリガーするか?
tdm_bayes.py測定値から得られたこの患者の個別パラメータは?

すべてのスクリプトは --format table|tsv|json を受け付けます。データは標準出力に、来歴と所見は標準エラー出力に送られるため、> out.tsv でそれらを分離できます。終了コードは、所見なしで 0、所見が発生した場合 1、不正な入力で 2 であり、いずれもワークフローのゲートとして使用できます。

二つのプライベートモジュールが共有機構を担います:_models.py(線形マミラリーモデルの解析解、統合ミカエリス・メンテン、TMDD、間接応答構造を含む)および _common.py(I/Oと報告)。これらをインポートして、バッテマン関数を再導出しないでください。

ワークフロー

1. ノンコンパートメント解析

python3 nca.py -i profile.csv --dose 100 --route extravascular --partial-auc 0-24

四つの選択が答えを決定し、通常は暗黙のうちに残されます。このスクリプトは四つすべてを明示的にします:--auc-method(デフォルト linup-logdown)、--blq-rule、--lambda-z-points または明示的な --lambda-z-window、そして auc_inf_obs または auc_inf_pred のどちらを報告するか。

ラムダZの選択は標準的なルールを使用します:最後の三つの定量可能なポイントから開始し、後方に拡張し、調整済み r二乗が0.0001以上改善された場合にのみ長いウィンドウを保持します。単純なr二乗はポイントが追加されるにつれてのみ増加するため、常に最長のウィンドウを選択します。Tmax以前のポイントは決して対象になりません。Tmaxを含めると吸収の尾部に適合し、半減期、Vz、AUCinfを下方にバイアスします。

ノイズのないシミュレーションされた1-コンパートメント経口プロファイル(CL/F = 5、V/F = 20、ka = 1.2)で:

id  cmax     tmax  auc_last  lambda_z  t_half   r2_adj  auc_inf_obs  pct_auc_extrap  cl_f     vz_f
1   3.29678  1.5   19.8737   0.25      2.77259  1       19.8739      0.000781037     5.03173  20.1269

CL/Fの0.6%過大評価は、スパースにサンプリングされた吸収相での台形則によるものであり、誤差ではありません。それはそのサンプリングスケジュールでのNCAの不可避なバイアスであり、NCAとコンパートメントモデルによるクリアランス推定値が決して完全には一致しない理由です。

所見がポイントです。定常状態プロファイルがタウで打ち切られた場合:

finding: subject A: 25.2% of AUCinf is extrapolated (above 20%); AUCinf is driven by the
         lambda_z fit, not by data
finding: subject A: lambda_z window spans 0.58 half-lives (below 2.0); the terminal phase may
         not have been reached

両方とも正しく、日常的に無視されています。定常状態では、報告可能な曝露指標はAUC(0-tau)であり、AUCinfではありません。スクリプトはとにかくAUCinfを計算し、それを信頼しないように指示します。

2. コンパートメントモデルフィッティングとモデル選択

python3 fit_compartmental.py -i profile.csv --dose 500 --route iv-bolus --compare 1cmt,2cmt,3cmt

パラメータは対数スケールで推定されるため、負になることはなく、信頼区間は非対称になります。重み付けのデフォルトは 1/y2(一定CV)であり、これはPKには正しいデフォルトですが、等分散性のPDエンドポイントには誤りです。

シミュレーションされた2-コンパートメントデータ(CL 4、V1 12、Q 6、V2 40、8%比例誤差)のフィッティング:

model  parameters  wssr       aic       bic       f_vs_simpler  f_p_value    compared_with
1cmt   2           3.13201    -19.4956  -18.0795  n/a           n/a          n/a
2cmt   4           0.0309579  -84.7477  -81.9155  550.936       9.38016e-12  1cmt
3cmt   6           0.0232859  -85.0193  -80.771   1.4826        0.27762      2cmt

AICは3-コンパートメントモデルを選択します。BICとF検定は両方ともそれを棄却します。 AICのパラメータあたり2の固定ペナルティはこのサンプルサイズでは弱く、過パラメータ化されたモデルを実務家が予想するよりも頻繁に選択します。パラメータ表がそれを解決します:

finding: fit: Q3 has 98% RSE - not estimable from these data at this model size
finding: fit: V3 has 71% RSE - not estimable from these data at this model size

一方、1-コンパートメントフィットは以下の所見を生じます:

finding: fit: residual signs are not random (runs test p = 0.0036) - a structural
         misspecification, which no amount of reweighting will fix

構造的な誤特定と誤った誤差モデルの区別、これが正しく理解すべき点です。同じ符号のランを持つ残差-時間プロットは、モデル形状が間違っていることを意味します。ランダムな符号を持つ不均一分散の残差は、重み付けが間違っていることを意味します。前者を再重み付けすることは、それを隠すだけで修正にはなりません。

3. ポピュレーションPK

何かを実行する前にデータセットを確認してください。これが実際に時間を費やすところです。

python3 check_popk_dataset.py -i nmdata.csv --covariates WT,CRCL --time-varying WT

重要な欠陥は、静かなものです。NM-TRANは非数値のDVを拒否しません。BLQ をゼロとして読み取り、真のゼロ濃度として適合させます。空白の共変量は0になるため、欠損した体重は0 kgの患者になります。II のない ADDL は追加の用量を配置しません。タイムスタンプを共有するレコードはファイル順に適用されるため、レベルが投与前か投与後かは、どの行が最初に来たかに依存します。これらのいずれも実行を停止しません。

severity  check                            detail
error     non-numeric DV                   DV contains text... NM-TRAN reads them as 0
error     subject with no dose             1 subject(s) have observations but no dose: 2
error     TIME not sorted                  1 subject(s) have out-of-order TIME: 1
error     covariate WT missing             1 record(s) have no value...
warning   duplicate TIME within a subject  NONMEM applies them in file order...

推定自体については、このスキルはNLMEを再実装しません。推定方法、BLQ M1-M7法、共変量モデル構築、モデル許容性を判断する診断法については references/population-pk.md を、どのツールを使用すべきかについては references/software-ecosystem.md を参照してください。

4. シミュレーションとレジメン選択

python3 simulate_regimen.py --cl 5 --v 40 --dose 500 --interval 12 --n-doses 10 --steady-state
python3 simulate_regimen.py --cl 5 --v 40 --dose 500 --interval 12 --n-doses 10 \
    --simulate 2000 --omega-cl 0.35 --omega-v 0.25 --target-trough 4.0

決定論的シミュレーションは「典型的な患者はどのように見えるか」に答え、これはほとんどの場合、質問ではありません:

metric             p5        p25      median   p75      p95      geo_mean
peak               11.861    14.6018  16.6702  19.1476  22.9339  16.6453
trough             0.863226  2.15191  3.64412  5.49655  9.21053  3.27035

target       fraction_attaining
trough >= 4  0.444

典型的なトラフ値は3.6で、目標は4であるため、集団の44%がそれを達成します。典型的な患者に基づいて調整されたレジメンは、集団の約半数を目標の反対側に残します。ここで報告された達成率は依然として楽観的です。これは個人間変動のみであり、残差変動や時期間変動は含まれていません。

線形モデルは解析的に解かれ、重ね合わされます。これは正確です。--nonlinear は統合ミカエリス・メンテン排泄に切り替え、ここでは重ね合わせは無効であり、複数回投与の挙動を単回投与から推測することはまったくできません。

5. 曝露-反応

python3 exposure_response.py --emax -i er.csv --sigmoid
python3 exposure_response.py --cqtc -i qt.csv --cmax 250

Emaxフィットは fraction_of_emax_reached を報告し、プラトーがデータの外側にあるフィットにフラグを立てます。観測された最高曝露が推定されたEmaxの3分の1にしか達しない場合、EmaxとEC50は互いに強く相関する外挿値であり、それらを独立した推定値として引用することは支持できません。また、「線形」な曝露-反応は、単に同じ曲線の低濃度部分です。

--cqtc は、予測されたプラセボ補正ベースラインからのQTc変化の両側90%信頼区間の上限を10 ms閾値に対して評価します。これはICH E14が実際に問う質問です。点推定値や95%区間は異なる質問に答えます。バンドルされたモデルはスクリーニング用の通常の線形回帰です。提出グレードのC-QTc解析では、被験者ごとのランダムな切片と傾きを持つ混合モデルが必要です。

すべてのモードは同じ注意事項を伴います。なぜなら、それが忘れられることだからです:患者は用量に無作為化され、曝露には無作為化されません。分位数を横断する曝露-反応は、無作為化試験内であっても観察的であり、クリアランスを駆動する共変量を反映する可能性があります。

6. バイオアベイラビリティ

python3 bioequivalence.py -i be.csv --design 2x2 --metric AUC
python3 bioequivalence.py -i be.csv --design replicate --metric Cmax --scaling both
python3 bioequivalence.py --power --cv 0.30 --gmr 0.95 --target-power 0.80

三つの基準が「バイオアベイラビリティ」という言葉を共有し、互換性がありません:平均BE(90% CIが80.00-125.00%以内)、EMAのABEL(CVwRの関数として拡大された限界、69.84-143.19%で上限、点推定は依然80-125%以内)、FDAのRSABE(Hyslop法によるスケーリングされた線形化境界、区間ではありません)。--scaling は2x2デザインでの実行を拒否します:

error: reference-scaling requires --design replicate. High observed variability in a 2x2 study
does not license widening: without replicated reference administrations there is no estimate of
within-subject reference variability to scale to.

サンプルサイズは公開された表を正確に再現します(CV 30%、GMR 0.95、80%検出力→2x2でN = 40)。検出力は、標準誤差を既知として扱うのではなく、推定標準偏差の標本分布を積分することによって計算されます。正規近似は現実的なサンプルサイズで検出力を過大評価します。NはCVよりも仮定されたGMRによってはるかに大きく影響されることに注意してください。1.00の代わりに0.95を仮定すると、計算されたNはほぼ半分になり、これがBE試験が検出力不足になる通常の理由です。

7. スケーリング、小児、初回投与

python3 allometry_and_fih.py --scale --cl 5 --weight-from 70 --weight-to 6 --pma-weeks 44
python3 allometry_and_fih.py --fih --noael rat=50,dog=10 --safety-factor 10

約2歳未満でサイズのみによるスケーリングはクリアランスを過大予測し、新生児では数倍になります。なぜなら、クリアランスはサイズではなく酵素と腎臓の成熟によって制限されるからです。--pma-weeks を指定すると、Anderson-Holfordのシグモイド成熟項が追加されます。20 kg未満でこれを省略すると所見が発生します。

parameter  reference  exponent  size_scaled  maturation_factor  final
CL         5          0.75      0.792063     0.30634            0.242641
V          40         1         3.42857      1                  3.42857

サイズのみでは0.79 L/hを予測しますが、修正胎齢44週での成熟を加えると0.24 L/hであり、3.3倍の差があります。体積は成熟しません。成熟は排泄能力を説明するものであり、分布スペースではありません。

--fih はFDAの2005年最大安全開始用量ガイダンスからの体表面積換算を使用し、NOAEL由来のMRSDだけではアゴニスト免疫調節薬に対して十分でないという所見を常に発します:--mabel でMABELを計算し、低い値を採用してください。

8. 薬物相互作用

python3 ddi_static.py --basic --ki 0.5 --imax 2.0 --fu 0.05 --dose 0.4
python3 ddi_static.py --msm --ki 0.5 --imax 2.0 --fu 0.05 --dose 0.4 --fm 0.9 --fg 0.7

ICH M12基本モデルとそのカットオフ値(R1 ≥ 1.02 肝臓、≥ 11 腸管...

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.

関連スキル