HungryTorch commited on
Commit
4cb9990
verified
1 Parent(s): 8bd7ecb

feat(primo): clarify purpose and RNAseq boards

Browse files
Files changed (2) hide show
  1. boards.py +12 -3
  2. render.py +5 -5
boards.py CHANGED
@@ -32,6 +32,10 @@ from dataclasses import dataclass
32
  from evaluator import _norm_id
33
 
34
  METRIC_LABEL = {"auroc": "AUROC", "pearson": "Pearson"}
 
 
 
 
35
 
36
  MODALITY_GROUP = "Modality"
37
  AREA_GROUP = "Therapeutic Areas"
@@ -65,6 +69,11 @@ def metric_label(metric: str) -> str:
65
  return METRIC_LABEL.get(metric, metric)
66
 
67
 
 
 
 
 
 
68
  def short_code(name: str) -> str:
69
  """The board's letter tag, standing in for what used to be a per-board emoji.
70
 
@@ -162,7 +171,7 @@ def _cohort_stats(tasks: list[dict]) -> tuple[int, int, int]:
162
 
163
  def _blurb(group: str, name: str, tasks: list[dict]) -> str:
164
  if group == MODALITY_GROUP:
165
- return f"Every PRIMO task, scored from {name} profiles."
166
  if group == CATEGORY_GROUP:
167
  return CATEGORY_BLURB.get(name, label(name))
168
  families = [label(c) for c in distinct(tasks, "category")]
@@ -172,7 +181,7 @@ def _blurb(group: str, name: str, tasks: list[dict]) -> str:
172
  def _board(group: str, name: str, modality: str, tasks: list[dict]) -> Board:
173
  """One card. The modality board owns the bare slug; the rest are suffixed by it."""
174
  n_cohorts, n_patients, n_diseases = _cohort_stats(tasks)
175
- display = name if group == MODALITY_GROUP else label(name)
176
  return Board(
177
  slug=slugify(modality) if group == MODALITY_GROUP else slugify(name, modality),
178
  group=group,
@@ -226,7 +235,7 @@ class OpenBoard:
226
  OPEN_BOARDS: tuple[OpenBoard, ...] = (
227
  OpenBoard(
228
  MODALITY_GROUP,
229
- "single-cell RNA",
230
  "Dissociated tissue, labelled at the patient level. No cohort yet.",
231
  ),
232
  OpenBoard(
 
32
  from evaluator import _norm_id
33
 
34
  METRIC_LABEL = {"auroc": "AUROC", "pearson": "Pearson"}
35
+ MODALITY_LABEL = {
36
+ "bulk RNA": "Bulk RNAseq",
37
+ "single-cell RNA": "single-cell RNAseq",
38
+ }
39
 
40
  MODALITY_GROUP = "Modality"
41
  AREA_GROUP = "Therapeutic Areas"
 
69
  return METRIC_LABEL.get(metric, metric)
70
 
71
 
72
+ def modality_label(modality: str) -> str:
73
+ """Return the visitor-facing label for a stored modality identifier."""
74
+ return MODALITY_LABEL.get(modality, modality)
75
+
76
+
77
  def short_code(name: str) -> str:
78
  """The board's letter tag, standing in for what used to be a per-board emoji.
79
 
 
171
 
172
  def _blurb(group: str, name: str, tasks: list[dict]) -> str:
173
  if group == MODALITY_GROUP:
174
+ return f"Every PRIMO task, scored from {modality_label(name)} profiles."
175
  if group == CATEGORY_GROUP:
176
  return CATEGORY_BLURB.get(name, label(name))
177
  families = [label(c) for c in distinct(tasks, "category")]
 
181
  def _board(group: str, name: str, modality: str, tasks: list[dict]) -> Board:
182
  """One card. The modality board owns the bare slug; the rest are suffixed by it."""
183
  n_cohorts, n_patients, n_diseases = _cohort_stats(tasks)
184
+ display = modality_label(name) if group == MODALITY_GROUP else label(name)
185
  return Board(
186
  slug=slugify(modality) if group == MODALITY_GROUP else slugify(name, modality),
187
  group=group,
 
235
  OPEN_BOARDS: tuple[OpenBoard, ...] = (
236
  OpenBoard(
237
  MODALITY_GROUP,
238
+ "single-cell RNAseq",
239
  "Dissociated tissue, labelled at the patient level. No cohort yet.",
240
  ),
241
  OpenBoard(
render.py CHANGED
@@ -35,6 +35,7 @@ from boards import (
35
  OpenBoard,
36
  in_group,
37
  metric_label,
 
38
  open_in_group,
39
  )
40
  from leaderboard import per_task_table, ranked_table, tasks_table, top_models
@@ -164,12 +165,11 @@ def render_boards(boards: list[Board], df: pd.DataFrame, by_id: dict[str, dict])
164
  '<div class="pm-body"><p class="pm-caption">The task registry is '
165
  "unavailable right now. Please retry in a moment.</p></div>"
166
  )
167
- n_live = len(boards)
168
- n_open = sum(len(open_in_group(boards, group)) for group in SECTIONS)
169
  out = [
170
  '<div class="pm-head"><div><h1>Boards</h1>',
171
- f"<p>{n_live} live {n_open} open. Every board is scored by the same "
172
- "fixed linear probe on sample embeddings.</p></div></div>",
 
173
  '<div class="pm-body">',
174
  ]
175
  for group in SECTIONS:
@@ -294,7 +294,7 @@ def _board_meta(board: Board) -> str:
294
  tail = f" 路 {metrics}" if metrics else ""
295
  return (
296
  f"{escape(board.blurb)} 路 {board.n_tasks} tasks 路 {board.n_cohorts} cohorts 路 "
297
- f"{board.n_patients:,} patients 路 {escape(board.modality)}{tail}"
298
  )
299
 
300
 
 
35
  OpenBoard,
36
  in_group,
37
  metric_label,
38
+ modality_label,
39
  open_in_group,
40
  )
41
  from leaderboard import per_task_table, ranked_table, tasks_table, top_models
 
165
  '<div class="pm-body"><p class="pm-caption">The task registry is '
166
  "unavailable right now. Please retry in a moment.</p></div>"
167
  )
 
 
168
  out = [
169
  '<div class="pm-head"><div><h1>Boards</h1>',
170
+ "<p>PRIMO evaluates representations of omics samples through "
171
+ "drug-development-related tasks. Benchmarks are organized by data "
172
+ "modality, therapeutic area, or task category.</p></div></div>",
173
  '<div class="pm-body">',
174
  ]
175
  for group in SECTIONS:
 
294
  tail = f" 路 {metrics}" if metrics else ""
295
  return (
296
  f"{escape(board.blurb)} 路 {board.n_tasks} tasks 路 {board.n_cohorts} cohorts 路 "
297
+ f"{board.n_patients:,} patients 路 {escape(modality_label(board.modality))}{tail}"
298
  )
299
 
300