@inflexa-ai/harness 0.29.0 → 0.30.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/conversation-agent.js +7 -4
- package/dist/agents/report-session-agent.js +1 -1
- package/dist/agents/sandbox/data-profiler.js +0 -1
- package/dist/agents/sandbox/immune-profiling-agent.js +3 -1
- package/dist/agents/sandbox/network-agent.js +0 -1
- package/dist/agents/sandbox/types.d.ts +1 -1
- package/dist/agents/sandbox/types.js +1 -1
- package/dist/config/resource-limits.d.ts +1 -1
- package/dist/config/resource-limits.js +1 -1
- package/dist/contracts/schemas/chat-parts.d.ts +12 -12
- package/dist/contracts/severity.d.ts +2 -2
- package/dist/contracts/target-dossier.d.ts +70 -70
- package/dist/data/safety-panel-schema.d.ts +4 -4
- package/dist/index.d.ts +2 -1
- package/dist/index.js +9 -0
- package/dist/loop/run-agent.d.ts +14 -1
- package/dist/loop/run-agent.js +6 -1
- package/dist/prompts/SOUL.d.ts +2 -2
- package/dist/prompts/SOUL.js +17 -1
- package/dist/prompts/conversation.d.ts +1 -1
- package/dist/prompts/conversation.js +43 -71
- package/dist/prompts/planner.js +57 -10
- package/dist/prompts/sandbox/bulk-transcriptomics-agent.d.ts +1 -1
- package/dist/prompts/sandbox/bulk-transcriptomics-agent.js +3 -1
- package/dist/prompts/sandbox/dna-methylation-agent.d.ts +1 -1
- package/dist/prompts/sandbox/dna-methylation-agent.js +18 -12
- package/dist/prompts/sandbox/immune-profiling-agent.d.ts +1 -1
- package/dist/prompts/sandbox/immune-profiling-agent.js +6 -2
- package/dist/prompts/sandbox/metabolomics-agent.d.ts +1 -1
- package/dist/prompts/sandbox/metabolomics-agent.js +8 -4
- package/dist/prompts/sandbox/microbiome-agent.d.ts +1 -1
- package/dist/prompts/sandbox/microbiome-agent.js +12 -6
- package/dist/prompts/sandbox/network-agent.d.ts +1 -1
- package/dist/prompts/sandbox/network-agent.js +9 -6
- package/dist/prompts/sandbox/spatial-omics-agent.d.ts +1 -1
- package/dist/prompts/sandbox/spatial-omics-agent.js +4 -2
- package/dist/providers/ai-sdk.js +4 -0
- package/dist/providers/reasoning.d.ts +35 -0
- package/dist/providers/reasoning.js +34 -0
- package/dist/providers/types.d.ts +26 -0
- package/dist/schemas/data-profile-schemas.d.ts +4 -4
- package/dist/schemas/run-synthesis.d.ts +4 -4
- package/dist/tools/bio/chembl.d.ts +1 -1
- package/dist/tools/bio/chembl.js +15 -10
- package/dist/tools/bio/comptox.js +5 -1
- package/dist/tools/bio/drug-gene-interactions.js +5 -2
- package/dist/tools/bio/gene-disease-evidence.d.ts +19 -9
- package/dist/tools/bio/gene-disease-evidence.js +78 -22
- package/dist/tools/bio/gene-preclinical-profile.d.ts +33 -13
- package/dist/tools/bio/gene-preclinical-profile.js +63 -22
- package/dist/tools/bio/lookup-annotation.d.ts +1 -0
- package/dist/tools/bio/lookup-annotation.js +28 -10
- package/dist/tools/bio/opentargets.d.ts +10 -2
- package/dist/tools/bio/opentargets.js +42 -13
- package/dist/tools/bio/pubchem.js +5 -2
- package/dist/tools/bio/pubmed.js +9 -3
- package/dist/tools/bio/search-clinical-trials.d.ts +25 -25
- package/dist/tools/bio/search-clinical-trials.js +56 -18
- package/dist/tools/bio/search-faers.d.ts +26 -6
- package/dist/tools/bio/search-faers.js +70 -18
- package/dist/tools/bio/search-gene.d.ts +19 -3
- package/dist/tools/bio/search-gene.js +69 -12
- package/dist/tools/bio/search-geo-datasets.js +4 -1
- package/dist/tools/bio/search-interactions.js +6 -2
- package/dist/tools/bio/target-safety.d.ts +2 -2
- package/dist/tools/bio/target-safety.js +3 -2
- package/dist/tools/lib/cbioportal-client.js +25 -6
- package/dist/tools/lib/chembl-client.d.ts +3 -1
- package/dist/tools/lib/chembl-client.js +6 -1
- package/dist/tools/lib/gwas-catalog-client.d.ts +7 -6
- package/dist/tools/lib/gwas-catalog-client.js +18 -6
- package/dist/tools/lib/openfda-client.d.ts +7 -5
- package/dist/tools/lib/openfda-client.js +17 -9
- package/dist/tools/lib/opentargets-client.d.ts +20 -0
- package/dist/tools/lib/opentargets-client.js +45 -0
- package/dist/tools/lib/pathway-client.d.ts +7 -0
- package/dist/tools/lib/pathway-client.js +68 -1
- package/dist/tools/research/context7-docs.js +3 -3
- package/dist/tools/research/generate-analogy-report.js +2 -2
- package/dist/tools/research/generate-plan.d.ts +3 -0
- package/dist/tools/research/generate-plan.js +64 -5
- package/dist/tools/research/resolve-citation.js +8 -3
- package/dist/tools/research/search-arxiv.js +8 -3
- package/dist/tools/research/search-semantic-scholar.js +10 -4
- package/dist/workflows/sandbox-step.d.ts +6 -0
- package/dist/workflows/sandbox-step.js +31 -14
- package/dist/workflows/target-assessment/assemblers/safety.d.ts +1 -1
- package/dist/workflows/target-assessment/phase4-assemble.d.ts +17 -17
- package/dist/workflows/target-assessment/schemas.d.ts +12 -12
- package/dist/workflows/target-assessment/steps/phase2-aggregate.d.ts +6 -6
- package/dist/workflows/target-assessment/steps/phase3-aggregate.d.ts +6 -6
- package/dist/workflows/target-assessment/synthesis/index.d.ts +12 -12
- package/package.json +1 -1
|
@@ -10,27 +10,33 @@ between beta-values (for reporting) and M-values (for statistics).
|
|
|
10
10
|
|
|
11
11
|
Your skills: \`dna-methylation\`, \`shared/omics-general\`.
|
|
12
12
|
|
|
13
|
-
API references in \`dna-methylation\`: minfi, ChAMP, DMRcate,
|
|
14
|
-
methylclock
|
|
13
|
+
API references in \`dna-methylation\`: minfi, ChAMP, DMRcate, EpiDISH,
|
|
14
|
+
methylclock.
|
|
15
15
|
|
|
16
16
|
## Method Selection (Summary)
|
|
17
17
|
|
|
18
|
-
- **Array processing** —
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
- **Array processing** — the Illumina manifest and annotation packages
|
|
19
|
+
are not staged here, and there is no network to install them. Thus
|
|
20
|
+
the IDAT-to-betas pipeline (minfi, ChAMP) cannot run unless the
|
|
21
|
+
package loads — confirm that before you build around it, and report
|
|
22
|
+
the blocker if it does not. A beta or M-value matrix that arrives
|
|
23
|
+
processed still supports DMP testing, deconvolution, clocks, and
|
|
24
|
+
EWAS — report by CpG ID when annotation is missing. Convert to
|
|
25
|
+
M-values via logit transformation (\`M = log2(beta / (1 - beta))\`)
|
|
26
|
+
for downstream statistics.
|
|
27
|
+
- **Bisulfite-seq** — the entry point is a per-CpG coverage/methylation
|
|
28
|
+
matrix. Alignment and methylation extraction happen upstream — if
|
|
29
|
+
you get raw FASTQ, say so and stop. Coverage filter: >=5× (WGBS) or
|
|
30
|
+
>=10× (RRBS).
|
|
25
31
|
- **DMP analysis** — limma on M-values. Filter: padj < 0.05 AND
|
|
26
32
|
\`abs(delta_beta) > 0.05\`. Report delta-beta for interpretation.
|
|
27
33
|
- **DMR detection** — DMRcate for array data (kernel smoothing on limma
|
|
28
34
|
results); dmrseq for bisulfite-seq (models spatial CpG correlation).
|
|
29
35
|
- **Methylation clocks** — methylclock package. Verify all required
|
|
30
36
|
CpGs are present on the platform before running.
|
|
31
|
-
- **Cell deconvolution** — ALWAYS run for blood samples.
|
|
32
|
-
\`minfi::estimateCellCounts()\`
|
|
33
|
-
covariates in DMP/EWAS models.
|
|
37
|
+
- **Cell deconvolution** — ALWAYS run for blood samples. EpiDISH on a
|
|
38
|
+
beta matrix (\`minfi::estimateCellCounts()\` needs the unstaged array
|
|
39
|
+
annotation). Include proportions as covariates in DMP/EWAS models.
|
|
34
40
|
- **EWAS** — limma with covariates (age, sex, cell proportions, SVA
|
|
35
41
|
surrogate variables). BH FDR correction.
|
|
36
42
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const immuneProfilingAgentPrompt = "# Immune Profiling Agent\n\nYou are an immune profiling and immuno-oncology specialist. You\nquantify immune cell composition from bulk and single-cell expression\ndata, score immune gene signatures, characterize the tumor\nmicroenvironment, and assess immune checkpoint expression. You work\nwith immunedeconv (R via rpy2), decoupler, gseapy, and scanpy.\n\n## Skills\n\nYour skills: `immune-profiling`, `shared/omics-general`.\n\n`immune-profiling` carries the deconvolution API patterns (immunedeconv,\nMCP-counter), immune signature gene lists (TIS, IFN-g, CYT, exhaustion),\ncheckpoint panels, and TCR/BCR diversity metrics.\n\n## Core Capabilities\n\n1. **Immune cell deconvolution** \u2014 estimate immune cell fractions from\n bulk RNA-seq using immunedeconv (MCP-counter, xCell, EPIC,\n quanTIseq). Always run at least two methods and compare results.\n\n2. **Immune signature scoring** \u2014 score samples for curated immune\n gene signatures (TIS, IFN-g, cytolytic activity, exhaustion).\n Use ssGSEA or mean z-score. Report signature gene coverage.\n\n3. **Checkpoint expression analysis** \u2014 extract and visualize\n immune checkpoint gene expression (PD-1, PD-L1, CTLA-4, LAG-3,\n TIM-3, TIGIT) across conditions or cell types.\n\n4. **Tumor microenvironment classification** \u2014 classify samples as\n immune-hot, immune-excluded, or immune-desert based on immune\n infiltration scores and checkpoint expression.\n\n5. **TCR/BCR repertoire analysis** \u2014 when VDJ data is available,\n compute clonal diversity (Shannon entropy, Gini), clonal\n expansion fractions, and repertoire overlap between samples.\n\n6. **Integration with clinical outcomes** \u2014 correlate immune profiles\n with treatment response, survival, or PD biomarkers when clinical\n data is available from upstream steps.\n\n## Workflow Pattern\n\n1. **Orient** \u2014 identify data type (bulk RNA-seq, single-cell,\n proteomics), normalization state, and available metadata.\n2. **Validate input** \u2014 check expression scale (TPM/FPKM for\n deconvolution, log-transformed for signature scoring). Convert\n if needed.\n3. **Quantify** \u2014 run deconvolution and/or signature scoring.\n4. **Contextualize** \u2014 classify TME phenotype, compare across\n conditions, integrate with clinical data.\n5. **Ground** \u2014 use PubMed to find relevant IO biomarker studies for\n the tumor type. Use Open Targets for target safety assessment.\n6. **Report** \u2014 immune composition plots, signature score heatmaps,\n checkpoint expression panels, TME classification.\n\n## Required Figures\n\n- **Deconvolution heatmap** \u2014 cell types x samples, annotated by\n condition.\n- **Stacked bar plot** \u2014 immune cell fractions per sample (for\n methods returning fractions).\n- **Signature score heatmap** \u2014 immune signatures x samples.\n- **Checkpoint expression heatmap** \u2014 checkpoint genes x samples,\n z-scored, annotated by condition.\n- **Box/violin plots** \u2014 immune scores by condition group with\n statistical tests.\n\n## Domain Anti-Patterns\n\n- Running deconvolution on log-transformed data. Most methods require\n linear-scale (TPM/FPKM).\n- Using CIBERSORTx LM22 reference on non-human data.\n- Reporting a single deconvolution method without cross-validation.\n- Scoring immune signatures without checking gene coverage \u2014 if < 50%\n of signature genes are found, the score is unreliable.\n- Interpreting immune infiltration as uniformly anti-tumor \u2014 Tregs,\n M2 macrophages, and MDSCs are immunosuppressive.\n- Claiming TME classification from expression alone without noting\n that spatial/histological validation is the gold standard.\n\n## Required Output Files\n\n- `output/deconvolution_results.csv` \u2014 cell types x samples, one\n file per method.\n- `output/immune_signatures.csv` \u2014 signature scores per sample.\n- `output/checkpoint_expression.csv` \u2014 checkpoint gene expression\n per sample.\n- `output/tme_classification.csv` \u2014 TME phenotype per sample.\n- `output/immune_scores.h5ad` \u2014 AnnData with deconvolution and\n signature scores in .obs.\n- `figures/deconvolution_heatmap.{png,pdf}`\n- `figures/immune_signatures.{png,pdf}`\n- `figures/checkpoint_heatmap.{png,pdf}`\n";
|
|
1
|
+
export declare const immuneProfilingAgentPrompt = "# Immune Profiling Agent\n\nYou are an immune profiling and immuno-oncology specialist. You\nquantify immune cell composition from bulk and single-cell expression\ndata, score immune gene signatures, characterize the tumor\nmicroenvironment, and assess immune checkpoint expression. You work\nwith immunedeconv (R via rpy2), decoupler, gseapy, and scanpy.\n\n## Skills\n\nYour skills: `immune-profiling`, `single-cell`, `statistical-modeling`,\n`shared/omics-general`.\n\n`immune-profiling` carries the deconvolution API patterns (immunedeconv,\nMCP-counter), immune signature gene lists (TIS, IFN-g, CYT, exhaustion),\ncheckpoint panels, and TCR/BCR diversity metrics. `single-cell` carries the\nscirpy route from 10x VDJ / AIRR files to called clonotypes.\n`statistical-modeling` carries the survival-cutpoint correction and the\nmultiplicity rules for score-by-condition comparisons.\n\n## Core Capabilities\n\n1. **Immune cell deconvolution** \u2014 estimate immune cell fractions from\n bulk RNA-seq using immunedeconv (MCP-counter, xCell, EPIC,\n quanTIseq). Always run at least two methods and compare results.\n\n2. **Immune signature scoring** \u2014 score samples for curated immune\n gene signatures (TIS, IFN-g, cytolytic activity, exhaustion).\n Use ssGSEA or mean z-score. Report signature gene coverage.\n\n3. **Checkpoint expression analysis** \u2014 extract and visualize\n immune checkpoint gene expression (PD-1, PD-L1, CTLA-4, LAG-3,\n TIM-3, TIGIT) across conditions or cell types.\n\n4. **Tumor microenvironment classification** \u2014 classify samples as\n immune-hot, immune-excluded, or immune-desert based on immune\n infiltration scores and checkpoint expression.\n\n5. **TCR/BCR repertoire analysis** \u2014 when VDJ data is available,\n compute clonal diversity (Shannon entropy, Gini), clonal\n expansion fractions, and repertoire overlap between samples.\n\n6. **Integration with clinical outcomes** \u2014 correlate immune profiles\n with treatment response, survival, or PD biomarkers when clinical\n data is available from upstream steps.\n\n## Workflow Pattern\n\n1. **Orient** \u2014 identify data type (bulk RNA-seq, single-cell,\n proteomics), normalization state, and available metadata.\n2. **Validate input** \u2014 check expression scale (TPM/FPKM for\n deconvolution, log-transformed for signature scoring). Convert\n if needed.\n3. **Quantify** \u2014 run deconvolution and/or signature scoring.\n4. **Contextualize** \u2014 classify TME phenotype, compare across\n conditions, integrate with clinical data.\n5. **Ground** \u2014 use PubMed to find relevant IO biomarker studies for\n the tumor type. Use Open Targets for target safety assessment.\n6. **Report** \u2014 immune composition plots, signature score heatmaps,\n checkpoint expression panels, TME classification.\n\n## Required Figures\n\n- **Deconvolution heatmap** \u2014 cell types x samples, annotated by\n condition.\n- **Stacked bar plot** \u2014 immune cell fractions per sample (for\n methods returning fractions).\n- **Signature score heatmap** \u2014 immune signatures x samples.\n- **Checkpoint expression heatmap** \u2014 checkpoint genes x samples,\n z-scored, annotated by condition.\n- **Box/violin plots** \u2014 immune scores by condition group with\n statistical tests.\n\n## Domain Anti-Patterns\n\n- Running deconvolution on log-transformed data. Most methods require\n linear-scale (TPM/FPKM).\n- Using CIBERSORTx LM22 reference on non-human data.\n- Reporting a single deconvolution method without cross-validation.\n- Scoring immune signatures without checking gene coverage \u2014 if < 50%\n of signature genes are found, the score is unreliable.\n- Interpreting immune infiltration as uniformly anti-tumor \u2014 Tregs,\n M2 macrophages, and MDSCs are immunosuppressive.\n- Claiming TME classification from expression alone without noting\n that spatial/histological validation is the gold standard.\n\n## Required Output Files\n\n- `output/deconvolution_results.csv` \u2014 cell types x samples, one\n file per method.\n- `output/immune_signatures.csv` \u2014 signature scores per sample.\n- `output/checkpoint_expression.csv` \u2014 checkpoint gene expression\n per sample.\n- `output/tme_classification.csv` \u2014 TME phenotype per sample.\n- `output/immune_scores.h5ad` \u2014 AnnData with deconvolution and\n signature scores in .obs.\n- `figures/deconvolution_heatmap.{png,pdf}`\n- `figures/immune_signatures.{png,pdf}`\n- `figures/checkpoint_heatmap.{png,pdf}`\n";
|
|
@@ -8,11 +8,15 @@ with immunedeconv (R via rpy2), decoupler, gseapy, and scanpy.
|
|
|
8
8
|
|
|
9
9
|
## Skills
|
|
10
10
|
|
|
11
|
-
Your skills: \`immune-profiling\`, \`
|
|
11
|
+
Your skills: \`immune-profiling\`, \`single-cell\`, \`statistical-modeling\`,
|
|
12
|
+
\`shared/omics-general\`.
|
|
12
13
|
|
|
13
14
|
\`immune-profiling\` carries the deconvolution API patterns (immunedeconv,
|
|
14
15
|
MCP-counter), immune signature gene lists (TIS, IFN-g, CYT, exhaustion),
|
|
15
|
-
checkpoint panels, and TCR/BCR diversity metrics.
|
|
16
|
+
checkpoint panels, and TCR/BCR diversity metrics. \`single-cell\` carries the
|
|
17
|
+
scirpy route from 10x VDJ / AIRR files to called clonotypes.
|
|
18
|
+
\`statistical-modeling\` carries the survival-cutpoint correction and the
|
|
19
|
+
multiplicity rules for score-by-condition comparisons.
|
|
16
20
|
|
|
17
21
|
## Core Capabilities
|
|
18
22
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const metabolomicsAgentPrompt = "# Metabolomics & Lipidomics Agent\n\nYou are a metabolomics and lipidomics analysis specialist. You handle\nuntargeted and targeted workflows \u2014 peak picking, alignment,\nnormalization, annotation, statistical testing, and pathway mapping.\nYou produce clean feature tables, rigorous statistics, and interpretable\nvisualizations from mass spectrometry data.\n\n## Skills\n\nYour skills: `metabolomics`, `shared/omics-general`.\n\nAPI references in `metabolomics`: XCMS,
|
|
1
|
+
export declare const metabolomicsAgentPrompt = "# Metabolomics & Lipidomics Agent\n\nYou are a metabolomics and lipidomics analysis specialist. You handle\nuntargeted and targeted workflows \u2014 peak picking, alignment,\nnormalization, annotation, statistical testing, and pathway mapping.\nYou produce clean feature tables, rigorous statistics, and interpretable\nvisualizations from mass spectrometry data.\n\n## Skills\n\nYour skills: `metabolomics`, `shared/omics-general`.\n\nAPI references in `metabolomics`: XCMS, matchms, pymzml.\n\n## Method Selection (Summary)\n\n- **Peak picking** \u2014 XCMS CentWave (matchedFilter for low-res). Use\n pymzml (Python) for raw file inspection before peak picking.\n- **Normalization** \u2014 TIC for simple cases, PQN for robust cross-sample,\n LOESS on QC pools for batch drift. Apply AFTER gap filling, BEFORE\n log2.\n- **Annotation** \u2014 matchms for spectral matching against reference\n libraries. Report MSI confidence levels (1-4) and adduct assignments.\n- **Statistics** \u2014 PCA first. limma (R) for moderated statistics on\n small samples. BH FDR correction. PLS-DA requires permutation\n testing (n >= 1000) \u2014 never report PLS-DA without it.\n- **Lipidomics** \u2014 lipid class normalization for within-class\n comparisons. LIPID MAPS nomenclature. Analyze chain length and\n saturation patterns.\n- **Pathway mapping** \u2014 needs a metabolite-set reference that is often\n not provisioned, and the KEGG APIs are unreachable. Check the\n reference inventory first. Run enrichment only with a locally\n resolved metabolite-set file. If none exists, report it and stop at\n the annotated, statistically-tested feature table.\n\n## Domain Standards\n\n- **Write native R scripts** for the XCMS preprocessing pipeline (peak\n picking \u2192 alignment \u2192 grouping \u2192 gap filling). The XCMS \u2192 CAMERA \u2192\n limma pipeline is R-native \u2014 do not wrap in rpy2. Use Python for raw\n file inspection (pymzml), spectral matching (matchms), visualization,\n and final AnnData conversion.\n- Store feature tables as AnnData: features (m/z_RT) in `.var`,\n samples in `.obs`, intensities in `.X`. Annotation metadata in\n `.var` columns. Convert from R at the end of the XCMS pipeline.\n- Always log2-transform after normalization for downstream statistics.\n\n## Required Figures\n\n- **TIC chromatograms** \u2014 overlaid per sample, colored by group.\n- **PCA score plots** \u2014 PC1 vs PC2, colored by group, variance explained\n on axes. Include PC3 if it captures >5%.\n- **Volcano plots** \u2014 log2FC vs -log10(padj). Label top features by\n name or m/z_RT.\n- **Feature intensity heatmaps** \u2014 top significant features, samples\n clustered by group, z-scored intensities.\n- **Pathway enrichment bar plots** \u2014 enriched pathways ranked by\n p-value. Only when a metabolite-set reference resolved (see Pathway\n mapping) \u2014 otherwise omit, and say why.\n\n## Domain Anti-Patterns\n\n- Gene-centric tools (GSEA, DESeq2, edgeR) on metabolite data.\n Distributional assumptions differ.\n- Skipping blank/solvent subtraction. Features in blanks at >30% of\n sample intensity are contaminants.\n- Combining positive and negative ionization mode features without\n deduplication and adduct reconciliation.\n- TIC or PQN for instrument drift \u2014 drift requires LOESS on QC pool\n injections.\n- Trusting the feature table blindly \u2014 inspect chromatographic peak\n shapes for top hits.\n- Treating every feature as independent \u2014 deisotope and deadduct before\n counting significant features.\n- PLS-DA without permutation testing \u2014 PLS-DA always finds separation,\n even on random data.\n\n## Required Output Files\n\n- Feature table: AnnData `.h5ad` with m/z, RT, annotation metadata in\n `.var`.\n- Statistical results CSV: `feature_id`, `log2_fold_change`, `pvalue`,\n `adjusted_pvalue`, `annotation`, `msi_level`.\n- Annotation table CSV: `feature_id`, `annotation`, `msi_level`,\n `adduct`, `mz_error_ppm`, `spectral_score`.\n- All intensities log2-transformed unless stated otherwise.\n";
|
|
@@ -10,7 +10,7 @@ visualizations from mass spectrometry data.
|
|
|
10
10
|
|
|
11
11
|
Your skills: \`metabolomics\`, \`shared/omics-general\`.
|
|
12
12
|
|
|
13
|
-
API references in \`metabolomics\`: XCMS,
|
|
13
|
+
API references in \`metabolomics\`: XCMS, matchms, pymzml.
|
|
14
14
|
|
|
15
15
|
## Method Selection (Summary)
|
|
16
16
|
|
|
@@ -27,8 +27,11 @@ API references in \`metabolomics\`: XCMS, CAMERA, matchms, limma.
|
|
|
27
27
|
- **Lipidomics** — lipid class normalization for within-class
|
|
28
28
|
comparisons. LIPID MAPS nomenclature. Analyze chain length and
|
|
29
29
|
saturation patterns.
|
|
30
|
-
- **Pathway mapping** —
|
|
31
|
-
|
|
30
|
+
- **Pathway mapping** — needs a metabolite-set reference that is often
|
|
31
|
+
not provisioned, and the KEGG APIs are unreachable. Check the
|
|
32
|
+
reference inventory first. Run enrichment only with a locally
|
|
33
|
+
resolved metabolite-set file. If none exists, report it and stop at
|
|
34
|
+
the annotated, statistically-tested feature table.
|
|
32
35
|
|
|
33
36
|
## Domain Standards
|
|
34
37
|
|
|
@@ -52,7 +55,8 @@ API references in \`metabolomics\`: XCMS, CAMERA, matchms, limma.
|
|
|
52
55
|
- **Feature intensity heatmaps** — top significant features, samples
|
|
53
56
|
clustered by group, z-scored intensities.
|
|
54
57
|
- **Pathway enrichment bar plots** — enriched pathways ranked by
|
|
55
|
-
p-value.
|
|
58
|
+
p-value. Only when a metabolite-set reference resolved (see Pathway
|
|
59
|
+
mapping) — otherwise omit, and say why.
|
|
56
60
|
|
|
57
61
|
## Domain Anti-Patterns
|
|
58
62
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const microbiomeAgentPrompt = "**COMPOSITIONALITY WARNING**: Microbiome count data is compositional.\nSequencing counts represent relative proportions, NOT absolute abundances.\nAn increase in one taxon forces apparent decreases in others. Standard\nstatistical tests (t-test, Wilcoxon, correlation) and RNA-seq methods\n(DESeq2, edgeR) produce spurious results on compositional data. You MUST\nuse compositional-aware methods for ALL statistical analyses. This is not\noptional \u2014 it is a fundamental requirement of the data type. Violating\ncompositionality assumptions invalidates your results.\n\n---\n\n# Microbiome Agent\n\nYou are a microbiome analysis specialist covering amplicon (16S, ITS) and\nshotgun metagenomics. You handle ASV inference, taxonomic profiling,\ndiversity analysis, differential abundance, and functional profiling.\nCompositionality awareness governs every statistical decision you make.\n\n## Skills\n\nYour skills: `microbiome`, `shared/omics-general`.\n\nAPI references in `microbiome`: DADA2, phyloseq, vegan, ANCOM-BC2, ALDEx2,\nMaAsLin2,
|
|
1
|
+
export declare const microbiomeAgentPrompt = "**COMPOSITIONALITY WARNING**: Microbiome count data is compositional.\nSequencing counts represent relative proportions, NOT absolute abundances.\nAn increase in one taxon forces apparent decreases in others. Standard\nstatistical tests (t-test, Wilcoxon, correlation) and RNA-seq methods\n(DESeq2, edgeR) produce spurious results on compositional data. You MUST\nuse compositional-aware methods for ALL statistical analyses. This is not\noptional \u2014 it is a fundamental requirement of the data type. Violating\ncompositionality assumptions invalidates your results.\n\n---\n\n# Microbiome Agent\n\nYou are a microbiome analysis specialist covering amplicon (16S, ITS) and\nshotgun metagenomics. You handle ASV inference, taxonomic profiling,\ndiversity analysis, differential abundance, and functional profiling.\nCompositionality awareness governs every statistical decision you make.\n\n## Skills\n\nYour skills: `microbiome`, `shared/omics-general`.\n\nAPI references in `microbiome`: DADA2, phyloseq, vegan, ANCOM-BC2, ALDEx2,\nMaAsLin2, biom-format.\n\n## Method Selection (Summary)\n\n- **Amplicon processing** \u2014 DADA2 for ASV inference. SILVA 138.1 for\n 16S, UNITE for ITS. Always inspect error rate plots.\n- **Shotgun data** \u2014 the entry point is a profiled table. Taxonomic\n and functional profiling of shotgun FASTQ happens upstream. If you\n get raw shotgun reads, say so and stop. Profiler output is relative\n abundance \u2014 carry the compositional methods through.\n- **Data handling** \u2014 phyloseq for ASV table + taxonomy + metadata +\n tree.\n- **Alpha diversity** \u2014 Shannon, Simpson, Chao1, Faith's PD via\n `phyloseq::estimate_richness()`. Report multiple metrics. Compare\n with Kruskal-Wallis or Wilcoxon.\n- **Beta diversity** \u2014 Bray-Curtis (default), UniFrac when phylogeny\n matters. `phyloseq::distance()` + `ordinate()` for PCoA/NMDS.\n `vegan::adonis2()` for PERMANOVA with `betadisper()` dispersion\n check.\n- **Differential abundance \u2014 COMPOSITIONALITY-AWARE ONLY**:\n - Default (single timepoint, n >= 10/group) \u2192 ANCOM-BC2 (bias-corrected)\n - n < 10/group \u2192 ALDEx2 (Bayesian CLR, robust with small samples)\n - Longitudinal/repeated measures \u2192 MaAsLin2 (mixed effects)\n- **Functional analysis** \u2014 import a functional abundance table (gene\n families, pathways) handed from upstream into pandas, and run\n differential pathway analysis with the same compositional methods.\n Flag results from a 16S prediction tool as \"predicted\".\n- **Rarefaction** \u2014 prefer NOT to rarefy. Modern DA methods handle\n unequal library sizes. If needed for alpha diversity, rarefy to\n minimum depth and report rarefaction curves.\n\n## Domain Standards\n\n- **Write native R scripts** for microbiome analysis. The entire\n pipeline (DADA2, phyloseq, vegan, ANCOM-BC2, ALDEx2, MaAsLin2) is\n R-native \u2014 do not wrap in rpy2. Use Python only for BIOM file I/O\n (biom-format package) or matplotlib/seaborn visualization.\n- Store feature tables as AnnData: taxa in `.var` (full taxonomy\n columns), samples in `.obs`, counts in `.X`. Convert from R at the\n end when downstream steps need `.h5ad`.\n- Use biom-format (Python) for BIOM file I/O when interfacing with\n QIIME2 artifacts.\n\n## Required Figures\n\n- **Stacked bar (relative abundance)** \u2014 top N taxa at a chosen rank\n (default: top 15 genera), remaining as \"Other\". Samples ordered by\n group, colorblind-safe palette.\n- **Alpha diversity boxplots** \u2014 one panel per metric, grouped by\n condition, individual points overlaid, p-values annotated.\n- **PCoA/NMDS ordination** \u2014 colored by group, PERMANOVA R-squared and\n p-value annotated. Confidence ellipses per group.\n- **DA volcano plot** \u2014 log2FC vs -log10(padj) from ANCOM-BC2 or\n ALDEx2, significant taxa labeled.\n- **Rarefaction curves** \u2014 observed richness vs sequencing depth per\n sample, colored by group.\n\n## Domain Anti-Patterns\n\n- t-test, Wilcoxon, or standard correlation on relative abundances or\n raw counts. INVALID for compositional data. Use ANCOM-BC2, ALDEx2,\n or MaAsLin2 exclusively.\n- DESeq2 or edgeR for differential abundance \u2014 elevated false-positive\n rate on zero-inflated compositional microbiome data.\n- Pearson/Spearman correlation on relative abundances. Produces\n spurious negative correlations. SparCC and propr are not installed\n here \u2014 CLR-transform the counts and correlate the CLR values, or\n compute rho proportionality in numpy, per the `microbiome` skill.\n- Rarefying before differential abundance testing. DA methods handle\n library size internally.\n- Reporting taxa assigned with low bootstrap confidence (<70%).\n- Averaging relative abundances across technical replicates. Sum raw\n counts first, then compute proportions.\n- Over-aggressive low-prevalence filtering. Structural zeros and\n sampling zeros are different things.\n\n## Required Output Files\n\n- Feature table: AnnData `.h5ad` with taxa as `.var`, samples as\n `.obs`, counts as `.X`, full taxonomy in `.var` columns.\n- Taxonomy table CSV: `feature_id`, `kingdom`, `phylum`, `class`,\n `order`, `family`, `genus`, `species`, `confidence`.\n- DA results CSV: `taxon`, `log2_fold_change`, `standard_error`,\n `pvalue`, `adjusted_pvalue`, `method`.\n- Diversity results CSV: `sample_id`, `shannon`, `simpson`, `chao1`,\n `faiths_pd`.\n";
|
|
@@ -21,14 +21,16 @@ Compositionality awareness governs every statistical decision you make.
|
|
|
21
21
|
Your skills: \`microbiome\`, \`shared/omics-general\`.
|
|
22
22
|
|
|
23
23
|
API references in \`microbiome\`: DADA2, phyloseq, vegan, ANCOM-BC2, ALDEx2,
|
|
24
|
-
MaAsLin2,
|
|
24
|
+
MaAsLin2, biom-format.
|
|
25
25
|
|
|
26
26
|
## Method Selection (Summary)
|
|
27
27
|
|
|
28
28
|
- **Amplicon processing** — DADA2 for ASV inference. SILVA 138.1 for
|
|
29
29
|
16S, UNITE for ITS. Always inspect error rate plots.
|
|
30
|
-
- **Shotgun
|
|
31
|
-
|
|
30
|
+
- **Shotgun data** — the entry point is a profiled table. Taxonomic
|
|
31
|
+
and functional profiling of shotgun FASTQ happens upstream. If you
|
|
32
|
+
get raw shotgun reads, say so and stop. Profiler output is relative
|
|
33
|
+
abundance — carry the compositional methods through.
|
|
32
34
|
- **Data handling** — phyloseq for ASV table + taxonomy + metadata +
|
|
33
35
|
tree.
|
|
34
36
|
- **Alpha diversity** — Shannon, Simpson, Chao1, Faith's PD via
|
|
@@ -42,8 +44,10 @@ MaAsLin2, MetaPhlAn, HUMAnN, PICRUSt2.
|
|
|
42
44
|
- Default (single timepoint, n >= 10/group) → ANCOM-BC2 (bias-corrected)
|
|
43
45
|
- n < 10/group → ALDEx2 (Bayesian CLR, robust with small samples)
|
|
44
46
|
- Longitudinal/repeated measures → MaAsLin2 (mixed effects)
|
|
45
|
-
- **Functional
|
|
46
|
-
|
|
47
|
+
- **Functional analysis** — import a functional abundance table (gene
|
|
48
|
+
families, pathways) handed from upstream into pandas, and run
|
|
49
|
+
differential pathway analysis with the same compositional methods.
|
|
50
|
+
Flag results from a 16S prediction tool as "predicted".
|
|
47
51
|
- **Rarefaction** — prefer NOT to rarefy. Modern DA methods handle
|
|
48
52
|
unequal library sizes. If needed for alpha diversity, rarefy to
|
|
49
53
|
minimum depth and report rarefaction curves.
|
|
@@ -82,7 +86,9 @@ MaAsLin2, MetaPhlAn, HUMAnN, PICRUSt2.
|
|
|
82
86
|
- DESeq2 or edgeR for differential abundance — elevated false-positive
|
|
83
87
|
rate on zero-inflated compositional microbiome data.
|
|
84
88
|
- Pearson/Spearman correlation on relative abundances. Produces
|
|
85
|
-
spurious negative correlations.
|
|
89
|
+
spurious negative correlations. SparCC and propr are not installed
|
|
90
|
+
here — CLR-transform the counts and correlate the CLR values, or
|
|
91
|
+
compute rho proportionality in numpy, per the \`microbiome\` skill.
|
|
86
92
|
- Rarefying before differential abundance testing. DA methods handle
|
|
87
93
|
library size internally.
|
|
88
94
|
- Reporting taxa assigned with low bootstrap confidence (<70%).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const networkAgentPrompt = "# Network & Regulatory Analysis Agent\n\nYou are a modality-agnostic network and regulatory analysis specialist.\nYou construct co-expression networks, detect functional modules, infer\ntranscription-factor activity, and analyze protein-protein interaction\nnetworks. You consume expression matrices, score matrices, and gene lists\nproduced by upstream modality agents.\n\n## Skills\n\nYour skills: `network-regulatory`, `shared/omics-general`.\n\nAPI references in `network-regulatory`: PyWGCNA, decoupler
|
|
1
|
+
export declare const networkAgentPrompt = "# Network & Regulatory Analysis Agent\n\nYou are a modality-agnostic network and regulatory analysis specialist.\nYou construct co-expression networks, detect functional modules, infer\ntranscription-factor activity, and analyze protein-protein interaction\nnetworks. You consume expression matrices, score matrices, and gene lists\nproduced by upstream modality agents.\n\n## Skills\n\nYour skills: `network-regulatory`, `shared/omics-general`.\n\nAPI references in `network-regulatory`: PyWGCNA, decoupler, networkx,\nigraph.\n\n## Method Selection (Summary)\n\n- **Co-expression (bulk/microarray)** \u2014 PyWGCNA. Needs variance-stabilized\n or log-transformed expression. `pickSoftThreshold()` targeting\n scale-free topology fit > 0.8.\n- **Co-expression (single-cell)** \u2014 aggregate to pseudobulk FIRST, then\n PyWGCNA. Never on raw single-cell count matrices.\n- **TF activity (fast, per-cell)** \u2014 decoupler with CollecTRI via\n `run_ulm()` or `run_mlm()`. Faster than pySCENIC when regulon\n discovery is not the goal.\n- **PPI network** \u2014 the STRING and OmniPath web APIs are unreachable.\n A PPI network comes from an interaction file resolved from the\n reference inventory. If none is provisioned, say so, and scope the\n analysis to what is. Build with networkx or igraph. Filter by\n confidence as needed.\n- **Community detection** \u2014 Leiden via igraph or leidenalg.\n- **Hub genes** \u2014 combine betweenness centrality, degree centrality, and\n module membership (kME). Validate against known biology.\n- **Module-trait correlation** \u2014 PyWGCNA `module_trait_relationships()`\n or Pearson/Spearman with FDR correction.\n\n## Domain Standards\n\n- Filter to top 3000-5000 variable genes before correlation matrices.\n At 5000 genes the matrix is ~200 MB; at 10000 it is ~800 MB.\n- Use float32 where possible.\n- For large networks (>10k nodes), use sparse representations or\n adjacency-list format.\n- Log-transform expression before correlations. Pearson on raw counts\n is dominated by high-count genes.\n- decoupler: use CollecTRI (not DoRothEA) for TF regulons, PROGENy for\n pathways. Resolve the network file from the reference inventory \u2014\n never assume a staged path.\n- Save processed networks and module assignments as AnnData when\n meaningful.\n\n## Required Figures\n\n- **Network graph** \u2014 spring/Fruchterman-Reingold layout for key\n modules. Top 50 genes by kME, colored by module.\n- **Module eigengene heatmap** \u2014 modules \u00D7 samples, colored by\n eigengene, annotated with phenotype.\n- **Hub gene network** \u2014 subnetwork of top hubs per module with\n centrality-scaled node sizes.\n- **Module-trait correlation heatmap** \u2014 modules \u00D7 traits, color =\n correlation, annotated with FDR-corrected p-values.\n- **TF activity heatmap** \u2014 top TFs \u00D7 samples or cell groups when\n decoupler is used.\n\n## Domain Anti-Patterns\n\n- WGCNA on >5000 genes without filtering \u2014 memory explosion, signal\n drowned in noise.\n- Correlations on raw or unnormalized counts \u2014 log-transform first.\n- Ignoring batch effects in co-expression \u2014 batch-driven correlations\n create spurious modules.\n- WGCNA on single-cell count matrices \u2014 aggregate to pseudobulk first.\n- PyWGCNA `geneExp=` kwarg \u2014 use positional or `geneExpPath=`. Call\n `.to_df()` before pandas operations on internal AnnData.\n- `dc.op.collectri()`, `dc.op.progeny()`, `dc.op.dorothea()` \u2014 all\n call OmniPath web API. Load pre-staged parquet instead.\n- DoRothEA for TF analysis \u2014 superseded by CollecTRI (better coverage\n and curation).\n\n## Required Output Files\n\n- `output/module_assignments.csv` \u2014 `gene`, `module_id`,\n `module_color`, `kME`.\n- `output/network_edges.csv` \u2014 `source`, `target`, `weight`, `type`\n (co-expression/PPI/regulatory).\n- `output/hub_genes.csv` \u2014 `gene`, `module`, `degree_centrality`,\n `betweenness_centrality`, `kME`, `rank`.\n- `output/module_trait_correlations.csv` \u2014 `module`, `trait`,\n `correlation`, `p_value`, `fdr`.\n- `output/tf_activity.h5ad` \u2014 per-sample or per-cell TF activity\n scores (when decoupler is used).\n- `output/network.graphml` \u2014 graph export for external visualization.\n";
|
|
@@ -10,8 +10,8 @@ produced by upstream modality agents.
|
|
|
10
10
|
|
|
11
11
|
Your skills: \`network-regulatory\`, \`shared/omics-general\`.
|
|
12
12
|
|
|
13
|
-
API references in \`network-regulatory\`: PyWGCNA, decoupler
|
|
14
|
-
|
|
13
|
+
API references in \`network-regulatory\`: PyWGCNA, decoupler, networkx,
|
|
14
|
+
igraph.
|
|
15
15
|
|
|
16
16
|
## Method Selection (Summary)
|
|
17
17
|
|
|
@@ -23,9 +23,11 @@ networkx/igraph, leidenalg, OmniPath.
|
|
|
23
23
|
- **TF activity (fast, per-cell)** — decoupler with CollecTRI via
|
|
24
24
|
\`run_ulm()\` or \`run_mlm()\`. Faster than pySCENIC when regulon
|
|
25
25
|
discovery is not the goal.
|
|
26
|
-
- **PPI network** — OmniPath
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
- **PPI network** — the STRING and OmniPath web APIs are unreachable.
|
|
27
|
+
A PPI network comes from an interaction file resolved from the
|
|
28
|
+
reference inventory. If none is provisioned, say so, and scope the
|
|
29
|
+
analysis to what is. Build with networkx or igraph. Filter by
|
|
30
|
+
confidence as needed.
|
|
29
31
|
- **Community detection** — Leiden via igraph or leidenalg.
|
|
30
32
|
- **Hub genes** — combine betweenness centrality, degree centrality, and
|
|
31
33
|
module membership (kME). Validate against known biology.
|
|
@@ -42,7 +44,8 @@ networkx/igraph, leidenalg, OmniPath.
|
|
|
42
44
|
- Log-transform expression before correlations. Pearson on raw counts
|
|
43
45
|
is dominated by high-count genes.
|
|
44
46
|
- decoupler: use CollecTRI (not DoRothEA) for TF regulons, PROGENy for
|
|
45
|
-
pathways.
|
|
47
|
+
pathways. Resolve the network file from the reference inventory —
|
|
48
|
+
never assume a staged path.
|
|
46
49
|
- Save processed networks and module assignments as AnnData when
|
|
47
50
|
meaningful.
|
|
48
51
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const spatialOmicsAgentPrompt = "# Spatial Omics Agent\n\nYou are a spatially-resolved omics analysis specialist. You handle\nVisium, MERFISH/Xenium, Slide-seq, and CODEX/MIBI/IMC data. You build\nspatial neighbor graphs, identify spatial domains, detect spatially\nvariable genes, run spatial deconvolution, and characterize tissue\nmicroenvironments. You adapt methods to the technology's resolution and\ncoordinate system.\n\n## Skills\n\nYour skills: `spatial-omics`, `shared/omics-general`.\n\nAPI references in `spatial-omics`: squidpy, spatialdata, cell2location.\n\n## Method Selection (Summary)\n\n- **Spatial neighbors graph** \u2014 foundation for all spatial stats.\n Visium: `sq.gr.spatial_neighbors(adata, coord_type=\"grid\")`.\n Everything else: `coord_type=\"generic\"` with `n_neighs=6` or\n radius-based.\n- **Spatial domain identification** \u2014 Leiden on spatial graph for\n basic; combined expression + spatial graph for biology-aware domains.\n- **Deconvolution (spot-based only)** \u2014 cell2location (Bayesian).\n Requires matched scRNA-seq reference from same tissue. Stage 1: learn\n reference signatures. Stage 2: decompose spots.\n- **Spatially variable genes** \u2014 Moran's I via\n `sq.gr.spatial_autocorr(adata, mode=\"moran\")`. Always FDR-correct.\n- **Niche analysis** \u2014 neighborhood enrichment\n (`sq.gr.nhood_enrichment`), co-occurrence (`sq.gr.co_occurrence`)
|
|
1
|
+
export declare const spatialOmicsAgentPrompt = "# Spatial Omics Agent\n\nYou are a spatially-resolved omics analysis specialist. You handle\nVisium, MERFISH/Xenium, Slide-seq, and CODEX/MIBI/IMC data. You build\nspatial neighbor graphs, identify spatial domains, detect spatially\nvariable genes, run spatial deconvolution, and characterize tissue\nmicroenvironments. You adapt methods to the technology's resolution and\ncoordinate system.\n\n## Skills\n\nYour skills: `spatial-omics`, `shared/omics-general`.\n\nAPI references in `spatial-omics`: squidpy, spatialdata, cell2location.\n\n## Method Selection (Summary)\n\n- **Spatial neighbors graph** \u2014 foundation for all spatial stats.\n Visium: `sq.gr.spatial_neighbors(adata, coord_type=\"grid\")`.\n Everything else: `coord_type=\"generic\"` with `n_neighs=6` or\n radius-based.\n- **Spatial domain identification** \u2014 Leiden on spatial graph for\n basic; combined expression + spatial graph for biology-aware domains.\n- **Deconvolution (spot-based only)** \u2014 cell2location (Bayesian).\n Requires matched scRNA-seq reference from same tissue. Stage 1: learn\n reference signatures. Stage 2: decompose spots.\n- **Spatially variable genes** \u2014 Moran's I via\n `sq.gr.spatial_autocorr(adata, mode=\"moran\")`. Always FDR-correct.\n- **Niche analysis** \u2014 neighborhood enrichment\n (`sq.gr.nhood_enrichment`), co-occurrence (`sq.gr.co_occurrence`).\n `sq.gr.ligrec` cannot run here \u2014 its package is missing, and its\n interaction database needs network access. Report the blocker, and\n do not substitute another analysis silently.\n- **SpatialData** \u2014 for complex experiments with multiple sections or\n coordinate transformations. Otherwise AnnData with\n `.obsm[\"spatial\"]` suffices.\n\n## Domain Standards\n\n- squidpy is the primary spatial-stats toolkit.\n- Preserve spatial coordinates in `adata.obsm[\"spatial\"]` at all times.\n- Ensure consistent coordinate units (micrometers or pixels). Document\n the unit in script comments.\n- Store results in AnnData `.h5ad`. Use SpatialData only when\n multi-section alignment or image analysis is required.\n\n## Required Figures\n\n- **Spatial scatter plots** \u2014 gene expression on tissue coordinates.\n Viridis for continuous, categorical palette for clusters. Match spot\n size to array geometry for Visium.\n- **Spatial feature plots** \u2014 top spatially variable genes on tissue\n coordinates.\n- **H&E overlay** \u2014 if tissue image is available (Visium).\n- **Spatial domain map** \u2014 cluster/domain assignments on tissue\n coordinates.\n- **Niche composition** \u2014 cell-type proportion bars per spatial\n domain. Deconvolution: cell-type proportion heatmaps on tissue\n coordinates.\n- **Spatial autocorrelation** \u2014 Moran's I scatter for top genes.\n- **Neighborhood enrichment heatmap** \u2014 cell-type pair enrichment\n z-scores.\n\n## Domain Anti-Patterns\n\n- `coord_type=\"grid\"` for non-Visium or `coord_type=\"generic\"` for\n Visium \u2014 wrong type produces incorrect spatial graphs.\n- Interpreting Visium spot-level expression as single-cell \u2014 each spot\n covers 1-10 cells. Deconvolve.\n- Deconvolution without a matched scRNA reference from the same tissue.\n- Standard scRNA clustering without spatial awareness \u2014 loses the\n spatial structure that is the point of the data.\n- Skipping FDR on spatially variable genes.\n- Applying Visium-specific methods (BayesSpace, grid neighbors) to\n MERFISH or other single-molecule technologies.\n- Mixing coordinate scales across neighbor graph, niche analysis, and\n visualization.\n- Ignoring the tissue image for Visium \u2014 H&E contains morphological\n context.\n\n## Required Output Files\n\n`adata.obsm` / `adata.obsp` live only in memory \u2014 they are NOT a deliverable\nuntil you `adata.write_h5ad(...)` to `output/`. Always persist:\n\n- Processed AnnData `output/*.h5ad` with `adata.obsm[\"spatial\"]` preserved\n and the spatial graph in `adata.obsp` \u2014 written to disk, not left in memory.\n- Spatial autocorrelation CSV: `gene`, `morans_I`, `pvalue`,\n `adjusted_pvalue`.\n- Deconvolution results \u2014 both inside the written `.h5ad` (`adata.obsm`,\n cell-type proportions per spot) AND as `output/*.csv` for cross-agent use.\n- Niche enrichment as CSV.\n";
|
|
@@ -27,8 +27,10 @@ API references in \`spatial-omics\`: squidpy, spatialdata, cell2location.
|
|
|
27
27
|
- **Spatially variable genes** — Moran's I via
|
|
28
28
|
\`sq.gr.spatial_autocorr(adata, mode="moran")\`. Always FDR-correct.
|
|
29
29
|
- **Niche analysis** — neighborhood enrichment
|
|
30
|
-
(\`sq.gr.nhood_enrichment\`), co-occurrence (\`sq.gr.co_occurrence\`)
|
|
31
|
-
|
|
30
|
+
(\`sq.gr.nhood_enrichment\`), co-occurrence (\`sq.gr.co_occurrence\`).
|
|
31
|
+
\`sq.gr.ligrec\` cannot run here — its package is missing, and its
|
|
32
|
+
interaction database needs network access. Report the blocker, and
|
|
33
|
+
do not substitute another analysis silently.
|
|
32
34
|
- **SpatialData** — for complex experiments with multiple sections or
|
|
33
35
|
coordinate transformations. Otherwise AnnData with
|
|
34
36
|
\`.obsm["spatial"]\` suffices.
|
package/dist/providers/ai-sdk.js
CHANGED
|
@@ -421,6 +421,7 @@ export function createAiSdkProvider(deps) {
|
|
|
421
421
|
// bound, because the headers of a non-streaming response arrive
|
|
422
422
|
// when the model completes.
|
|
423
423
|
providerOptions: req.providerOptions,
|
|
424
|
+
reasoning: req.reasoning,
|
|
424
425
|
});
|
|
425
426
|
});
|
|
426
427
|
return ok(responseFromGenerate(result, { requestedModelId, servedModelId: capture.servedModelId() }));
|
|
@@ -467,6 +468,7 @@ export function createAiSdkProvider(deps) {
|
|
|
467
468
|
// thus it feeds neither bound.
|
|
468
469
|
...(requestTimeoutMs !== undefined ? { timeout: { firstChunkMs: requestTimeoutMs, chunkMs: requestTimeoutMs } } : {}),
|
|
469
470
|
providerOptions: req.providerOptions,
|
|
471
|
+
reasoning: req.reasoning,
|
|
470
472
|
});
|
|
471
473
|
const iterator = result.fullStream[Symbol.asyncIterator]();
|
|
472
474
|
const first = await pullNextDelta(iterator);
|
|
@@ -702,6 +704,8 @@ export function createConfiguredAiSdkProvider(deps) {
|
|
|
702
704
|
fetch: effectiveFetch,
|
|
703
705
|
});
|
|
704
706
|
return createAiSdkProvider({
|
|
707
|
+
// The compatible package reads the neutral `reasoning` of the call, thus
|
|
708
|
+
// the seam needs no middleware to carry the depth into its namespace.
|
|
705
709
|
model: provider.chatModel(config.model),
|
|
706
710
|
resolveBilling: deps.resolveBilling,
|
|
707
711
|
capabilities: config.capabilities,
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The reasoning depth of a run.
|
|
3
|
+
*
|
|
4
|
+
* The harness states the depth one time, on `ChatRequest.reasoning`, with the
|
|
5
|
+
* neutral names of the AI SDK. It names no vendor key. Each provider package
|
|
6
|
+
* holds the table of what its own models accept, and it maps the neutral name
|
|
7
|
+
* onto the wire. The Anthropic package also selects adaptive thinking there.
|
|
8
|
+
*
|
|
9
|
+
* ## Why the harness names no vendor key
|
|
10
|
+
*
|
|
11
|
+
* The harness wrote `providerOptions.anthropic.effort` before. A value on that
|
|
12
|
+
* key turns the per-model table of the Anthropic package off, thus the raw name
|
|
13
|
+
* reached the wire. A model that accepts `high` but not `xhigh` answered 400.
|
|
14
|
+
* The neutral field has no such hazard, because the package resolves the name
|
|
15
|
+
* for the model that it is bound to.
|
|
16
|
+
*
|
|
17
|
+
* ## Where the policy belongs
|
|
18
|
+
*
|
|
19
|
+
* The policy rides on the run, not on the provider, for the same reason that the
|
|
20
|
+
* cache policy does. A one-shot LLM call elsewhere in the harness has its own
|
|
21
|
+
* depth needs, and it must not inherit the depth of an agent loop.
|
|
22
|
+
*/
|
|
23
|
+
import type { ReasoningPolicy } from "./types.js";
|
|
24
|
+
/**
|
|
25
|
+
* The default policy: the deepest name of the neutral ladder.
|
|
26
|
+
*
|
|
27
|
+
* Each agent of the harness drives tools over many iterations. A shallow turn
|
|
28
|
+
* there wastes more calls than a deeper turn costs in tokens. The Anthropic
|
|
29
|
+
* package sends `xhigh` to a model that accepts it, and `max` to a model that
|
|
30
|
+
* does not. The OpenAI-compatible package sends the name as it is.
|
|
31
|
+
*
|
|
32
|
+
* A host that wants a cheaper loop passes a lower name. A host on a model with
|
|
33
|
+
* no reasoning support passes `"provider-default"`.
|
|
34
|
+
*/
|
|
35
|
+
export declare const DEFAULT_REASONING: ReasoningPolicy;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The reasoning depth of a run.
|
|
3
|
+
*
|
|
4
|
+
* The harness states the depth one time, on `ChatRequest.reasoning`, with the
|
|
5
|
+
* neutral names of the AI SDK. It names no vendor key. Each provider package
|
|
6
|
+
* holds the table of what its own models accept, and it maps the neutral name
|
|
7
|
+
* onto the wire. The Anthropic package also selects adaptive thinking there.
|
|
8
|
+
*
|
|
9
|
+
* ## Why the harness names no vendor key
|
|
10
|
+
*
|
|
11
|
+
* The harness wrote `providerOptions.anthropic.effort` before. A value on that
|
|
12
|
+
* key turns the per-model table of the Anthropic package off, thus the raw name
|
|
13
|
+
* reached the wire. A model that accepts `high` but not `xhigh` answered 400.
|
|
14
|
+
* The neutral field has no such hazard, because the package resolves the name
|
|
15
|
+
* for the model that it is bound to.
|
|
16
|
+
*
|
|
17
|
+
* ## Where the policy belongs
|
|
18
|
+
*
|
|
19
|
+
* The policy rides on the run, not on the provider, for the same reason that the
|
|
20
|
+
* cache policy does. A one-shot LLM call elsewhere in the harness has its own
|
|
21
|
+
* depth needs, and it must not inherit the depth of an agent loop.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* The default policy: the deepest name of the neutral ladder.
|
|
25
|
+
*
|
|
26
|
+
* Each agent of the harness drives tools over many iterations. A shallow turn
|
|
27
|
+
* there wastes more calls than a deeper turn costs in tokens. The Anthropic
|
|
28
|
+
* package sends `xhigh` to a model that accepts it, and `max` to a model that
|
|
29
|
+
* does not. The OpenAI-compatible package sends the name as it is.
|
|
30
|
+
*
|
|
31
|
+
* A host that wants a cheaper loop passes a lower name. A host on a model with
|
|
32
|
+
* no reasoning support passes `"provider-default"`.
|
|
33
|
+
*/
|
|
34
|
+
export const DEFAULT_REASONING = "xhigh";
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* attribution is resolved lazily at the provider wire boundary.
|
|
7
7
|
*/
|
|
8
8
|
import type { FinishReason, LanguageModel, ModelMessage, ToolSet } from "ai";
|
|
9
|
+
import type { LanguageModelV4CallOptions } from "@ai-sdk/provider";
|
|
9
10
|
import type { ProviderOptions } from "@ai-sdk/provider-utils";
|
|
10
11
|
import type { ResultAsync } from "neverthrow";
|
|
11
12
|
import type { AgentSession } from "../auth/types.js";
|
|
@@ -40,6 +41,11 @@ export interface ChatRequest {
|
|
|
40
41
|
readonly toolName: string;
|
|
41
42
|
};
|
|
42
43
|
readonly providerOptions?: ProviderOptions;
|
|
44
|
+
/**
|
|
45
|
+
* How deep the model reasons on this call. Absent sends no directive, thus
|
|
46
|
+
* the model applies its own default. Refer to `ReasoningPolicy`.
|
|
47
|
+
*/
|
|
48
|
+
readonly reasoning?: ReasoningPolicy;
|
|
43
49
|
}
|
|
44
50
|
/**
|
|
45
51
|
* Vendor-neutral prompt-cache policy — a harness concept, not a vendor one.
|
|
@@ -54,6 +60,26 @@ export interface ChatRequest {
|
|
|
54
60
|
export type PromptCachePolicy = {
|
|
55
61
|
readonly ttl: "5m" | "1h";
|
|
56
62
|
} | "off";
|
|
63
|
+
/**
|
|
64
|
+
* How deep a model reasons, in harness-neutral names.
|
|
65
|
+
*
|
|
66
|
+
* This is the `reasoning` call setting of the AI SDK, and the harness passes the
|
|
67
|
+
* value through without a change. Each provider package maps the name onto its
|
|
68
|
+
* own wire shape, and each one holds the table of what its models accept. The
|
|
69
|
+
* Anthropic package selects adaptive thinking with the matching `effort`, and it
|
|
70
|
+
* lowers a level that the model does not accept. The OpenAI-compatible package
|
|
71
|
+
* sends the name as `reasoning_effort`.
|
|
72
|
+
*
|
|
73
|
+
* `"provider-default"` sends no directive, thus the model applies its own
|
|
74
|
+
* default. `"none"` asks for no reasoning. The other names are the ladder from
|
|
75
|
+
* the shallowest depth to the deepest depth.
|
|
76
|
+
*
|
|
77
|
+
* CAUTION: never write `providerOptions.anthropic.effort` or
|
|
78
|
+
* `providerOptions.openai.reasoningEffort` in place of this field. A value on
|
|
79
|
+
* either key turns the per-model table off, and the raw name then reaches the
|
|
80
|
+
* wire. A model that does not accept that name answers 400.
|
|
81
|
+
*/
|
|
82
|
+
export type ReasoningPolicy = NonNullable<LanguageModelV4CallOptions["reasoning"]>;
|
|
57
83
|
/**
|
|
58
84
|
* Token accounting for one chat call, in harness-neutral names.
|
|
59
85
|
*
|
|
@@ -58,9 +58,9 @@ export declare const OrganismSchema: z.ZodObject<{
|
|
|
58
58
|
inferred: "inferred";
|
|
59
59
|
}>;
|
|
60
60
|
confidence: z.ZodEnum<{
|
|
61
|
-
high: "high";
|
|
62
|
-
medium: "medium";
|
|
63
61
|
low: "low";
|
|
62
|
+
medium: "medium";
|
|
63
|
+
high: "high";
|
|
64
64
|
}>;
|
|
65
65
|
notes: z.ZodOptional<z.ZodString>;
|
|
66
66
|
}, z.core.$strip>;
|
|
@@ -1001,9 +1001,9 @@ export declare const ProfileSubmissionSchema: z.ZodObject<{
|
|
|
1001
1001
|
inferred: "inferred";
|
|
1002
1002
|
}>;
|
|
1003
1003
|
confidence: z.ZodEnum<{
|
|
1004
|
-
high: "high";
|
|
1005
|
-
medium: "medium";
|
|
1006
1004
|
low: "low";
|
|
1005
|
+
medium: "medium";
|
|
1006
|
+
high: "high";
|
|
1007
1007
|
}>;
|
|
1008
1008
|
notes: z.ZodOptional<z.ZodString>;
|
|
1009
1009
|
}, z.core.$strip>>;
|
|
@@ -26,9 +26,9 @@ export declare const SynthesizedFindingSchema: z.ZodObject<{
|
|
|
26
26
|
title: z.ZodString;
|
|
27
27
|
description: z.ZodString;
|
|
28
28
|
confidence: z.ZodEnum<{
|
|
29
|
-
high: "high";
|
|
30
|
-
medium: "medium";
|
|
31
29
|
low: "low";
|
|
30
|
+
medium: "medium";
|
|
31
|
+
high: "high";
|
|
32
32
|
}>;
|
|
33
33
|
noveltyStatus: z.ZodEnum<{
|
|
34
34
|
expected: "expected";
|
|
@@ -92,9 +92,9 @@ export declare const RunSynthesisSchema: z.ZodObject<{
|
|
|
92
92
|
title: z.ZodString;
|
|
93
93
|
description: z.ZodString;
|
|
94
94
|
confidence: z.ZodEnum<{
|
|
95
|
-
high: "high";
|
|
96
|
-
medium: "medium";
|
|
97
95
|
low: "low";
|
|
96
|
+
medium: "medium";
|
|
97
|
+
high: "high";
|
|
98
98
|
}>;
|
|
99
99
|
noveltyStatus: z.ZodEnum<{
|
|
100
100
|
expected: "expected";
|
|
@@ -32,7 +32,7 @@ export declare const chemblTool: import("../define-tool.js").Tool<{
|
|
|
32
32
|
query?: string | undefined;
|
|
33
33
|
searchType?: "target" | "smiles" | "compound" | undefined;
|
|
34
34
|
chemblId?: string | undefined;
|
|
35
|
-
idType?: "target" | "compound" | undefined;
|
|
35
|
+
idType?: "target" | "compound" | "assay" | undefined;
|
|
36
36
|
activityType?: string | undefined;
|
|
37
37
|
limit?: number | undefined;
|
|
38
38
|
}, ChemblOutput>;
|
package/dist/tools/bio/chembl.js
CHANGED
|
@@ -45,7 +45,9 @@ const inputSchema = z
|
|
|
45
45
|
"(INHIBITOR, AGONIST, …), targetChemblId + targetName, moleculeChemblId. Curated mainly for clinical/approved molecules, so tool " +
|
|
46
46
|
"compounds often have none.\n" +
|
|
47
47
|
"'bioactivity' (chemblId + idType) — measured activity rows: the curated, QUOTABLE potency. → standardType, standardValue + " +
|
|
48
|
-
"standardUnits, pchemblValue (normalized -log10), assayChemblId, assayType, compoundChemblId, targetChemblId
|
|
48
|
+
"standardUnits, pchemblValue (normalized -log10), assayChemblId, assayType, compoundChemblId, targetChemblId. With idType='assay' " +
|
|
49
|
+
"it reads ONE assay back by the assayChemblId that an earlier bioactivity row carried — every measurement made under the same " +
|
|
50
|
+
"protocol, which is how you compare compounds on like terms.\n" +
|
|
49
51
|
"'targets' (query) — resolve a gene symbol or protein name to a ChEMBL target, producing the ID that bioactivity (idType='target') " +
|
|
50
52
|
"and compounds (searchType='target') need. → targetChemblId, preferredName, targetType, organism, geneNames. Check `organism`: the " +
|
|
51
53
|
"top hit for a human symbol may be a non-human ortholog."),
|
|
@@ -65,13 +67,13 @@ const inputSchema = z
|
|
|
65
67
|
.string()
|
|
66
68
|
.min(1)
|
|
67
69
|
.optional()
|
|
68
|
-
.describe("Required for 'mechanism' and 'bioactivity'. A molecule ID ('CHEMBL25' = aspirin), or — for bioactivity
|
|
69
|
-
"ID ('
|
|
70
|
+
.describe("Required for 'mechanism' and 'bioactivity'. A molecule ID ('CHEMBL25' = aspirin), or — for bioactivity — a target ID ('CHEMBL203' = " +
|
|
71
|
+
"EGFR) with idType='target', or an assay ID ('CHEMBL1217643') with idType='assay'. 'mechanism' takes a molecule ID only."),
|
|
70
72
|
idType: z
|
|
71
|
-
.enum(["compound", "target"])
|
|
73
|
+
.enum(["compound", "target", "assay"])
|
|
72
74
|
.optional()
|
|
73
|
-
.describe("Required for 'bioactivity' — which
|
|
74
|
-
"against. 'target': every compound assayed against that target."),
|
|
75
|
+
.describe("Required for 'bioactivity' — which column of the activity table `chemblId` indexes. 'compound': everything that molecule was assayed " +
|
|
76
|
+
"against. 'target': every compound assayed against that target. 'assay': every measurement made under that one assay protocol."),
|
|
75
77
|
activityType: z
|
|
76
78
|
.string()
|
|
77
79
|
.optional()
|
|
@@ -110,10 +112,13 @@ const inputSchema = z
|
|
|
110
112
|
});
|
|
111
113
|
export const chemblTool = defineTool({
|
|
112
114
|
id: "chembl",
|
|
113
|
-
description: "ChEMBL — the manually curated database of drug-like bioactives (~2.4M compounds), the targets they were measured against, their
|
|
114
|
-
"their approval status. Five lookups; pick with `action`, which gives each one's params and return fields.\n" +
|
|
115
|
-
"
|
|
116
|
-
"
|
|
115
|
+
description: "ChEMBL — the manually curated database of drug-like bioactives of EMBL-EBI (~2.4M compounds), the targets they were measured against, their " +
|
|
116
|
+
"mechanisms and their approval status. Five lookups; pick with `action`, which gives each one's params and return fields.\n" +
|
|
117
|
+
"ACCEPTED IDENTIFIERS: free text for 'compounds', 'drug' and 'targets' — a compound name ('imatinib'), an indication ('melanoma'), a gene symbol " +
|
|
118
|
+
"('EGFR') or a SMILES string. A ChEMBL ID for 'mechanism' and 'bioactivity' — a molecule ID ('CHEMBL25'), a target ID ('CHEMBL203') or an assay " +
|
|
119
|
+
"ID ('CHEMBL1217643'), named by `idType`.\n" +
|
|
120
|
+
"IDs are resolved, never guessed: a `chemblId` comes from a prior action='compounds'/'drug' (molecules), action='targets' (targets), the " +
|
|
121
|
+
"assayChemblId of a bioactivity row (assays), or pubchem action='crossrefs'. A compound or gene name is not a ChEMBL ID.\n" +
|
|
117
122
|
"Being curated, ChEMBL is what you quote from: prefer action='bioactivity' over pubchem action='assays' for any number you will cite, and resolve " +
|
|
118
123
|
"compounds here first. If ChEMBL misses the compound, resolve it via pubchem action='compound' and bridge back with pubchem action='crossrefs'.\n" +
|
|
119
124
|
"An empty array is valid no-data, not an error — do not retry the same call.",
|
|
@@ -98,9 +98,13 @@ const inputSchema = z
|
|
|
98
98
|
export function createComptoxTool(deps) {
|
|
99
99
|
return defineTool({
|
|
100
100
|
id: "comptox",
|
|
101
|
-
description: "
|
|
101
|
+
description: "The CompTox Chemicals Dashboard (CTX) of the U.S. Environmental Protection Agency — the chemical-safety corpus that holds ToxCast, ToxValDB, " +
|
|
102
|
+
"the genotoxicity and cancer summaries, and the SEEM exposure predictions. Four datasets behind `dataset`: 'toxcast' (in-vitro HTS " +
|
|
103
|
+
"bioactivity), 'hazard' (in-vivo: " +
|
|
102
104
|
"NOAEL/LOAEL/LD50, genotoxicity, cancer), 'chemical' (identity + physicochemical/ADMET), 'exposure' (SEEM predictions, toxicokinetics, uses, " +
|
|
103
105
|
"products). See `dataset` for what each returns; all four resolve `query` to a DTXSID first.\n" +
|
|
106
|
+
"ACCEPTED IDENTIFIERS: a DTXSID ('DTXSID7020182') used directly, or a CASRN ('80-05-7'), a chemical name ('bisphenol A') or — for dataset " +
|
|
107
|
+
"'chemical' — an InChIKey, each resolved by EXACT match.\n" +
|
|
104
108
|
"Requires EPA_CCTE_API_KEY — a missing key fails terminally: do NOT retry, tell the user the key needs configuring and proceed without EPA data.\n" +
|
|
105
109
|
"found: false means the query did not resolve to a chemical; a present-but-empty section is likewise valid no-data. Do not retry either.\n" +
|
|
106
110
|
"This is environmental/industrial-chemical data: for drug-like compounds prefer PubChem or ChEMBL — dataset 'chemical' returns " +
|
|
@@ -111,8 +111,11 @@ export function createDrugGeneInteractionsTool(deps) {
|
|
|
111
111
|
const logger = (deps.logger ?? createNoopLogger()).named("drug_gene_interactions");
|
|
112
112
|
return defineTool({
|
|
113
113
|
id: "drug_gene_interactions",
|
|
114
|
-
description: "Drug↔gene interactions across DGIdb, DrugBank and PharmGKB, in one call — 'what drugs hit these
|
|
115
|
-
"on?'. See `direction` and `sources` for the modes.\n" +
|
|
114
|
+
description: "Drug↔gene interactions across DGIdb (the Drug Gene Interaction Database), DrugBank and PharmGKB, in one call — 'what drugs hit these " +
|
|
115
|
+
"genes?' and 'what genes does this drug act on?'. See `direction` and `sources` for the modes.\n" +
|
|
116
|
+
"ACCEPTED IDENTIFIERS: a HUGO gene symbol ('EGFR') for direction 'gene_to_drugs'; a drug name ('imatinib'), a DrugBank ID ('DB00619') or a " +
|
|
117
|
+
"DGIdb concept ID for 'drug_to_genes'. A brand name and a non-HUGO symbol match nothing — resolve the symbol with search_gene and the brand " +
|
|
118
|
+
"name with search_faers({action:'label'}) first.\n" +
|
|
116
119
|
"It answers whether an interaction is KNOWN, by whom, and of what type. For quotable POTENCY (IC50/Ki) use chembl({action:'bioactivity'}) instead.\n" +
|
|
117
120
|
"Verbose fields (`includeAttributes`, `includeDrugRecord`) are off by default — both cost a lot of context and are rarely what the question needs.\n" +
|
|
118
121
|
"ALWAYS read `perSource` before concluding an interaction is unknown: 'no_data' means that corpus has nothing; 'unavailable' means it could " +
|