Paper2Agent_decoupleRpy / src /core /constants.py
avoigt1121
Make decoupleR method-limitations text deterministic
0c5223c
Raw
History Blame
2.47 kB
"""
Constants for CodeAct agent.
"""
import os
# Available packages with descriptions
LIBRARY_CONTENT_DICT = {
"numpy": "[Python Package] The fundamental package for scientific computing with Python, providing support for arrays, matrices, and mathematical functions.",
"scipy": "[Python Package] A Python library for scientific and technical computing, including modules for optimization, linear algebra, integration, and statistics.",
}
def _load_system_prompt() -> str:
"""Load the system prompt template from prompts.yaml at the project root."""
import yaml
# core/constants.py lives at <root>/core/ (before move) or <root>/src/core/ (after move).
# Two or three levels up is the project root in both cases.
here = os.path.dirname(os.path.abspath(__file__))
for levels in (1, 2):
candidate = os.path.normpath(os.path.join(here, *[".."] * levels, "prompts.yaml"))
if os.path.exists(candidate):
with open(candidate, encoding="utf-8") as f:
data = yaml.safe_load(f)
return data["system_prompt"]
raise FileNotFoundError("prompts.yaml not found relative to core/constants.py")
SYSTEM_PROMPT_TEMPLATE = _load_system_prompt()
# Standing decoupleR method limitations.
#
# This block is true of EVERY decoupleR run, so it is appended deterministically
# in code to the final solution — it is NOT generated by the model. The model is
# instructed (see prompts.yaml, Example 6 / Reporting Results) to write only
# run-specific caveats (sample sizes, contrast, exclusions). Keeping the standing
# text here guarantees it is byte-for-byte identical on every run and can never be
# softened or dropped.
#
# If the computation changes (PROGENy pathway count, default scoring model, or
# regulon source), update this text to match — it must describe what the pipeline
# actually does.
DECOUPLER_DISCLAIMER = (
"**Method limitations (decoupleR).** All TF and pathway values are "
"*inferred* regulon/gene-set activities derived from differential-expression "
"statistics via the ULM model — not direct measurements of protein activity, "
"nuclear localization, or pathway flux. ULM p-values are liberal and scale "
"with regulon size, so rank results by effect size rather than by how small "
"padj is. PROGENy: 14-pathway model. Regulons: CollecTRI. These outputs "
"require independent validation before any biological or clinical conclusion."
)