evalrx 0.1.2__py3-none-any.whl

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 (339) hide show
  1. evalrx/__init__.py +139 -0
  2. evalrx/agent_assets/__init__.py +2 -0
  3. evalrx/agent_assets/skills/README.md +28 -0
  4. evalrx/agent_assets/skills/eval-chart-style/SKILL.md +172 -0
  5. evalrx/agent_assets/skills/evalrx-report-ui/SKILL.md +116 -0
  6. evalrx/agent_assets/skills/nature-figure/LICENSE +201 -0
  7. evalrx/agent_assets/skills/nature-figure/README.md +412 -0
  8. evalrx/agent_assets/skills/nature-figure/SKILL.md +60 -0
  9. evalrx/agent_assets/skills/nature-figure/manifest.yaml +59 -0
  10. evalrx/agent_assets/skills/nature-figure/references/api.md +436 -0
  11. evalrx/agent_assets/skills/nature-figure/references/backend-selection.md +100 -0
  12. evalrx/agent_assets/skills/nature-figure/references/chart-types.md +281 -0
  13. evalrx/agent_assets/skills/nature-figure/references/common-patterns.md +350 -0
  14. evalrx/agent_assets/skills/nature-figure/references/demos.md +65 -0
  15. evalrx/agent_assets/skills/nature-figure/references/design-theory.md +439 -0
  16. evalrx/agent_assets/skills/nature-figure/references/figure-contract.md +93 -0
  17. evalrx/agent_assets/skills/nature-figure/references/figure-legend-conventions.md +71 -0
  18. evalrx/agent_assets/skills/nature-figure/references/nature-2026-observations.md +112 -0
  19. evalrx/agent_assets/skills/nature-figure/references/qa-contract.md +119 -0
  20. evalrx/agent_assets/skills/nature-figure/references/r-template-index.md +66 -0
  21. evalrx/agent_assets/skills/nature-figure/references/r-workflow.md +161 -0
  22. evalrx/agent_assets/skills/nature-figure/references/tutorials.md +251 -0
  23. evalrx/agent_assets/skills/nature-figure/static/core/contract.md +29 -0
  24. evalrx/agent_assets/skills/nature-figure/static/core/stance.md +37 -0
  25. evalrx/agent_assets/skills/nature-figure/static/fragments/backend/python.md +37 -0
  26. evalrx/agent_assets/skills/nature-figure/static/fragments/backend/r.md +44 -0
  27. evalrx/agent_assets/skills/outcome-driver-analysis/SKILL.md +213 -0
  28. evalrx/agent_assets/skills/outcome-driver-analysis/assets/analysis_report_template.md +53 -0
  29. evalrx/agent_assets/skills/outcome-driver-analysis/references/model_selection.md +72 -0
  30. evalrx/agent_assets/skills/outcome-driver-analysis/scripts/explanatory_var_eda.R +130 -0
  31. evalrx/agent_assets/skills/outcome-driver-analysis/scripts/explanatory_var_eda.py +150 -0
  32. evalrx/agent_assets/skills/outcome-driver-analysis/scripts/fit_outcome_model.R +181 -0
  33. evalrx/agent_assets/skills/outcome-driver-analysis/scripts/fit_outcome_model.py +186 -0
  34. evalrx/agent_assets/skills/outcome-driver-analysis/scripts/univariate_eda.R +149 -0
  35. evalrx/agent_assets/skills/outcome-driver-analysis/scripts/univariate_eda.py +177 -0
  36. evalrx/agent_assets/skills.py +27 -0
  37. evalrx/agent_runtime/__init__.py +78 -0
  38. evalrx/agent_runtime/_docker_runner.py +89 -0
  39. evalrx/agent_runtime/cli_runtime.py +103 -0
  40. evalrx/agent_runtime/cli_transcript.py +138 -0
  41. evalrx/agent_runtime/cli_types.py +68 -0
  42. evalrx/agent_runtime/codegen/__init__.py +5 -0
  43. evalrx/agent_runtime/codegen/runner.py +94 -0
  44. evalrx/agent_runtime/experiment_harness.py +117 -0
  45. evalrx/agent_runtime/factory.py +102 -0
  46. evalrx/agent_runtime/json_shape.py +44 -0
  47. evalrx/agent_runtime/judges/__init__.py +28 -0
  48. evalrx/agent_runtime/judges/agy.py +179 -0
  49. evalrx/agent_runtime/judges/autodetect.py +135 -0
  50. evalrx/agent_runtime/judges/claude.py +159 -0
  51. evalrx/agent_runtime/judges/codex.py +120 -0
  52. evalrx/agent_runtime/providers/__init__.py +21 -0
  53. evalrx/agent_runtime/providers/antigravity.py +31 -0
  54. evalrx/agent_runtime/providers/base.py +145 -0
  55. evalrx/agent_runtime/providers/claude_code.py +49 -0
  56. evalrx/agent_runtime/providers/codex.py +37 -0
  57. evalrx/agent_runtime/providers/gemini_cli.py +26 -0
  58. evalrx/agent_runtime/providers/kimi_cli.py +27 -0
  59. evalrx/agent_runtime/providers/opencode.py +27 -0
  60. evalrx/agent_runtime/providers/registry.py +58 -0
  61. evalrx/agent_runtime/sandbox.py +517 -0
  62. evalrx/agent_runtime/skill_audit.py +143 -0
  63. evalrx/agent_runtime/skills/__init__.py +19 -0
  64. evalrx/agent_runtime/skills/installer.py +68 -0
  65. evalrx/agent_runtime/skills/prompt_policy.py +86 -0
  66. evalrx/agent_runtime/skills/resolver.py +19 -0
  67. evalrx/analysis/__init__.py +132 -0
  68. evalrx/analysis/adjudicate.py +154 -0
  69. evalrx/analysis/analysis_module.py +361 -0
  70. evalrx/analysis/api.py +171 -0
  71. evalrx/analysis/case_studio.py +651 -0
  72. evalrx/analysis/cli.py +114 -0
  73. evalrx/analysis/dashboard.py +350 -0
  74. evalrx/analysis/eval_case_matrix.py +118 -0
  75. evalrx/analysis/eval_viz_theme.py +833 -0
  76. evalrx/analysis/explore_run.py +333 -0
  77. evalrx/analysis/explorer.py +1276 -0
  78. evalrx/analysis/failure_modes.py +607 -0
  79. evalrx/analysis/fused_pipeline.py +489 -0
  80. evalrx/analysis/holdout.py +300 -0
  81. evalrx/analysis/hypothesis_agent.py +230 -0
  82. evalrx/analysis/narration.py +177 -0
  83. evalrx/analysis/operationalize.py +442 -0
  84. evalrx/analysis/plain_language.py +42 -0
  85. evalrx/analysis/planner.py +283 -0
  86. evalrx/analysis/probe_search.py +203 -0
  87. evalrx/analysis/profile.py +268 -0
  88. evalrx/analysis/prompts/__init__.py +0 -0
  89. evalrx/analysis/prompts/explorer.py +417 -0
  90. evalrx/analysis/prompts/failure_modes.py +33 -0
  91. evalrx/analysis/prompts/holdout.py +27 -0
  92. evalrx/analysis/prompts/hypothesis_agent.py +78 -0
  93. evalrx/analysis/prompts/run_codebase.py +47 -0
  94. evalrx/analysis/prompts/stats_agent.py +72 -0
  95. evalrx/analysis/prompts/stats_tool_generator.py +43 -0
  96. evalrx/analysis/result_marker.py +47 -0
  97. evalrx/analysis/run_codebase.py +242 -0
  98. evalrx/analysis/run_view.py +205 -0
  99. evalrx/analysis/stage_views.py +93 -0
  100. evalrx/analysis/stats_agent.py +944 -0
  101. evalrx/analysis/stats_tool_agent.py +261 -0
  102. evalrx/analysis/stats_tool_generator.py +415 -0
  103. evalrx/analysis/stats_tools.py +1153 -0
  104. evalrx/analysis/trajectory_records.py +193 -0
  105. evalrx/analysis/workbench.py +431 -0
  106. evalrx/analyzers/__init__.py +42 -0
  107. evalrx/analyzers/agent/__init__.py +25 -0
  108. evalrx/analyzers/agent/counterfactual.py +84 -0
  109. evalrx/analyzers/agent/first_error_judge.py +96 -0
  110. evalrx/analyzers/agent/ignored_obs.py +81 -0
  111. evalrx/analyzers/agent/loop_detect.py +79 -0
  112. evalrx/analyzers/agent/reliability.py +165 -0
  113. evalrx/analyzers/agent/tool_shap.py +225 -0
  114. evalrx/analyzers/agent/trajectory_rubric.py +168 -0
  115. evalrx/analyzers/attention/__init__.py +19 -0
  116. evalrx/analyzers/attention/relative_attn.py +610 -0
  117. evalrx/analyzers/attention/rollout.py +73 -0
  118. evalrx/analyzers/attention/sink.py +56 -0
  119. evalrx/analyzers/attention/summary.py +190 -0
  120. evalrx/analyzers/attribution/__init__.py +6 -0
  121. evalrx/analyzers/attribution/generic_attn.py +31 -0
  122. evalrx/analyzers/attribution/gradcam.py +30 -0
  123. evalrx/analyzers/base.py +12 -0
  124. evalrx/analyzers/geometry/__init__.py +6 -0
  125. evalrx/analyzers/geometry/cka.py +70 -0
  126. evalrx/analyzers/geometry/linear_probe.py +157 -0
  127. evalrx/analyzers/hallucination/__init__.py +9 -0
  128. evalrx/analyzers/hallucination/chair.py +78 -0
  129. evalrx/analyzers/hallucination/opera.py +29 -0
  130. evalrx/analyzers/hallucination/pope.py +119 -0
  131. evalrx/analyzers/hallucination/selfcheck.py +155 -0
  132. evalrx/analyzers/hallucination/vcd.py +29 -0
  133. evalrx/analyzers/lens/__init__.py +7 -0
  134. evalrx/analyzers/lens/layer_contrast.py +133 -0
  135. evalrx/analyzers/lens/logit_lens.py +138 -0
  136. evalrx/analyzers/lens/tuned_lens.py +30 -0
  137. evalrx/analyzers/patching/__init__.py +5 -0
  138. evalrx/analyzers/patching/causal_trace.py +30 -0
  139. evalrx/analyzers/perturbation/__init__.py +23 -0
  140. evalrx/analyzers/perturbation/_shapley.py +54 -0
  141. evalrx/analyzers/perturbation/context_shap.py +174 -0
  142. evalrx/analyzers/perturbation/cot_faithfulness.py +239 -0
  143. evalrx/analyzers/perturbation/format_sensitivity.py +237 -0
  144. evalrx/analyzers/perturbation/mm_shap.py +146 -0
  145. evalrx/analyzers/perturbation/modality_ablation.py +196 -0
  146. evalrx/analyzers/perturbation/perturbation_battery.py +274 -0
  147. evalrx/analyzers/perturbation/prompt_contrast.py +265 -0
  148. evalrx/analyzers/perturbation/rise.py +94 -0
  149. evalrx/analyzers/perturbation/vl_shap.py +102 -0
  150. evalrx/analyzers/reasoning/__init__.py +33 -0
  151. evalrx/analyzers/reasoning/_text.py +328 -0
  152. evalrx/analyzers/reasoning/answer_extraction_audit.py +327 -0
  153. evalrx/analyzers/reasoning/arith_audit.py +226 -0
  154. evalrx/analyzers/reasoning/contamination.py +214 -0
  155. evalrx/analyzers/reasoning/knowledge_split.py +253 -0
  156. evalrx/analyzers/reasoning/self_repair.py +246 -0
  157. evalrx/analyzers/reasoning/step_rollout_value.py +216 -0
  158. evalrx/analyzers/reasoning/termination_audit.py +258 -0
  159. evalrx/analyzers/uncertainty/__init__.py +18 -0
  160. evalrx/analyzers/uncertainty/calibration.py +174 -0
  161. evalrx/analyzers/uncertainty/coverage_gap.py +199 -0
  162. evalrx/analyzers/uncertainty/entropy.py +90 -0
  163. evalrx/analyzers/uncertainty/logprob_entropy.py +69 -0
  164. evalrx/analyzers/uncertainty/self_consistency.py +204 -0
  165. evalrx/analyzers/uncertainty/verbalized_conf.py +64 -0
  166. evalrx/cli.py +411 -0
  167. evalrx/config.py +77 -0
  168. evalrx/contract/__init__.py +179 -0
  169. evalrx/contract/common.py +452 -0
  170. evalrx/contract/emit.py +948 -0
  171. evalrx/contract/export.py +237 -0
  172. evalrx/contract/m1.py +325 -0
  173. evalrx/contract/m2.py +317 -0
  174. evalrx/contract/m3.py +165 -0
  175. evalrx/contract/m4.py +130 -0
  176. evalrx/contract/m5.py +292 -0
  177. evalrx/contract/methodology.py +76 -0
  178. evalrx/contract/pre_m1.py +58 -0
  179. evalrx/contract/typescript.py +140 -0
  180. evalrx/core/__init__.py +85 -0
  181. evalrx/core/analyzer.py +174 -0
  182. evalrx/core/capability.py +54 -0
  183. evalrx/core/case.py +443 -0
  184. evalrx/core/experiment.py +106 -0
  185. evalrx/core/model.py +198 -0
  186. evalrx/core/pipeline.py +42 -0
  187. evalrx/core/registry.py +142 -0
  188. evalrx/core/result.py +64 -0
  189. evalrx/core/spec.py +173 -0
  190. evalrx/core/tokentype.py +165 -0
  191. evalrx/core/tool.py +92 -0
  192. evalrx/datasets/__init__.py +41 -0
  193. evalrx/datasets/base.py +68 -0
  194. evalrx/datasets/gui_os.py +52 -0
  195. evalrx/datasets/llm_qa.py +57 -0
  196. evalrx/datasets/pure_qa.py +12 -0
  197. evalrx/datasets/vlm_qa.py +695 -0
  198. evalrx/datasets/web_search_qa.py +52 -0
  199. evalrx/eval_agent/__init__.py +341 -0
  200. evalrx/eval_agent/_tools.py +81 -0
  201. evalrx/eval_agent/ab_runner.py +50 -0
  202. evalrx/eval_agent/agentic/__init__.py +43 -0
  203. evalrx/eval_agent/agentic/actions.py +216 -0
  204. evalrx/eval_agent/agentic/board.py +107 -0
  205. evalrx/eval_agent/agentic/loop.py +190 -0
  206. evalrx/eval_agent/agentic/tools.py +538 -0
  207. evalrx/eval_agent/checkpoint.py +57 -0
  208. evalrx/eval_agent/cli_agent.py +59 -0
  209. evalrx/eval_agent/cli_skills.py +5 -0
  210. evalrx/eval_agent/evolution.py +396 -0
  211. evalrx/eval_agent/git_manager.py +215 -0
  212. evalrx/eval_agent/hypothesis.py +172 -0
  213. evalrx/eval_agent/label_quarantine.py +209 -0
  214. evalrx/eval_agent/legacy.py +530 -0
  215. evalrx/eval_agent/log_schema.py +497 -0
  216. evalrx/eval_agent/loop.py +2159 -0
  217. evalrx/eval_agent/loop_reports.py +116 -0
  218. evalrx/eval_agent/model_instrumentation.py +282 -0
  219. evalrx/eval_agent/narration.py +193 -0
  220. evalrx/eval_agent/nl_runner.py +460 -0
  221. evalrx/eval_agent/orchestrator.py +61 -0
  222. evalrx/eval_agent/preregister.py +93 -0
  223. evalrx/eval_agent/prompts/__init__.py +1 -0
  224. evalrx/eval_agent/prompts/agentic.py +46 -0
  225. evalrx/eval_agent/prompts/case_discovery.py +25 -0
  226. evalrx/eval_agent/prompts/diagnosis.py +125 -0
  227. evalrx/eval_agent/prompts/experiment_writer.py +265 -0
  228. evalrx/eval_agent/prompts/explore_step.py +37 -0
  229. evalrx/eval_agent/prompts/fix_agent.py +257 -0
  230. evalrx/eval_agent/prompts/hypothesis_tester.py +15 -0
  231. evalrx/eval_agent/prompts/nl_runner.py +38 -0
  232. evalrx/eval_agent/prompts/probe_agent.py +25 -0
  233. evalrx/eval_agent/prompts/probe_candidate_generator.py +14 -0
  234. evalrx/eval_agent/prompts/probe_generator.py +35 -0
  235. evalrx/eval_agent/prompts/whitebox_probe_generator.py +38 -0
  236. evalrx/eval_agent/report.py +58 -0
  237. evalrx/eval_agent/run_context.py +354 -0
  238. evalrx/eval_agent/run_log.schema.json +1215 -0
  239. evalrx/eval_agent/run_logger_v2.py +1764 -0
  240. evalrx/eval_agent/run_metadata.py +208 -0
  241. evalrx/eval_agent/stages/__init__.py +56 -0
  242. evalrx/eval_agent/stages/case_discovery.py +293 -0
  243. evalrx/eval_agent/stages/diagnosis.py +1017 -0
  244. evalrx/eval_agent/stages/experiment_writer.py +1634 -0
  245. evalrx/eval_agent/stages/fix_agent.py +3916 -0
  246. evalrx/eval_agent/stages/fix_internals.py +499 -0
  247. evalrx/eval_agent/stages/fix_pipeline.py +725 -0
  248. evalrx/eval_agent/stages/fix_tiers.py +187 -0
  249. evalrx/eval_agent/stages/fix_tools.py +1034 -0
  250. evalrx/eval_agent/stages/hypothesis_tester.py +1014 -0
  251. evalrx/eval_agent/stages/probe.py +439 -0
  252. evalrx/eval_agent/stages/probe_agent.py +1079 -0
  253. evalrx/eval_agent/stages/probe_candidate_generator.py +128 -0
  254. evalrx/eval_agent/stages/probe_generator.py +326 -0
  255. evalrx/eval_agent/stages/probe_search_agent.py +106 -0
  256. evalrx/eval_agent/stages/protocol.py +112 -0
  257. evalrx/eval_agent/stages/repair_catalog.py +273 -0
  258. evalrx/eval_agent/stages/surgery.py +524 -0
  259. evalrx/eval_agent/stages/whitebox_probe_generator.py +351 -0
  260. evalrx/eval_agent/store.py +231 -0
  261. evalrx/logging_utils.py +112 -0
  262. evalrx/models/__init__.py +161 -0
  263. evalrx/models/_discover.py +101 -0
  264. evalrx/models/agent.py +380 -0
  265. evalrx/models/backends/__init__.py +58 -0
  266. evalrx/models/backends/api.py +169 -0
  267. evalrx/models/backends/base.py +57 -0
  268. evalrx/models/backends/gemini_compat.py +579 -0
  269. evalrx/models/backends/hf_local.py +2074 -0
  270. evalrx/models/backends/openai_compat.py +301 -0
  271. evalrx/models/backends/vllm_offline.py +116 -0
  272. evalrx/models/base.py +24 -0
  273. evalrx/models/blackbox/__init__.py +4 -0
  274. evalrx/models/blackbox/agent.py +31 -0
  275. evalrx/models/blackbox/base.py +29 -0
  276. evalrx/models/blackbox/gemini.py +279 -0
  277. evalrx/models/blackbox/llm_api.py +17 -0
  278. evalrx/models/blackbox/vlm_api.py +17 -0
  279. evalrx/models/compose.py +66 -0
  280. evalrx/models/inference.py +88 -0
  281. evalrx/models/paper_methods/__init__.py +8 -0
  282. evalrx/models/paper_methods/aad.py +53 -0
  283. evalrx/models/paper_methods/ifcd.py +204 -0
  284. evalrx/models/paper_methods/pai.py +164 -0
  285. evalrx/models/paper_methods/tcd.py +202 -0
  286. evalrx/models/paper_methods/vcd.py +45 -0
  287. evalrx/models/paper_methods/vicrop.py +137 -0
  288. evalrx/models/toolcodec.py +143 -0
  289. evalrx/models/tools/__init__.py +20 -0
  290. evalrx/models/tools/perception.py +300 -0
  291. evalrx/models/tools/visual.py +174 -0
  292. evalrx/models/whitebox/__init__.py +26 -0
  293. evalrx/models/whitebox/agent.py +31 -0
  294. evalrx/models/whitebox/base.py +24 -0
  295. evalrx/models/whitebox/qwen.py +61 -0
  296. evalrx/models/whitebox/qwen2_5_omni.py +29 -0
  297. evalrx/models/whitebox/qwen2_audio.py +25 -0
  298. evalrx/models/whitebox/qwen_omni.py +53 -0
  299. evalrx/models/whitebox/qwen_vl.py +62 -0
  300. evalrx/observability/__init__.py +21 -0
  301. evalrx/observability/envelope.py +122 -0
  302. evalrx/observability/outbox.py +111 -0
  303. evalrx/observability/tracer.py +882 -0
  304. evalrx/reporting/__init__.py +28 -0
  305. evalrx/reporting/case_study.py +947 -0
  306. evalrx/reporting/compiler.py +587 -0
  307. evalrx/reporting/dynamic.py +1882 -0
  308. evalrx/reporting/html_report.py +2225 -0
  309. evalrx/reporting/langfuse_exporter.py +38 -0
  310. evalrx/reporting/langfuse_source.py +155 -0
  311. evalrx/reporting/model.py +151 -0
  312. evalrx/reporting/run_events.py +184 -0
  313. evalrx/reporting/server.py +557 -0
  314. evalrx/reporting/stages.py +58 -0
  315. evalrx/reporting/static_export.py +142 -0
  316. evalrx/reporting/web_dist/index.html +146 -0
  317. evalrx/specs.py +727 -0
  318. evalrx/stats/__init__.py +47 -0
  319. evalrx/stats/api.py +192 -0
  320. evalrx/stats/bootstrap.py +86 -0
  321. evalrx/stats/ebh.py +27 -0
  322. evalrx/stats/evalue.py +98 -0
  323. evalrx/stats/friedman.py +138 -0
  324. evalrx/stats/mcnemar.py +40 -0
  325. evalrx/stats/multiplicity.py +159 -0
  326. evalrx/stats/subset_sampling.py +55 -0
  327. evalrx/term_links.py +43 -0
  328. evalrx/viz/__init__.py +7 -0
  329. evalrx/viz/labels.py +77 -0
  330. evalrx/viz/prompts.py +39 -0
  331. evalrx/viz/renderer.py +590 -0
  332. evalrx/viz/schema.py +36 -0
  333. evalrx/viz/style.py +134 -0
  334. evalrx-0.1.2.dist-info/METADATA +532 -0
  335. evalrx-0.1.2.dist-info/RECORD +339 -0
  336. evalrx-0.1.2.dist-info/WHEEL +5 -0
  337. evalrx-0.1.2.dist-info/entry_points.txt +3 -0
  338. evalrx-0.1.2.dist-info/licenses/LICENSE +121 -0
  339. evalrx-0.1.2.dist-info/top_level.txt +1 -0
