@pikaa-ai/pikaa 0.3.23 → 0.3.24

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.
Files changed (191) hide show
  1. package/assets/brand/orbit-logo-option4-whale.jpg +0 -0
  2. package/assets/brand/orbit-logo.jpg +0 -0
  3. package/assets/brand/orbit-logo.png +0 -0
  4. package/assets/brand/orbit-logo.svg +3 -0
  5. package/dist/cli.js +337 -162
  6. package/dist/index.js +1 -2
  7. package/package.json +1 -2
  8. package/skills/adaptyv/SKILL.md +0 -240
  9. package/skills/aeon/SKILL.md +0 -402
  10. package/skills/analytical-method-validation/SKILL.md +0 -299
  11. package/skills/anndata/SKILL.md +0 -431
  12. package/skills/arbor/SKILL.md +0 -152
  13. package/skills/arboreto/SKILL.md +0 -267
  14. package/skills/astropy/SKILL.md +0 -353
  15. package/skills/autoskill/SKILL.md +0 -233
  16. package/skills/benchling-integration/SKILL.md +0 -229
  17. package/skills/bgpt-paper-search/SKILL.md +0 -75
  18. package/skills/bids/SKILL.md +0 -237
  19. package/skills/biopython/SKILL.md +0 -472
  20. package/skills/bioservices/SKILL.md +0 -399
  21. package/skills/bulk-rnaseq/SKILL.md +0 -198
  22. package/skills/cellxgene-census/SKILL.md +0 -283
  23. package/skills/cirq/SKILL.md +0 -370
  24. package/skills/citation-management/SKILL.md +0 -329
  25. package/skills/clinical-decision-support/SKILL.md +0 -238
  26. package/skills/clinical-decision-support/references/README.md +0 -62
  27. package/skills/clinical-reports/SKILL.md +0 -248
  28. package/skills/clinical-reports/references/README.md +0 -34
  29. package/skills/cobrapy/SKILL.md +0 -496
  30. package/skills/consciousness-council/SKILL.md +0 -151
  31. package/skills/dask/SKILL.md +0 -482
  32. package/skills/database-lookup/SKILL.md +0 -386
  33. package/skills/datamol/SKILL.md +0 -200
  34. package/skills/deepchem/SKILL.md +0 -244
  35. package/skills/deepspot-m/SKILL.md +0 -175
  36. package/skills/deeptools/SKILL.md +0 -412
  37. package/skills/depmap/SKILL.md +0 -301
  38. package/skills/dhdna-profiler/SKILL.md +0 -184
  39. package/skills/diffdock/SKILL.md +0 -488
  40. package/skills/dnanexus-integration/SKILL.md +0 -325
  41. package/skills/docx/SKILL.md +0 -99
  42. package/skills/esm/SKILL.md +0 -334
  43. package/skills/etetoolkit/SKILL.md +0 -327
  44. package/skills/exa-search/SKILL.md +0 -102
  45. package/skills/executing-plans/SKILL.md +0 -14
  46. package/skills/experimental-design/SKILL.md +0 -234
  47. package/skills/exploratory-data-analysis/SKILL.md +0 -280
  48. package/skills/flowio/SKILL.md +0 -310
  49. package/skills/fluidsim/SKILL.md +0 -279
  50. package/skills/frontend-design/SKILL.md +0 -100
  51. package/skills/generate-image/SKILL.md +0 -304
  52. package/skills/geniml/SKILL.md +0 -310
  53. package/skills/genomic-coordinates/SKILL.md +0 -189
  54. package/skills/genomic-intelligence/SKILL.md +0 -243
  55. package/skills/geomaster/README.md +0 -105
  56. package/skills/geomaster/SKILL.md +0 -366
  57. package/skills/geopandas/SKILL.md +0 -250
  58. package/skills/get-available-resources/SKILL.md +0 -260
  59. package/skills/gget/SKILL.md +0 -153
  60. package/skills/ginkgo-cloud-lab/SKILL.md +0 -106
  61. package/skills/glycoengineering/SKILL.md +0 -339
  62. package/skills/gtars/SKILL.md +0 -282
  63. package/skills/guardian-rails/SKILL.md +0 -54
  64. package/skills/histolab/SKILL.md +0 -243
  65. package/skills/hugging-science/SKILL.md +0 -132
  66. package/skills/hypogenic/SKILL.md +0 -290
  67. package/skills/hypothesis-generation/SKILL.md +0 -264
  68. package/skills/imaging-data-commons/SKILL.md +0 -496
  69. package/skills/infographics/SKILL.md +0 -315
  70. package/skills/iso-standards-readiness/SKILL.md +0 -352
  71. package/skills/lab-hardware-cad/SKILL.md +0 -372
  72. package/skills/labarchive-integration/SKILL.md +0 -216
  73. package/skills/lamindb/SKILL.md +0 -408
  74. package/skills/latchbio-integration/SKILL.md +0 -227
  75. package/skills/latex-posters/SKILL.md +0 -369
  76. package/skills/latex-posters/references/README.md +0 -439
  77. package/skills/liteparse/SKILL.md +0 -295
  78. package/skills/literature-review/SKILL.md +0 -263
  79. package/skills/markdown-mermaid-writing/SKILL.md +0 -322
  80. package/skills/market-research-reports/SKILL.md +0 -337
  81. package/skills/markitdown/SKILL.md +0 -264
  82. package/skills/matchms/SKILL.md +0 -276
  83. package/skills/matlab/SKILL.md +0 -274
  84. package/skills/matplotlib/SKILL.md +0 -378
  85. package/skills/medchem/SKILL.md +0 -321
  86. package/skills/modal/SKILL.md +0 -468
  87. package/skills/molecular-dynamics/SKILL.md +0 -458
  88. package/skills/molfeat/SKILL.md +0 -348
  89. package/skills/ncats-arax/SKILL.md +0 -178
  90. package/skills/networkx/SKILL.md +0 -440
  91. package/skills/neurokit2/SKILL.md +0 -323
  92. package/skills/neuropixels-analysis/SKILL.md +0 -412
  93. package/skills/nextflow/SKILL.md +0 -195
  94. package/skills/omero-integration/SKILL.md +0 -222
  95. package/skills/onekgpd/SKILL.md +0 -371
  96. package/skills/ontology-term-resolution/SKILL.md +0 -147
  97. package/skills/open-notebook/SKILL.md +0 -297
  98. package/skills/openpiv/SKILL.md +0 -469
  99. package/skills/opentrons-integration/SKILL.md +0 -322
  100. package/skills/optimize-for-gpu/SKILL.md +0 -176
  101. package/skills/owasp-top10/SKILL.md +0 -48
  102. package/skills/pacsomatic/LICENSE +0 -21
  103. package/skills/pacsomatic/SKILL.md +0 -150
  104. package/skills/paper-lookup/SKILL.md +0 -263
  105. package/skills/paperclip/SKILL.md +0 -413
  106. package/skills/paperzilla/SKILL.md +0 -159
  107. package/skills/parallel-web/SKILL.md +0 -128
  108. package/skills/pathml/SKILL.md +0 -222
  109. package/skills/pathogen-variant-surveillance/SKILL.md +0 -208
  110. package/skills/pathway-enrichment/SKILL.md +0 -194
  111. package/skills/pdf/SKILL.md +0 -322
  112. package/skills/peer-review/SKILL.md +0 -288
  113. package/skills/penetration-testing/SKILL.md +0 -31
  114. package/skills/pennylane/SKILL.md +0 -240
  115. package/skills/phylogenetics/SKILL.md +0 -409
  116. package/skills/pi-agent/SKILL.md +0 -83
  117. package/skills/pkpd-modeling/SKILL.md +0 -381
  118. package/skills/polars/SKILL.md +0 -393
  119. package/skills/polars-bio/SKILL.md +0 -379
  120. package/skills/ponytail/SKILL.md +0 -31
  121. package/skills/ponytail-audit/SKILL.md +0 -18
  122. package/skills/pptx/SKILL.md +0 -246
  123. package/skills/pptx-posters/SKILL.md +0 -258
  124. package/skills/primekg/SKILL.md +0 -99
  125. package/skills/protocolsio-integration/SKILL.md +0 -236
  126. package/skills/pufferlib/SKILL.md +0 -328
  127. package/skills/pydeseq2/SKILL.md +0 -369
  128. package/skills/pydicom/SKILL.md +0 -381
  129. package/skills/pyhealth/SKILL.md +0 -124
  130. package/skills/pylabrobot/SKILL.md +0 -216
  131. package/skills/pymatgen/SKILL.md +0 -404
  132. package/skills/pymc/SKILL.md +0 -310
  133. package/skills/pymoo/SKILL.md +0 -276
  134. package/skills/pyopenms/SKILL.md +0 -179
  135. package/skills/pysam/SKILL.md +0 -330
  136. package/skills/pytdc/SKILL.md +0 -297
  137. package/skills/pytorch-lightning/SKILL.md +0 -191
  138. package/skills/pyzotero/SKILL.md +0 -137
  139. package/skills/qiskit/SKILL.md +0 -259
  140. package/skills/qutip/SKILL.md +0 -317
  141. package/skills/rdkit/SKILL.md +0 -94
  142. package/skills/relsa-severity-assessment/SKILL.md +0 -354
  143. package/skills/research-grants/SKILL.md +0 -296
  144. package/skills/research-grants/references/README.md +0 -287
  145. package/skills/research-lookup/README.md +0 -106
  146. package/skills/research-lookup/SKILL.md +0 -338
  147. package/skills/rowan/SKILL.md +0 -398
  148. package/skills/scanpy/SKILL.md +0 -303
  149. package/skills/scholar-evaluation/SKILL.md +0 -296
  150. package/skills/scientific-brainstorming/SKILL.md +0 -282
  151. package/skills/scientific-critical-thinking/SKILL.md +0 -180
  152. package/skills/scientific-schematics/SKILL.md +0 -370
  153. package/skills/scientific-slides/SKILL.md +0 -379
  154. package/skills/scientific-visualization/SKILL.md +0 -285
  155. package/skills/scientific-writing/SKILL.md +0 -356
  156. package/skills/scikit-bio/SKILL.md +0 -470
  157. package/skills/scikit-learn/SKILL.md +0 -324
  158. package/skills/scikit-survival/SKILL.md +0 -313
  159. package/skills/scvelo/SKILL.md +0 -328
  160. package/skills/scvi-tools/SKILL.md +0 -201
  161. package/skills/seaborn/SKILL.md +0 -254
  162. package/skills/security-auditor/SKILL.md +0 -37
  163. package/skills/shap/SKILL.md +0 -282
  164. package/skills/simpy/SKILL.md +0 -283
  165. package/skills/stable-baselines3/SKILL.md +0 -325
  166. package/skills/statistical-analysis/SKILL.md +0 -446
  167. package/skills/statistical-power/SKILL.md +0 -200
  168. package/skills/statsmodels/SKILL.md +0 -238
  169. package/skills/sympy/SKILL.md +0 -354
  170. package/skills/systematic-debugging/SKILL.md +0 -35
  171. package/skills/tamarind/SKILL.md +0 -285
  172. package/skills/tdd/SKILL.md +0 -26
  173. package/skills/tiledbvcf/SKILL.md +0 -456
  174. package/skills/timesfm-forecasting/SKILL.md +0 -408
  175. package/skills/timesfm-forecasting/examples/global-temperature/README.md +0 -178
  176. package/skills/torch-geometric/SKILL.md +0 -458
  177. package/skills/torchdrug/SKILL.md +0 -241
  178. package/skills/transformers/SKILL.md +0 -195
  179. package/skills/treatment-plans/SKILL.md +0 -174
  180. package/skills/treatment-plans/references/README.md +0 -19
  181. package/skills/umap-learn/SKILL.md +0 -488
  182. package/skills/uncertainty-and-units/SKILL.md +0 -384
  183. package/skills/usfiscaldata/SKILL.md +0 -171
  184. package/skills/vaex/SKILL.md +0 -204
  185. package/skills/venue-templates/SKILL.md +0 -269
  186. package/skills/verification-before-completion/SKILL.md +0 -22
  187. package/skills/waypoint-bio/SKILL.md +0 -273
  188. package/skills/what-if-oracle/SKILL.md +0 -184
  189. package/skills/writing-plans/SKILL.md +0 -15
  190. package/skills/xlsx/SKILL.md +0 -110
  191. package/skills/zarr-python/SKILL.md +0 -241
