File size: 3,145 Bytes
0161e74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
"""Paths and hyperparameter configuration for prompt selection pipeline."""
from __future__ import annotations

from dataclasses import dataclass
from pathlib import Path

# ---- Root directories ----
PROJECT_ROOT = Path("/home/hp250092/ku50001222/qian/aivc/lfj/transfer")
DATA_DIR = PROJECT_ROOT / "data"
RESULTS_DIR = DATA_DIR / "prompt_selection_results"
BASELINE_DIR = DATA_DIR / "baseline_results"
EVAL_DIR = DATA_DIR / "eval_results"

# ---- Input data ----
SOURCE_ADATA = DATA_DIR / "tutorial-pred-data" / "openproblems_donor1.h5ad"

# ---- Model checkpoints ----
EMBED_MODEL_DIR = DATA_DIR / "tutorial-embed-model"
EMBED_CKPT = EMBED_MODEL_DIR / "bc_large.ckpt"
GENELIST_PATH = DATA_DIR / "tutorial-pred-model" / "basecount_1000per_15000max.pkl"
ALIGNED_CKPT = DATA_DIR / "tutorial-pred-model" / "bc_large_aligned.ckpt"

# ---- HuggingFace repo for embedding checkpoint ----
HF_EMBED_REPO = "arcinstitute/Stack-Large"

# ---- Cell subset filters (shared across all perturbations) ----
QUERY_FILTER = {"broad_cell_class": "lymphocyte of b lineage", "sm_name": "Dimethyl Sulfoxide"}
PROMPT_CTRL_FILTER = {"broad_cell_class": "t cell", "sm_name": "Dimethyl Sulfoxide"}

# ---- Control perturbation name ----
CONTROL_NAME = "Dimethyl Sulfoxide"

# ---- Shared intermediate file names (inside RESULTS_DIR root) ----
QUERY_CTRL_H5AD = "query_ctrl.h5ad"
PROMPT_CTRL_H5AD = "prompt_ctrl.h5ad"
QUERY_EMB_NPY = "query_embeddings.npy"
PROMPT_CTRL_EMB_NPY = "prompt_ctrl_embeddings.npy"

# ---- Per-perturbation intermediate file names (inside RESULTS_DIR / pert_name) ----
PROMPT_PERT_H5AD = "prompt_pert.h5ad"
PREDICTED_PERT_H5AD = "predicted_pert.h5ad"
PROMPT_PERT_EMB_NPY = "prompt_pert_embeddings.npy"
PREDICTED_PERT_EMB_NPY = "predicted_pert_embeddings.npy"

# ---- Generation hyperparameters ----
NUM_STEPS = 5
PROMPT_RATIO = 0.25
CONTEXT_RATIO = 0.4
CONTEXT_RATIO_MIN = 0.2
BATCH_SIZE = 32
NUM_WORKERS = 4

# ---- Prompt selection hyperparameters ----
TOP_K1 = 512  # Stage 1: number of ctrl prompts to shortlist

# ---- All perturbation conditions ----
ALL_PERTURBATIONS = [
    "Belinostat",
    "CHIR-99021",
    "Crizotinib",
    "Dabrafenib",
    "Dactolisib",
    "Foretinib",
    "Idelalisib",
    "LDN 193189",
    "Linagliptin",
    "O-Demethylated Adapalene",
    "Palbociclib",
    "Penfluridol",
    "Porcn Inhibitor III",
    "R428",
]


@dataclass
class PertConfig:
    """Per-perturbation path configuration."""

    perturbation_name: str
    prompt_pert_filter: dict
    results_dir: Path
    baseline_dir: Path
    eval_dir: Path
    final_result_h5ad: str
    baseline_result_h5ad: str


def get_pert_config(pert_name: str) -> PertConfig:
    """Return path configuration for a specific perturbation condition."""
    return PertConfig(
        perturbation_name=pert_name,
        prompt_pert_filter={"broad_cell_class": "t cell", "sm_name": pert_name},
        results_dir=RESULTS_DIR / pert_name,
        baseline_dir=BASELINE_DIR / pert_name,
        eval_dir=EVAL_DIR / pert_name,
        final_result_h5ad=f"predicted_bcells_{pert_name}.h5ad",
        baseline_result_h5ad=f"baseline_random_{pert_name}.h5ad",
    )