@@ -0,0 +1,112 @@
1
+ # 2026 Nature Sample Observations
2
+
3
+ This note captures page-level figure patterns observed from a local 2026 sample of `Nature`
4
+ papers, plus one `Nature Biomedical Engineering` paper used as a clinical / ML-adjacent
5
+ cross-check.
6
+
7
+ Sampled figure sources:
8
+
9
+ - `s41586-026-10408-8` — wide schematic-led materials figure with supporting quant panels
10
+ - `s41586-026-10426-6` — dark whole-brain image plate with repeated views
11
+ - `s41586-026-10393-y` — clinical triptych: longitudinal lines, forest plots, summary bars
12
+ - `s41586-026-10257-5` — dense categorical stacked-area panels with direct labels
13
+ - `s41586-026-10439-1` — asymmetric genomics figure with one dominant circular panel
14
+ - `Expert-level detection of pathologies...` — compact medical / ML figure conventions
15
+
16
+ ## Archetype 1: Schematic-led composite
17
+
18
+ Seen in the printable meta-assemblies paper.
19
+
20
+ Actionable rules:
21
+
22
+ - Let the schematic occupy roughly `45–60%` of figure height.
23
+ - Use the **same physical/material palette** in the supporting plots; do not switch to generic method colors below the schematic.
24
+ - Zoom callouts should use one repeated accent style across the figure, for example a single dashed red outline family.
25
+ - Reserve at least one supporting panel for a real-world photograph or experimental snapshot when the story needs scale validation.
26
+ - Supporting quantitative panels should be smaller, cleaner and less saturated than the schematic so the eye reads the page in the intended order.
27
+
28
+ ## Archetype 2: Dark image plate
29
+
30
+ Seen in the astrocyte brain-network figure.
31
+
32
+ Actionable rules:
33
+
34
+ - Use a black facecolor only for the image plate region, not for the whole page.
35
+ - Pair grayscale context with one or two fluorescent channels; the sample repeatedly used cyan and magenta.
36
+ - Keep crops, scale bars and view boxes geometrically consistent across rows and columns.
37
+ - Use white gutters and white scale bars so the plate stays legible after print/export compression.
38
+ - Put row labels and channel labels directly on the image plate; avoid detached legends.
39
+
40
+ Recommended accent set for this modality:
41
+
42
+ ```python
43
+ CYAN = "#22D7E6"
44
+ MAGENTA = "#FF2AD4"
45
+ GREY_CONTEXT = "#B8B8B8"
46
+ ```
47
+
48
+ ## Archetype 3: Clinical triptych
49
+
50
+ Seen in the OTOF gene-therapy paper.
51
+
52
+ Actionable rules:
53
+
54
+ - Top row: line plots or longitudinal summaries, usually sharing one legend strip above the row.
55
+ - Middle row: forest-plot style effects with a dashed vertical reference line and light category bands.
56
+ - Bottom row: compact summary bars, often binary or stacked-percentage bars.
57
+ - Keep columns semantically parallel. If the first column is `ABR`, the next columns should reuse the same row logic rather than introducing a new layout.
58
+ - Baseline / reference series can be black or dark grey; follow-up or intervention groups can use a restrained warm/cool sequence.
59
+
60
+ Recommended design signal:
61
+
62
+ - Legends belong outside the data region when there are many timepoints.
63
+ - Group bands in forest plots should be pale and subordinate, never more salient than the confidence intervals.
64
+
65
+ ## Archetype 4: Dense categorical physical-science panel
66
+
67
+ Seen in the condensation-sequence figure.
68
+
69
+ Actionable rules:
70
+
71
+ - Direct-label regions when the plot has many semantically intrinsic categories.
72
+ - Use hatching or texture overlays when neighboring fills are close in luminance or may print poorly.
73
+ - Reuse the exact same axis limits and panel geometry across the full grid.
74
+ - Prefer embedded labels over a detached mega-legend when each panel repeats the same categorical structure.
75
+
76
+ ## Archetype 5: Asymmetric mixed-modality figure
77
+
78
+ Seen in the rediploidization genomics figure.
79
+
80
+ Actionable rules:
81
+
82
+ - Do not force equal panel sizes. Let the biologically central panel dominate.
83
+ - Use small supporting plots around the hero panel to answer narrower questions.
84
+ - Keep a tight, reused color mapping across all modalities, for example `wave 1 / wave 2 / wave 3` or `baseline / highlight / neutral`.
85
+ - Use whitespace and alignment, not decorative frames, to signal grouping.
86
+
87
+ ## Cross-cutting Nature rules from the sample
88
+
89
+ - Panel labels are small bold lowercase letters near the top-left corner, not large badges.
90
+ - Figure pages are narrative, not dashboard-like. A dominant panel is normal.
91
+ - Legends are often omitted if direct labeling is possible.
92
+ - Background discipline matters more than ornament. White for charts, black only for image plates.
93
+ - Saturated colors are used sparingly and usually mean either a true experimental channel or a highlighted subgroup.
94
+ - When several modalities coexist, keep axis-heavy plots visually quieter than schematics or imaging panels.
95
+ - Gutters are slightly larger when dark panels touch light panels or when modalities change.
96
+
97
+ ## Palette guidance by modality
98
+
99
+ - Materials / mechanism pages:
100
+ `aqua`, `teal`, `lilac`, `soft violet`, with one red accent for callouts only.
101
+ - Imaging plates:
102
+ `black` + `grey context` + `cyan` + `magenta`.
103
+ - Clinical quantitative figures:
104
+ `black baseline`, then restrained warm/cool follow-up hues, with pale group shading.
105
+ - Genomics / systems figures:
106
+ `neutral greys` plus one `red family` and one `blue family` for highlighted biological states.
107
+
108
+ ## What not to copy blindly
109
+
110
+ - Do not import a bright multi-hue palette just because one sampled physical-science figure used many fills. That only works when the categories are intrinsic phases/materials and directly labeled.
111
+ - Do not place all Nature figures on black backgrounds; that was specific to the imaging plate archetype.
112
+ - Do not force a legend into every panel. Many sampled figures read better with direct labels or one shared legend strip.
@@ -0,0 +1,119 @@
1
+ # QA Contract
2
+
3
+ Use this before final delivery, before a revision package, and whenever the figure
4
+ contains microscopy, blots, gels, clinical subgroup analysis, or statistical claims.
5
+ Journal rules change, so verify the latest target journal author guide for final
6
+ submission. The values below are conservative defaults for Nature-family style work.
7
+
8
+ ## Current official references to verify
9
+
10
+ - Nature research figure guide: `https://research-figure-guide.nature.com/`
11
+ - Nature building/exporting panels: `https://research-figure-guide.nature.com/figures/building-and-exporting-figure-panels/`
12
+ - Nature preparing figures/specifications: `https://research-figure-guide.nature.com/figures/preparing-figures-our-specifications/`
13
+ - Nature initial submission and statistics guidance: `https://www.nature.com/nature/for-authors/initial-submission`
14
+ - Nature formatting guide: `https://www.nature.com/nature/for-authors/formatting-guide`
15
+ - Journal of Cell Biology figure/video guidelines for microscopy-oriented image QA: `https://rupress.org/jcb/pages/fig-vid-guidelines`
16
+ - Elsevier/Cell-family image-manipulation baseline: `https://www.sciencedirect.com/journal/the-cell-surface/publish/guide-for-authors`
17
+
18
+ ## Pre-submission checklist
19
+
20
+ | Check | Pass condition |
21
+ |---|---|
22
+ | Core conclusion | One-sentence claim exists and every panel maps to it |
23
+ | Archetype | Figure has a declared archetype and panel hierarchy |
24
+ | Backend exclusivity | The selected backend produced all plotting, previews, exports, and visual QA renders |
25
+ | Final size | Single-column about 89 mm or double-column about 183 mm, height not above target journal limit |
26
+ | Text size | Body/tick/legend text is readable at final size, usually 5-7 pt for dense journal figures |
27
+ | Panel labels | Lowercase, bold, near top-left, typically 8 pt at final size |
28
+ | Editable text | SVG/PDF text remains editable; no outlined text unless unavoidable for special symbols |
29
+ | Font | Arial/Helvetica/sans-serif fallback is used consistently |
30
+ | Color | No rainbow color maps; red/green is not the only encoding; grayscale print remains interpretable |
31
+ | Legend strategy | Shared or direct labels where possible; no repeated redundant legends |
32
+ | Statistics | `n`, biological/technical repeat definition, center, spread, test, correction, and exact comparison are documented |
33
+ | Source data | Quantitative panels can be traced to a clean CSV/TSV/XLSX or script output |
34
+ | Raster resolution | Photos/microscopy are high-resolution enough for final size; line art uses vector where possible |
35
+ | Microscopy scale | Scale bar is present, calibrated, and not only a magnification factor |
36
+ | Image integrity | Crop, contrast, pseudo-color, stitching, reuse, and raw-file provenance are recorded |
37
+ | Export bundle | Script, source data, SVG, PDF, TIFF/PNG preview, and QA notes are delivered together when requested |
38
+
39
+ ## Statistics legend minimum
40
+
41
+ For each quantitative panel, capture:
42
+
43
+ ```text
44
+ n definition:
45
+ biological replicates:
46
+ technical replicates:
47
+ center statistic:
48
+ spread/interval:
49
+ test:
50
+ multiple-comparison correction:
51
+ p-value display:
52
+ source-data file:
53
+ ```
54
+
55
+ For machine-learning/model figures, also capture:
56
+
57
+ ```text
58
+ train/validation/test split:
59
+ number of seeds or folds:
60
+ metric definition:
61
+ confidence interval or variability definition:
62
+ baseline definition:
63
+ ```
64
+
65
+ ## Image-integrity minimum
66
+
67
+ For each image panel, capture:
68
+
69
+ ```text
70
+ raw file:
71
+ processed file:
72
+ crop:
73
+ brightness/contrast/gamma:
74
+ pseudo-color:
75
+ scale calibration:
76
+ stitching:
77
+ reuse in other figures:
78
+ quantification link:
79
+ ```
80
+
81
+ Global adjustments are generally safer than local selective edits. If an adjustment
82
+ changes the visibility of relevant background or bands, flag it instead of silently
83
+ normalizing it away.
84
+
85
+ ## Export checks
86
+
87
+ Run only the export block for the selected backend. If that backend is unavailable,
88
+ stop and report the missing runtime/package instead of producing a substitute export
89
+ with the other language.
90
+
91
+ ### Python
92
+
93
+ ```python
94
+ import matplotlib as mpl
95
+ mpl.rcParams["svg.fonttype"] = "none"
96
+ mpl.rcParams["pdf.fonttype"] = 42
97
+ fig.savefig("figure.svg", bbox_inches="tight")
98
+ fig.savefig("figure.pdf", bbox_inches="tight")
99
+ fig.savefig("figure.tiff", dpi=600, bbox_inches="tight")
100
+ ```
101
+
102
+ ### R
103
+
104
+ ```r
105
+ svglite::svglite("figure.svg", width = width_mm / 25.4, height = height_mm / 25.4)
106
+ print(plot)
107
+ dev.off()
108
+
109
+ grDevices::cairo_pdf("figure.pdf", width = width_mm / 25.4, height = height_mm / 25.4, family = "Arial")
110
+ print(plot)
111
+ dev.off()
112
+
113
+ ragg::agg_tiff("figure.tiff", width = width_mm / 25.4, height = height_mm / 25.4, units = "in", res = 600)
114
+ print(plot)
115
+ dev.off()
116
+ ```
117
+
118
+ Open the SVG/PDF after export and verify that text can be selected, labels do not
119
+ overlap, and the figure still reads at final printed size.
@@ -0,0 +1,66 @@
1
+ # Private R Template Adaptation
2
+
3
+ Use this reference when the user chooses R and provides or mentions an existing
4
+ R plotting template collection. Treat such material as private working context.
5
+ Do not reveal absolute paths, folder names, filenames, screenshots, provenance, or
6
+ any identifying labels from the source collection in user-facing output.
7
+
8
+ ## Privacy rules
9
+
10
+ - Never include absolute local paths in generated code, reports, comments, or final replies.
11
+ - Never mention the original source file, folder, template number, course title, download
12
+ location, chat attachment, or private document name.
13
+ - When a template is useful, describe it generically by chart family: "a grouped bar
14
+ template", "a ComplexHeatmap workflow", "a survival plotting workflow".
15
+ - If a reusable idea is copied from a private template, rewrite the final code as a clean,
16
+ self-contained script with neutral function names and neutral comments.
17
+ - If the user asks where a style came from, say it was adapted from the provided working
18
+ materials without identifying the path or source file.
19
+
20
+ ## Generic search strategy
21
+
22
+ Search private materials by chart family and package names, not by exposing paths:
23
+
24
+ ```bash
25
+ find <private-template-root> -type f \( -name '*.R' -o -name '*.Rmd' -o -name '*.r' \)
26
+ rg -n "ggplot|patchwork|ComplexHeatmap|ggrepel|svglite|cairo_pdf|survminer|circlize" <private-template-root>
27
+ ```
28
+
29
+ Keep these commands in internal working notes only. Do not paste the user's private
30
+ root path into the final answer.
31
+
32
+ ## Chart-family map
33
+
34
+ Use these generic families to decide what to inspect:
35
+
36
+ | Need | Search targets |
37
+ |---|---|
38
+ | Bars and grouped comparisons | `geom_col`, `geom_bar`, `position_dodge`, `stat_compare_means` |
39
+ | Error bars and point-interval plots | `geom_errorbar`, `geom_pointrange`, `mean_se`, `stat_summary` |
40
+ | Stacked or bidirectional bars | `position_stack`, `coord_flip`, signed values, paired positive/negative bars |
41
+ | Box, violin, paired, and raincloud-style distributions | `geom_boxplot`, `geom_violin`, `geom_jitter`, paired sample identifiers |
42
+ | Heatmaps and annotated heatmaps | `ComplexHeatmap`, `HeatmapAnnotation`, `pheatmap`, `geom_tile` |
43
+ | Correlation, scatter, bubble, and volcano plots | `geom_point`, `geom_smooth`, `ggrepel`, `logFC`, `pvalue`, bubble size scales |
44
+ | PCA, PCoA, NMDS, tSNE, UMAP | `prcomp`, `cmdscale`, `vegan`, `Rtsne`, `Seurat`, embedding coordinates |
45
+ | Survival, Cox, subgroup, ROC, forest | `survival`, `survminer`, `coxph`, `forestplot`, `timeROC`, hazard ratios |
46
+ | Enrichment and pathway summaries | `clusterProfiler`, `GSEA`, `enrichGO`, `enrichKEGG`, dot plots, ridge plots |
47
+ | Circular, genome, phylogeny, chromosome | `circlize`, `ggtree`, `karyoploteR`, genome interval tracks |
48
+ | Single-cell and omics workflows | `Seurat`, marker genes, differential expression, cell-type annotation |
49
+ | Maps, anatomy, and spatial summaries | `sf`, `maps`, `gganatogram`, spatial coordinates |
50
+ | Radar, lollipop, dumbbell, UpSet, Venn, Sankey | `ggradar`, `geom_segment`, `UpSetR`, `ggalluvial`, set operations |
51
+
52
+ ## Adaptation checklist
53
+
54
+ When adapting a private template:
55
+
56
+ - Keep useful data wrangling, statistics, and geoms.
57
+ - Replace template-specific colors with the figure-level semantic palette.
58
+ - Normalize fonts to final-size 5-7 pt text and 8 pt bold lowercase panel labels.
59
+ - Convert single-output PNG/PDF scripts to SVG/PDF/TIFF export.
60
+ - Remove decorative elements that do not support the core conclusion.
61
+ - Ensure each statistical comparison has `n`, center, spread, test, and correction
62
+ information in the legend or source-data notes.
63
+ - For image panels, document raw file, crop, contrast, scale-bar calibration, and any
64
+ stitching or pseudo-coloring in private QA notes.
65
+ - Final code should be self-contained and should not require the original private
66
+ folder structure unless the user explicitly asks to keep that workflow.
@@ -0,0 +1,161 @@
1
+ # R Workflow
2
+
3
+ Use this when the user chooses R, brings R data/scripts, or asks to reuse the local
4
+ R plotting templates. The R track should still follow the same figure contract:
5
+ claim first, evidence hierarchy second, plotting code third.
6
+
7
+ ## R-only execution rule
8
+
9
+ When the user has selected R, do all figure drawing, previewing, exporting, and
10
+ visual QA in R. Do not call Python/matplotlib/seaborn/plotly to create a temporary
11
+ preview, fallback export, or layout approximation. If R, `Rscript`, or required R
12
+ packages are missing, stop before rendering and report the missing dependency. You
13
+ may still write the R script, provide `install.packages()` commands, or ask permission
14
+ to install dependencies, but do not cross-render the figure in another language.
15
+
16
+ Allowed non-R utilities are limited to non-visual tasks such as shell file inspection,
17
+ CSV line counts, checksums, archive extraction, or text search. They must not create
18
+ image/vector outputs or alter visual layout.
19
+
20
+ ## Required packages by task
21
+
22
+ | Task | Preferred packages |
23
+ |---|---|
24
+ | Bars, boxplots, violins, dot plots, lines, volcano plots | `ggplot2`, `ggrepel`, `dplyr`, `tidyr` |
25
+ | Multi-panel assembly | `patchwork`; use `cowplot` only when inset alignment requires it |
26
+ | Rich omics heatmaps | `ComplexHeatmap`, `circlize`, `grid` |
27
+ | Survival and clinical subgroup plots | `survival`, `survminer`, `forestplot`, `ggplot2` |
28
+ | Circular/genome plots | `circlize`, `ggtree`, `gggenes`, domain-specific packages |
29
+ | Export | `svglite`, `grDevices::cairo_pdf`, `ragg` |
30
+
31
+ ## Contract scaffold
32
+
33
+ ```r
34
+ library(ggplot2)
35
+ library(patchwork)
36
+
37
+ palette_contract <- c(
38
+ neutral_dark = "#272727",
39
+ neutral_mid = "#767676",
40
+ neutral_light = "#D8D8D8",
41
+ signal_blue = "#3182BD",
42
+ signal_teal = "#33B5A5",
43
+ accent_red = "#D24B40",
44
+ accent_orange = "#E28E2C"
45
+ )
46
+
47
+ theme_nature_contract <- function(base_size = 6.5, base_family = "Arial") {
48
+ theme_classic(base_size = base_size, base_family = base_family) +
49
+ theme(
50
+ axis.line = element_line(linewidth = 0.35, colour = "black"),
51
+ axis.ticks = element_line(linewidth = 0.35, colour = "black"),
52
+ axis.title = element_text(size = base_size),
53
+ axis.text = element_text(size = base_size - 0.5),
54
+ legend.title = element_text(size = base_size - 0.3),
55
+ legend.text = element_text(size = base_size - 0.7),
56
+ strip.text = element_text(size = base_size - 0.3, face = "bold"),
57
+ plot.title = element_text(size = base_size + 0.5, face = "bold"),
58
+ panel.grid = element_blank()
59
+ )
60
+ }
61
+
62
+ theme_set(theme_nature_contract())
63
+
64
+ save_pub_r <- function(plot, filename, width_mm = 183, height_mm = 120, dpi = 600) {
65
+ w <- width_mm / 25.4
66
+ h <- height_mm / 25.4
67
+
68
+ svglite::svglite(paste0(filename, ".svg"), width = w, height = h)
69
+ print(plot)
70
+ dev.off()
71
+
72
+ grDevices::cairo_pdf(paste0(filename, ".pdf"), width = w, height = h, family = "Arial")
73
+ print(plot)
74
+ dev.off()
75
+
76
+ ragg::agg_tiff(paste0(filename, ".tiff"), width = w, height = h, units = "in", res = dpi)
77
+ print(plot)
78
+ dev.off()
79
+ }
80
+ ```
81
+
82
+ ## Panel labels in R
83
+
84
+ Use patchwork tags for most multi-panel figures:
85
+
86
+ ```r
87
+ fig <- (p_a | p_b) / (p_c | p_d) +
88
+ plot_annotation(tag_levels = "a") &
89
+ theme(plot.tag = element_text(size = 8, face = "bold"))
90
+ ```
91
+
92
+ Use manual labels only when dark image plates or inset geometry make patchwork tags
93
+ misalign.
94
+
95
+ ## Patchwork layout patterns
96
+
97
+ ### Quantitative grid
98
+
99
+ ```r
100
+ fig <- (p_a | p_b | guide_area()) /
101
+ (p_c | p_d | p_e) +
102
+ plot_layout(guides = "collect", widths = c(1, 1, 0.45)) &
103
+ theme(legend.position = "right")
104
+ ```
105
+
106
+ ### Schematic-led composite
107
+
108
+ ```r
109
+ design <- "
110
+ AAAA
111
+ BBCD
112
+ "
113
+ fig <- p_schematic + p_b + p_c + p_d +
114
+ plot_layout(design = design, heights = c(1.8, 1))
115
+ ```
116
+
117
+ ### Image plate plus quant
118
+
119
+ Keep black backgrounds inside image panels only. Put scale bars on the image, then
120
+ place quantification next to or below the representative image.
121
+
122
+ ```r
123
+ p_img <- ggplot(img_df, aes(x, y, fill = intensity)) +
124
+ geom_raster() +
125
+ scale_fill_gradient(low = "black", high = "white") +
126
+ coord_fixed(expand = FALSE) +
127
+ annotate("segment", x = 10, xend = 40, y = 10, yend = 10,
128
+ linewidth = 0.6, colour = "white") +
129
+ theme_void() +
130
+ theme(legend.position = "none", plot.background = element_rect(fill = "black", colour = NA))
131
+ ```
132
+
133
+ ## ComplexHeatmap export
134
+
135
+ `ComplexHeatmap` objects are grid objects, not ggplot objects. Export them by opening
136
+ the graphics device, drawing, then closing it.
137
+
138
+ ```r
139
+ library(ComplexHeatmap)
140
+ library(circlize)
141
+
142
+ pdf("heatmap.pdf", width = 7.2, height = 4.8, family = "Arial")
143
+ draw(ht, heatmap_legend_side = "right", annotation_legend_side = "right")
144
+ dev.off()
145
+
146
+ svglite::svglite("heatmap.svg", width = 7.2, height = 4.8)
147
+ draw(ht, heatmap_legend_side = "right", annotation_legend_side = "right")
148
+ dev.off()
149
+ ```
150
+
151
+ ## Template reuse rule
152
+
153
+ The local R materials are examples, not final style. When reusing them:
154
+
155
+ 1. Inspect only the nearest template folder.
156
+ 2. Keep useful data wrangling, statistics, and geoms.
157
+ 3. Replace ad hoc colors, oversized fonts, dense legends, and PNG-only export.
158
+ 4. Rebuild the final script around `theme_nature_contract()` and `save_pub_r()`.
159
+ 5. Add source-data output if the figure is manuscript-facing.
160
+
161
+ Open `references/r-template-index.md` for the local template atlas.