@@ -1,354 +0,0 @@
1
- ---
2
- name: relsa-severity-assessment
3
- description: Multivariate severity assessment and humane endpoint prediction for laboratory animal studies using the RELSA (RELative Severity Assessment) score and ARIMA-based foRcast forecasting. Use when combining welfare readouts — body weight or weight loss, body temperature, clinical or nesting scores, biomarkers, activity, heart rate, burrowing, wheel running — into one severity score per animal per day, when asking which animals are at risk of reaching a humane endpoint or when one will be reached, when defining attention/danger zones or thresholds on a severity scale by kernel density estimation, or when reporting severity for a 3Rs, refinement, animal-welfare, or EU Directive 2010/63/EU severity-assessment context. Covers directionality ("turned" variables), baseline normalization, reference sets, RELSA weights, ARIMA prediction intervals, and RMSE/PICP/MPIW evaluation.
4
- license: MIT
5
- allowed-tools: Read Write Edit Bash
6
- compatibility: Requires Python >=3.10 with numpy, pandas, and scipy; statsmodels >=0.14 for forecasting and matplotlib for figures. Tested with numpy 2.5, pandas 3.0, scipy 1.18, statsmodels 0.14.6. No network access needed.
7
- metadata:
8
- version: "1.0"
9
- skill-author: K-Dense Inc.
10
- ---
11
-
12
- # RELSA severity assessment and humane endpoint forecasting
13
-
14
- ## Overview
15
-
16
- Severity assessment in animal research is legally mandatory and scientifically load-bearing:
17
- it drives humane endpoint decisions, and poor welfare monitoring degrades reproducibility.
18
- The usual practice evaluates each readout in isolation — weight loss here, a clinical score
19
- there — which makes it hard to say how badly an individual animal is actually doing.
20
-
21
- This skill implements two published procedures that address that:
22
-
23
- - **RELSA** (Talbot et al., 2022) combines several outcome measures into one score per animal
24
- per time point, expressed *relative to a reference set of known burden*. RELSA = 0 is
25
- baseline; RELSA = 1 means the animal has reached the reference set's maximum deviation.
26
- - **foRcast** (Lutscher et al., 2026) fits an ARIMA model to an individual animal's RELSA
27
- trajectory and forecasts the next score with a 95% prediction interval, so animals heading
28
- for a humane endpoint can be identified before they get there. Kernel density estimation on
29
- the RELSA scale supplies candidate *attention* and *danger* zones for interpretation.
30
-
31
- The point is **refinement**: give at-risk animals attention earlier, and avoid euthanising
32
- animals that would have recovered. Both procedures are aids to severity assessment, not
33
- decision rules — see [Boundaries](#boundaries-state-these-when-you-report).
34
-
35
- ## When to use this skill
36
-
37
- - Combining weight loss, temperature, clinical scoring, biomarkers, or telemetry into a single
38
- per-animal severity score
39
- - Asking which animals in a cohort are at risk of reaching a humane endpoint, or predicting
40
- the severity score at a coming time point
41
- - Comparing severity between treatment groups, interventions, or animal models on a common
42
- relative scale
43
- - Defining thresholds or zones on a severity scale from the data
44
- - Writing the severity-assessment section of an animal welfare report, a 3Rs/refinement
45
- analysis, or an application under EU Directive 2010/63/EU
46
-
47
- For general forecasting of a time series that is not a severity score, use
48
- **timesfm-forecasting** or **statsmodels**. For study design and sample size, use
49
- **experimental-design** and **statistical-power**.
50
-
51
- ## Installation
52
-
53
- ```bash
54
- uv pip install "numpy>=1.26" "pandas>=2.0" "scipy>=1.11" "statsmodels>=0.14" matplotlib
55
- ```
56
-
57
- `relsa_score.py` and `kde_thresholds.py` need only numpy/pandas/scipy; statsmodels is required
58
- for forecasting and matplotlib only for figures.
59
-
60
- ## Data format
61
-
62
- One row per animal per time point, in a CSV:
63
-
64
- | id | treatment | condition | day | temp | weight | score | il6 |
65
- | --- | --- | --- | --- | --- | --- | --- | --- |
66
- | M01 | treated | endpoint | -1 | 37.15 | 25.17 | 0 | 35.1 |
67
- | M01 | treated | endpoint | 0 | 37.26 | 25.25 | 0 | 39.5 |
68
- | M01 | treated | endpoint | 1 | 35.83 | 23.12 | 4 | 162.0 |
69
-
70
- - `id` and a time column (`day`, `time`, `hour`, …) are required; `treatment` and `condition`
71
- are optional labels used for grouping and for selecting the reference set.
72
- - Time may be days, hours, or minutes — just keep it monotonic per animal. The RELSA
73
- convention codes the baseline time point as `-1`.
74
- - **One row per animal per time point.** Average hourly telemetry to one value per interval
75
- first (the published models average heart rate, HRV, and temperature, and sum activity).
76
- - Leave missing measurements empty. They are dropped from the score, never imputed — a
77
- missing value treated as "no deviation" biases severity downward.
78
-
79
- `assets/example_cohort.csv` is a small synthetic cohort (6 mice, 9 days, temperature, body
80
- weight, an 0–8 clinical score, and an IL-6-like biomarker) used by every command below, so
81
- each one is runnable as written.
82
-
83
- ## The four decisions that determine the result
84
-
85
- Make these explicitly and write them into the methods. Nothing else about the procedure
86
- matters as much.
87
-
88
- **1. Directionality — which variables rise under worsening?** Falling is the default (body
89
- weight, activity, food intake, burrowing, wheel running). Variables that *rise* must be
90
- declared as `--turned`: clinical scores, inflammatory biomarkers, fever, tachycardia. Get
91
- this wrong and the variable contributes nothing at all, silently, because deviations in the
92
- "wrong" direction are floored at zero. Body temperature is model-dependent — it *falls* in
93
- sepsis and endotoxaemia, *rises* in fever models. Nothing in the data can settle this for you:
94
- in the published sepsis model activity legitimately swings further above baseline than below,
95
- so only a variable that *never once* moves the declared way is detectable, and
96
- `build_reference()` warns about exactly that case.
97
-
98
- **2. The reference set — relative to what?** RELSA scores mean nothing without it. Use the
99
- group assumed to carry the greatest burden in your model (the published studies use the
100
- highest-dose or endpoint-reaching treatment group). Too mild a reference pushes every score
101
- above 1; too severe compresses everything toward 0. Save it with `--save-reference` and reuse
102
- it with `--load-reference` so later cohorts stay on the same scale.
103
-
104
- **3. Scores with a zero baseline.** A clinical score of 0 in a healthy animal cannot be
105
- ratio-normalized — `0/0` is undefined. Use `--score-scale score=8` to map the score's scale
106
- instead (healthy → 100%, worst possible → 200%), which also marks it as turned. This mapping
107
- is a modelling choice about how much one score point is worth relative to one percent of body
108
- weight; state it. The alternative is to keep the score out of RELSA and use it as an
109
- independent endpoint criterion.
110
-
111
- **4. Which variables are measured throughout.** Because the score averages over whichever
112
- variables are available, a variable that appears or disappears mid-trajectory moves the score
113
- by itself. In the published sepsis data, adding body weight — recorded only on the day of
114
- euthanasia — drops that animal's endpoint score from 0.93 to 0.83 for no biological reason.
115
- `relsa_scores()` warns when composition changes; score the variables present throughout.
116
-
117
- ## Workflow
118
-
119
- ### Step 1 — compute RELSA scores
120
-
121
- ```bash
122
- python scripts/relsa_score.py assets/example_cohort.csv \
123
- --variables weight,temp,score,il6 \
124
- --normalize weight,temp,il6 \
125
- --turned il6 \
126
- --score-scale score=8 \
127
- --baseline-time -1 \
128
- --reference-group condition=endpoint \
129
- --save-reference reference.json \
130
- --out relsa_scores.csv
131
- ```
132
-
133
- The reference model is echoed so the scale is auditable:
134
-
135
- ```
136
- reference model: assets/example_cohort.csv [condition=endpoint]
137
- animals=2 rows=18 baseline_time=-1.0
138
- variable turned max reached max delta
139
- weight no 82.40 17.60
140
- temp no 92.79 7.21
141
- score yes 187.50 87.50
142
- il6 yes 797.72 697.72
143
- ```
144
-
145
- `relsa_scores.csv` holds each variable's weight alongside the score, which is what makes a
146
- score explainable — here M01 deteriorating to its endpoint, M03 peaking on day 3 and
147
- recovering:
148
-
149
- ```
150
- id time weight temp score il6 n_vars relsa
151
- M01 1 0.46 0.49 0.57 0.52 4 0.51
152
- M01 3 0.84 0.76 1.00 0.89 4 0.88
153
- M01 5 1.00 1.00 1.00 1.00 4 1.00
154
- M03 3 0.56 0.44 0.57 0.54 4 0.53
155
- M03 5 0.35 0.26 0.43 0.32 4 0.35
156
- M03 7 0.12 0.06 0.14 0.11 4 0.11
157
- ```
158
-
159
- A weight of 1.00 means that variable hit the reference maximum; `n_vars` is how many
160
- variables entered the score at that time point.
161
-
162
- Same thing from Python, when you need the objects:
163
-
164
- ```python
165
- import sys; sys.path.insert(0, "scripts")
166
- from _common import read_relsa_table, score_to_percent
167
- from relsa_score import prepare, build_reference, relsa_scores
168
-
169
- frame = read_relsa_table("assets/example_cohort.csv")
170
- frame["score"] = score_to_percent(frame["score"], max_score=8) # 0-8 clinical score
171
- VARS, TURNED = ["weight", "temp", "score", "il6"], ["score", "il6"]
172
-
173
- prepared = prepare(frame, normalize=["weight", "temp", "il6"], baseline_time=-1)
174
- reference = build_reference(prepared[prepared.condition == "endpoint"],
175
- variables=VARS, turned=TURNED, baseline_time=-1,
176
- label="endpoint-reaching animals")
177
- scores = relsa_scores(prepared, reference)
178
- ```
179
-
180
- ### Step 2 — forecast the endpoint
181
-
182
- Train on everything up to the time point *before* the endpoint, predict the score at the
183
- endpoint, and score the prediction:
184
-
185
- ```bash
186
- python scripts/forecast_relsa.py relsa_scores.csv \
187
- --animals M01,M02 --endpoints M01=5 --endpoints M02=6 \
188
- --group-col condition --plot-dir figs --endpoint-line 1.0
189
- ```
190
-
191
- ```
192
- id time predicted lower upper model actual
193
- M01 5.0 0.932585 0.670443 1.194728 ARIMA(1,1,0) 1.00
194
- M02 6.0 0.955696 0.748309 1.163084 ARIMA(1,1,0) 0.94
195
-
196
- group id model n rmse picp mpiw
197
- endpoint M01 ARIMA(1,1,0) 1 0.0674 100.0 0.524
198
- endpoint M02 ARIMA(1,1,0) 1 0.0157 100.0 0.415
199
- endpoint -- endpoint -- 2 0.0489 100.0 0.470
200
- OVERALL 2 0.0489 100.0 0.470
201
- ```
202
-
203
- Report all three metrics together. **RMSE** is point accuracy, **PICP** the percentage of
204
- actual values inside the interval, and **MPIW** the mean interval width in RELSA units — a
205
- model can reach PICP = 100% by making the interval so wide it says nothing, which is exactly
206
- what the paper's pancreatic cancer row (PICP 100%, MPIW 7.35, i.e. 735% of the RELSA range)
207
- shows.
208
-
209
- For live monitoring, forecast one step ahead at every time point instead:
210
-
211
- ```bash
212
- python scripts/forecast_relsa.py relsa_scores.csv --mode rolling --animals M03
213
- ```
214
-
215
- Two things to know before trusting a forecast:
216
-
217
- - **Interpolation is on by default** (`--interpolate-step 0.1`), because one measurement per
218
- day is far too sparse for ARIMA. It buys usable model selection and narrower intervals at
219
- the cost of honest uncertainty. Set `--interpolate-step 0` when measurement frequency
220
- allows.
221
- - **ARIMA cannot predict a cliff.** It assumes stationarity and linearity, so an abrupt
222
- collapse in the last hours before an endpoint will not be forecast from a smooth prior
223
- trajectory — the paper's own failure case. Act on the *upper* bound of the interval, and
224
- never let a low forecast override an animal that looks unwell.
225
-
226
- ### Step 3 — put the score in context with severity zones
227
-
228
- ```bash
229
- python scripts/kde_thresholds.py relsa_scores.csv \
230
- --group treatment=treated --n-thresholds 2 --plot zones.png --json zones.json
231
- ```
232
-
233
- ```
234
- KDE on 33 RELSA scores (bandwidth = 0.1502)
235
- candidate thresholds (density minima): 0.703
236
- density modes: 0.264, 0.866
237
- normal [0.000, 0.703) n=25 (75.8%)
238
- danger >= 0.703 n=8 (24.2%)
239
- ```
240
-
241
- Thresholds are the *minima* of the score density — the sparse valleys between clusters of
242
- scores. Include endpoint animals, survivors, and shams: the zones are meant to separate
243
- those states, so all of them must be represented.
244
-
245
- **Check the bandwidth before believing a threshold.** On the published sepsis data this
246
- implementation finds minima at 0.355 and 0.655 (published: 0.337 and 0.643) — but a 10%
247
- larger bandwidth removes both minima entirely. Run the sweep in
248
- `references/thresholds-and-zones.md` and report the sweep, not a bare pair of numbers. An
249
- empty threshold list is a legitimate answer: the scores form one cluster and there is no
250
- data-driven place to cut.
251
-
252
- ## Boundaries: state these when you report
253
-
254
- - **RELSA is an aid to severity assessment, not a decisive parameter.** An animal with a low
255
- RELSA score that shows other signs of distress must still be handled accordingly. Neither
256
- procedure is a validated predictor of death.
257
- - **KDE zones are not regulatory severity gradings.** EU Directive 2010/63/EU's categories
258
- (non-recovery, mild, moderate, severe) are assigned prospectively by a different process.
259
- The paper is explicit that its thresholds "should not be confused with regulatory severity
260
- gradings" and are not directly translatable to them.
261
- - **Scores are not comparable across reference sets or models.** RELSA is relative by
262
- construction, and clinical scoring is not harmonized between laboratories. Always report
263
- the reference set with the score.
264
- - **The published evidence is a proof of concept**: 13 animals across seven models, five of
265
- those rows resting on one or two animals. The overall RMSE of 0.069 and PICP of 96% come
266
- from 13 endpoint predictions.
267
- - **An underestimated score is the dangerous error**, because it discourages attention and can
268
- delay a euthanasia decision, whereas an overestimate merely prompts extra care.
269
-
270
- ## Reporting checklist
271
-
272
- A severity analysis is reproducible only if all of this is stated:
273
-
274
- 1. Outcome measures, their units, and their **directionality** (which were turned, and why).
275
- 2. The **baseline** time point or window, and which variables were normalized.
276
- 3. Any **score mapping** applied to ordinal variables, with its scale.
277
- 4. The **reference set**: which animals, which group, how many, and why they are assumed to
278
- carry the greatest burden.
279
- 5. Humane endpoint criteria actually applied in the study, separately from the RELSA score.
280
- 6. For forecasts: interpolation step, the selected ARIMA order per animal, and RMSE, PICP,
281
- *and* MPIW.
282
- 7. For thresholds: the bandwidth, the number of scores, and a bandwidth sensitivity sweep.
283
- 8. Software versions, and the statement that thresholds are model-specific and not regulatory
284
- gradings.
285
-
286
- ## Common pitfalls
287
-
288
- 1. **Wrong directionality** — a rising variable not listed in `--turned` contributes exactly
289
- zero, silently, and no warning is possible unless it never once falls. Check the reference
290
- model table yourself: `max reached` should be below 100 for a falling variable and above 100
291
- for a turned one, and `max delta` should be a plausible size for that measure.
292
- 2. **Normalizing a percentage twice** — `bwc [%]` and mapped scores are already on the percent
293
- scale; passing them to `--normalize` flattens them.
294
- 3. **A zero baseline** — a clinical score of 0 makes the ratio undefined; the variable becomes
295
- all-NaN with a warning. Use `--score-scale`.
296
- 4. **A reference set that does not express the burden** — a variable that never deviates in it
297
- raises an error rather than dividing by zero, and one that barely deviates inflates every
298
- score.
299
- 5. **Changing variable composition along a trajectory** — see decision 4 above.
300
- 6. **Reading MPIW as a good thing** — a wide interval raises PICP while destroying the
301
- forecast's usefulness.
302
- 7. **Reporting a KDE threshold without its bandwidth** — thresholds can vanish under a 10%
303
- bandwidth change.
304
- 8. **Treating the forecast as permission to wait** — the model cannot see abrupt
305
- deterioration, and the humane endpoint criteria of the protocol always take precedence.
306
- 9. **Comparing RELSA scores between models** — only valid within one reference frame.
307
-
308
- ## Resources
309
-
310
- ### Scripts
311
-
312
- - `scripts/relsa_score.py` — the RELSA procedure: `prepare()`, `build_reference()`,
313
- `relsa_scores()`, `relsa_weights()`, and a `ReferenceModel` that serialises to JSON.
314
- Reproduces the R package's published worked example to two decimals.
315
- - `scripts/forecast_relsa.py` — the foRcast tool: `auto_arima()` (Hyndman–Khandakar stepwise
316
- AICc selection), `forecast_animal()`, `predict_endpoint()`, `rolling_forecast()`,
317
- `forecast_indirect()`, `summarize()`, and Figure-1-style plots.
318
- - `scripts/kde_thresholds.py` — severity zones: `bw_nrd0()` (R's bandwidth), `density_curve()`,
319
- `find_thresholds()`, zone assignment, and Figure-3-style density plots.
320
- - `scripts/_common.py` — RELSA-format I/O, validation, `score_to_percent()`,
321
- `percent_of_baseline()`, and `forecast_metrics()` (RMSE/PICP/MPIW).
322
-
323
- ### References
324
-
325
- - `references/relsa-method.md` — the four steps in full, the score/zero-baseline problem, the
326
- variable-composition trap, parity notes against the R package, and the outcome measures and
327
- endpoint criteria of all seven published models.
328
- - `references/forecasting.md` — ARIMA selection, why interpolation is a distortion, direct vs
329
- indirect prediction, the metrics, the published Table 1, and what this port reproduces.
330
- - `references/thresholds-and-zones.md` — KDE method, published thresholds, the bandwidth
331
- sensitivity sweep, the regulatory boundary, and alternatives when KDE gives nothing.
332
-
333
- ### Assets
334
-
335
- - `assets/example_cohort.csv` — synthetic 6-mouse cohort with temperature, body weight, a
336
- clinical score, and a biomarker; illustrative only, not real data.
337
-
338
- ### Related skills
339
-
340
- - **experimental-design**, **statistical-power** — designing the study and sizing the groups.
341
- - **statsmodels**, **timesfm-forecasting** — general time-series modelling.
342
- - **statistical-analysis**, **scientific-visualization** — group comparisons and figures.
343
-
344
- ### Key references
345
-
346
- - Talbot, S. R. et al. (2022). RELSA — a multidimensional procedure for the comparative
347
- assessment of well-being and the quantitative determination of severity in experimental
348
- procedures. *Front. Vet. Sci.* 9:937711. R package: <https://github.com/mytalbot/RELSA>
349
- - Lutscher, S. et al. (2026). Refining humane endpoint detection by time-series forecasting
350
- and threshold definition using a multivariate severity score. *Front. Physiol.* 17:1869563.
351
- - Hyndman, R. J. & Khandakar, Y. (2008). Automatic time series forecasting: the forecast
352
- package for R. *J. Stat. Softw.* 27, 1–22.
353
- - EU Commission (2010). Directive 2010/63/EU on the protection of animals used for scientific
354
- purposes.
@@ -1,296 +0,0 @@
1
- ---
2
- name: research-grants
3
- description: Write competitive research proposals for NSF, NIH, DOE, DARPA, and Taiwan NSTC. Agency-specific formatting, review criteria, budget preparation, broader impacts, significance statements, innovation narratives, and compliance with submission requirements.
4
- allowed-tools: Read Write Edit Bash
5
- license: MIT license
6
- compatibility: Works in Agent Skills-compatible hosts. Grant-writing guidance needs no network; optional figures via the scientific-schematics skill require OPENROUTER_API_KEY and outbound API access.
7
- metadata:
8
- version: "1.2"
9
- skill-author: K-Dense Inc.
10
- ---
11
-
12
- # Research Grant Writing
13
-
14
- ## Overview
15
-
16
- Research grant writing is the process of developing competitive funding proposals for federal agencies and foundations. Master agency-specific requirements, review criteria, narrative structure, budget preparation, and compliance for NSF (National Science Foundation), NIH (National Institutes of Health), DOE (Department of Energy), DARPA (Defense Advanced Research Projects Agency), and Taiwan's NSTC (National Science and Technology Council) submissions.
17
-
18
- **Critical Principle: Grants are persuasive documents that must simultaneously demonstrate scientific rigor, innovation, feasibility, and broader impact.** Each agency has distinct priorities, review criteria, formatting requirements, and strategic goals that must be addressed.
19
-
20
- ## When to Use This Skill
21
-
22
- This skill should be used when:
23
- - Writing research proposals for NSF, NIH, DOE, DARPA, or NSTC programs
24
- - Preparing project descriptions, specific aims, or technical narratives
25
- - Developing broader impacts or significance statements
26
- - Creating research timelines and milestone plans
27
- - Preparing budget justifications and personnel allocation plans
28
- - Responding to program solicitations or funding announcements
29
- - Addressing reviewer comments in resubmissions
30
- - Planning multi-institutional collaborative proposals
31
- - Writing preliminary data or feasibility sections
32
- - Preparing biosketches, CVs, or facilities descriptions
33
-
34
- ## Visual Enhancement (Optional)
35
-
36
- Strong proposals often include 1–3 figures (timelines, workflow diagrams, preliminary data). Figures support review but are not a substitute for clear aims and methods.
37
-
38
- **When figures help:**
39
- - Research methodology and workflow diagrams
40
- - Project timeline or Gantt charts
41
- - Conceptual framework or system architecture (technical proposals)
42
- - Experimental design flowcharts
43
- - Broader impacts activity diagrams
44
- - NSTC CM03 research architecture diagrams (often expected)
45
-
46
- **How to create figures:**
47
- - **Preferred:** Use the **scientific-schematics** skill (`--doc-type grant`) for AI-generated diagrams from a natural-language description
48
- - **Alternative:** Build figures in your usual tools (matplotlib, Illustrator, PowerPoint, etc.)
49
-
50
- From the `scientific-schematics` skill directory, with `OPENROUTER_API_KEY` set:
51
-
52
- ```bash
53
- python scripts/generate_schematic.py "project timeline with Year 1-3 milestones" -o figures/timeline.png --doc-type grant
54
- ```
55
-
56
- **Disclosure:** AI schematic generation sends your prompt to [OpenRouter](https://openrouter.ai/) (a third-party API). Do not include unpublished sensitive details unless that transmission is appropriate for your project.
57
-
58
- ---
59
-
60
- ## Agency-Specific Overview
61
-
62
- ### NSF (National Science Foundation)
63
- **Mission**: Promote the progress of science and advance national health, prosperity, and welfare
64
-
65
- **Key Features**:
66
- - Follow [PAPPG 24-1](https://www.nsf.gov/policies/pappg) (effective May 20, 2024) unless a solicitation overrides it
67
- - Intellectual Merit + Broader Impacts (equally weighted)
68
- - 15-page project description limit (most programs; includes Results from Prior NSF Support, max 5 pages)
69
- - Emphasis on education, diversity, and societal benefit
70
- - Collaborative research encouraged
71
- - Open data and open science emphasis
72
- - Merit review process with panel + ad hoc reviewers
73
-
74
- ### NIH (National Institutes of Health)
75
- **Mission**: Enhance health, lengthen life, and reduce illness and disability
76
-
77
- **Key Features**:
78
- - Specific Aims (1 page) + Research Strategy (12 pages for R01)
79
- - Significance, Innovation, Approach as core review criteria
80
- - Preliminary data typically required for R01s
81
- - Emphasis on rigor, reproducibility, and clinical relevance
82
- - Modular budgets ($250K increments) for most R01s
83
- - Multiple resubmission opportunities
84
-
85
- ### DOE (Department of Energy)
86
- **Mission**: Ensure America's security and prosperity through energy, environmental, and nuclear challenges
87
-
88
- **Key Features**:
89
- - Focus on energy, climate, computational science, basic energy sciences
90
- - Often requires cost sharing or industry partnerships
91
- - Emphasis on national laboratory collaboration
92
- - Strong computational and experimental integration
93
- - Energy innovation and commercialization pathways
94
- - Varies by office (ARPA-E, Office of Science, EERE, etc.)
95
-
96
- ### DARPA (Defense Advanced Research Projects Agency)
97
- **Mission**: Make pivotal investments in breakthrough technologies for national security
98
-
99
- **Key Features**:
100
- - High-risk, high-reward transformative research
101
- - Focus on "DARPA-hard" problems (what if true, who cares)
102
- - Emphasis on prototypes, demonstrations, and transition paths
103
- - Often requires multiple phases (feasibility, development, demonstration)
104
- - Strong project management and milestone tracking
105
- - Teaming and collaboration often required
106
- - Varies dramatically by program manager and BAA (Broad Agency Announcement)
107
-
108
- ### NSTC (National Science and Technology Council - Taiwan)
109
- **Mission**: Advance scientific breakthrough, industrial application, and societal impact in Taiwan.
110
-
111
- **Key Features**:
112
- - **CM03 Form**: The core technical proposal format.
113
- - **Bilingual**: Abstract required in both Chinese and English.
114
- - **Innovation & Feasibility**: Primary review focus.
115
- - **Preliminary Data**: Highly critical for credibility.
116
- - **Research Architecture Diagram**: A mandatory visual element for clarity.
117
-
118
- ## Core Components of Research Proposals
119
-
120
- Section-by-section guidance for every standard proposal component — specific aims,
121
- significance, innovation, approach, preliminary data, timeline, budget and justification,
122
- biosketch, facilities, data management and sharing, and broader impacts — with structure,
123
- length targets, and worked language, is in
124
- [references/core_components.md](references/core_components.md).
125
-
126
- ## Review Criteria, Writing Principles, and Proposal Types
127
-
128
- - [references/review_criteria.md](references/review_criteria.md): how NIH, NSF, DOE, and
129
- DARPA score proposals, and what each criterion actually rewards.
130
- - [references/writing_principles.md](references/writing_principles.md): what separates
131
- funded proposals from competent ones — framing, specificity, reviewer psychology, and
132
- readability.
133
- - [references/proposal_types_and_resubmission.md](references/proposal_types_and_resubmission.md):
134
- the common proposal types and how to handle a resubmission, including responding to
135
- a summary statement.
136
-
137
- ## Common Mistakes to Avoid
138
-
139
- ### Conceptual Mistakes
140
-
141
- 1. **Failing to Address Review Criteria**: Not explicitly discussing significance, innovation, approach, etc.
142
- 2. **Mismatch with Agency Mission**: Proposing research that doesn't align with agency goals
143
- 3. **Unclear Significance**: Failing to articulate why the research matters
144
- 4. **Insufficient Innovation**: Incremental work presented as transformative
145
- 5. **Vague Objectives**: Goals that are not specific or measurable
146
-
147
- ### Writing Mistakes
148
-
149
- 1. **Poor Organization**: Lack of clear structure and flow
150
- 2. **Excessive Jargon**: Inaccessible to broader review panel
151
- 3. **Verbosity**: Unnecessarily complex or wordy writing
152
- 4. **Missing Context**: Assuming reviewers know your field deeply
153
- 5. **Inconsistent Terminology**: Using different terms for same concept
154
-
155
- ### Technical Mistakes
156
-
157
- 1. **Inadequate Methods**: Insufficient detail to judge feasibility
158
- 2. **Overly Ambitious**: Too much proposed for timeline/budget
159
- 3. **No Preliminary Data**: For mechanisms requiring demonstrated feasibility
160
- 4. **Poor Timeline**: Unrealistic or poorly justified schedule
161
- 5. **Misaligned Budget**: Budget doesn't support proposed activities
162
-
163
- ### Formatting Mistakes
164
-
165
- 1. **Exceeding Page Limits**: Automatic rejection
166
- 2. **Wrong Font or Margins**: Non-compliant formatting
167
- 3. **Missing Required Sections**: Incomplete application
168
- 4. **Poor Figure Quality**: Illegible or unprofessional figures
169
- 5. **Inconsistent Citations**: Formatting errors in references
170
-
171
- ### Strategic Mistakes
172
-
173
- 1. **Wrong Program or Mechanism**: Proposing to inappropriate opportunity
174
- 2. **Weak Team**: Insufficient expertise or missing key collaborators
175
- 3. **No Broader Impacts**: For NSF, failing to adequately address
176
- 4. **Ignoring Program Priorities**: Not aligning with current emphasis areas
177
- 5. **Late Submission**: Technical issues or rushed preparation
178
-
179
- ## Workflow for Grant Development
180
-
181
- ### Phase 1: Planning and Preparation (2-6 months before deadline)
182
-
183
- **Activities**:
184
- - Identify appropriate funding opportunities
185
- - Review program announcements and requirements
186
- - Consult with program officers (if appropriate)
187
- - Assemble team and confirm collaborations
188
- - Develop preliminary data (if needed)
189
- - Outline research plan and specific aims
190
- - Review successful proposals (if available)
191
-
192
- **Outputs**:
193
- - Selected funding opportunity
194
- - Assembled team with defined roles
195
- - Preliminary outline of specific aims
196
- - Gap analysis of needed preliminary data
197
-
198
- ### Phase 2: Drafting (2-3 months before deadline)
199
-
200
- **Activities**:
201
- - Write specific aims or objectives (start here!)
202
- - Develop project description/research strategy
203
- - Create figures and data visualizations
204
- - Draft timeline and milestones
205
- - Prepare preliminary budget
206
- - Write broader impacts or significance sections
207
- - Request letters of support/collaboration
208
-
209
- **Outputs**:
210
- - Complete first draft of narrative sections
211
- - Preliminary budget with justification
212
- - Timeline and management plan
213
- - Requested letters from collaborators
214
-
215
- ### Phase 3: Internal Review (1-2 months before deadline)
216
-
217
- **Activities**:
218
- - Circulate draft to co-investigators
219
- - Seek feedback from colleagues and mentors
220
- - Request institutional review (if required)
221
- - Mock review session (if possible)
222
- - Revise based on feedback
223
- - Refine budget and budget justification
224
-
225
- **Outputs**:
226
- - Revised draft incorporating feedback
227
- - Refined budget aligned with revised plan
228
- - Identified weaknesses and mitigation strategies
229
-
230
- ### Phase 4: Finalization (2-4 weeks before deadline)
231
-
232
- **Activities**:
233
- - Final revisions to narrative
234
- - Prepare all required forms and documents
235
- - Finalize budget and budget justification
236
- - Compile biosketches, CVs, and current & pending
237
- - Collect letters of support
238
- - Prepare data management plan (if required)
239
- - Write project summary/abstract
240
- - Proofread all materials
241
-
242
- **Outputs**:
243
- - Complete, polished proposal
244
- - All required supplementary documents
245
- - Formatted according to agency requirements
246
-
247
- ### Phase 5: Submission (1 week before deadline)
248
-
249
- **Activities**:
250
- - Institutional review and approval
251
- - Upload to submission portal
252
- - Verify all documents and formatting
253
- - Submit 24-48 hours before deadline
254
- - Confirm successful submission
255
- - Receive confirmation and proposal number
256
-
257
- **Outputs**:
258
- - Submitted proposal
259
- - Submission confirmation
260
- - Archived copy of all materials
261
-
262
- **Critical Tip**: Never wait until the deadline. Portals crash, files corrupt, and emergencies happen. Aim for 48 hours early.
263
-
264
- ## Integration with Other Skills
265
-
266
- This skill works effectively with:
267
- - **Scientific Schematics**: Optional AI-generated grant figures (`--doc-type grant`)
268
- - **Scientific Writing**: For clear, compelling prose
269
- - **Literature Review**: For comprehensive background sections
270
- - **Peer Review**: For self-assessment before submission
271
- - **Research Lookup**: For finding relevant citations and prior work
272
- - **Data Visualization**: For creating effective figures
273
-
274
- ## Resources
275
-
276
- This skill includes comprehensive reference files covering specific aspects of grant writing:
277
-
278
- - `references/nsf_guidelines.md`: NSF-specific requirements, formatting, and strategies
279
- - `references/nih_guidelines.md`: NIH mechanisms, review criteria, and submission requirements
280
- - `references/doe_guidelines.md`: DOE programs, emphasis areas, and application procedures
281
- - `references/darpa_guidelines.md`: DARPA BAAs, program offices, and proposal strategies
282
- - `references/broader_impacts.md`: Strategies for compelling broader impacts statements
283
- - `references/specific_aims_guide.md`: Writing effective specific aims pages
284
- - `references/nstc_guidelines.md`: NSTC-specific guidelines and review criteria
285
-
286
- Load these references as needed when working on specific aspects of grant writing.
287
-
288
- ## Templates and Assets
289
-
290
- - `assets/nsf_project_summary_template.md`: NSF project summary structure
291
- - `assets/nih_specific_aims_template.md`: NIH specific aims page template
292
- - `assets/budget_justification_template.md`: Budget justification structure
293
-
294
- ---
295
-
296
- **Final Note**: Grant writing is both an art and a science. Success requires not only excellent research ideas but also clear communication, strategic positioning, and meticulous attention to detail. Start early, seek feedback, and remember that even the best researchers face rejection—persistence and revision are key to funding success.