dsh-molbio-tools 0.27.1 → 0.28.1

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.
package/CHANGELOG.md CHANGED
@@ -10,6 +10,145 @@
10
10
  改为按**包名**引用后模块缓存问题随之消失——没有拷贝,也就没有需要保持同步的版本目录。
11
11
  下文历史条目里出现的 `vN` 目录保持原样,作为当时的记录。
12
12
 
13
+ ## [0.28.1] — 2026-12-01(提示面受测化 + 文件输入收敛 + 判分口径修正)
14
+
15
+ **工具数 72 不变,benchmark 73 题不变。** 这一版全部是 0.28.0 之后的提示词与工具接口修复:`prompt` 面
16
+ 第一次成为受测产物,四个工具补齐了文件输入/输出边界,三处 benchmark 判分口径被修正。没有新增工具,
17
+ `engines`、preset 行清单与面板包均未改。
18
+
19
+ ### 1. 提示面(prompt)受测化
20
+
21
+ - **`PROMPT_SECTION` 重写**:按问题路由(72 个工具全覆盖)+ 8 条硬规则 + 5 条约定;删掉 `(v19)`/`(v28)`
22
+ 之类版本标记与重复段落;11,185 → 5,813 字符(预算 6,000),最长行 1,408 → 364 字符。
23
+ - **新增 `test/prompt.mjs`**:段落预算 / 单行宽度 / 无版本标记 / 工具覆盖(双向)/ 与工具描述 ≥60 字符
24
+ 逐字去重,五个不变量 + 五个突变实验(规则 9:守卫必须被证明会失败),已并入 `npm test`。
25
+ - **描述去重与行为指引**:跨描述 ≥70 字符逐字重合 11 对 → 0 对;同时补进"一次调用拿全"、"报数而不只是
26
+ 报路径"、"不要用 translate/脚本复核工具已算过的结果"等指引。
27
+
28
+ ### 2. 工具接口修复(来自 4 轮全量 benchmark 的逐题会话复盘)
29
+
30
+ - **`molbio_parse_genbank` 新增 `path`**:此前只收内联文本,逼模型读文件再重打,实测产生 3163 bp 的转录错误
31
+ 并丢失 `complement()`;现在与 `molbio_parse_snapgene` 一样直接吃文件。
32
+ - **`molbio_align` 新增 `path1`/`path2`**,并识别 FASTA / GenBank(`LOCUS`)/ SnapGene `.dna`:两条长序列的
33
+ 一致性比对从「extract_region ×4 + pwsh 比字符串」收敛为一次调用。
34
+ - **`molbio_editing_outcome` 的 `paths` 支持多记录 FASTA**:此前会把整份 `reads.fa` 当成单条 trace 拒绝
35
+ (`a trace is a single read`)。
36
+ - **`molbio_pcr_simulate`** 对 5' 克隆尾给出明确诊断(整条引物匹配、尾不退火),描述同步;克隆引物设计后
37
+ 的"验证"不再显示成假的 `no product`。
38
+ - **`molbio_verify_sanger`**:trace 长于参考直接拒绝;比对窗小于参考全长时输出 **PARTIAL** 说明;等长时
39
+ 提示改用 `molbio_align`(此前 1221/3162 bp 的局部窗口会报 `verdict: match`)。
40
+ - **`molbio_conservation`** 超 3000 bp 的错误信息指向 `molbio_align`。
41
+ - **`molbio_enzyme_lookup` 新增 `only_cutting`**。
42
+ - **`molbio_restriction_sites`**:`enzymes: ["common"]` 默认只列真正切开的酶(`only_cutting: false` 可看全表),
43
+ 103 个酶的刷屏消失;`test/smoke.mjs` 的契约断言同步覆盖两种模式。
44
+ - **`molbio_clone_primers`** 渲染明确反向引物的"3' 结合段以订购方向给出",避免把模板互补序列当引物。
45
+
46
+ ### 3. benchmark 与判分口径
47
+
48
+ - **`editing-outcome` 改用 `reads.fa` fixture**:高重复的 96-mer 不再内联在指令里(序列上移到
49
+ `benchmark/sequences.mjs` 单一来源),从结构上消除转录误差。
50
+ - **`taqman-assay` 不再钉死 #1 探针**:该探针只有 +0.44 °C 余量,与题面"probe 至少高出几度"自相矛盾;
51
+ 模型改推一个真正达标的 assay 是正确行为。
52
+ - **`methylation-block` / `fastq-trim`** 的判分正则接受等价表述(`usable`、表格形式的 "Reads 4 → 3")。
53
+ - **`benchmark/profile.mjs` 修复**:`yaml.dump`/`schema` 未定义导致 profile 生成直接崩溃;`loaderYaml` 现在
54
+ 同时提供 `dump`(js-yaml + Include 的 `entryListSchema`,能往返 `!!js`)。
55
+
56
+ ### 4. 实测(单模型单日,样本不是保证)
57
+
58
+ - 全量 73 题:**工具调用 257 → 217(重复调用 67 → 35)**,12.50M → 11.66M token;
59
+ `genbank-parse` 14 次/93.9s → **3 次/14.4s**,`clone-primers` 6 → 3 次,`intron-qpcr` 71 → 19s,
60
+ `multiplex-panel` 23 → 6 次,`codon-optimize` 16 → 4 次,`editing-outcome` 83 → 34s。
61
+ - 保留一处真实模型失败:`restraint-simple-math`(10 µL × 50 mM / 500 µL 被模型算成 0.5 mM,正确是 1 mM)——
62
+ 这是模型口算错误,不用提示词修饰。
63
+
64
+ ### 5. 文档
65
+
66
+ - `docs/rules.md` 新增规则 10:提示面(段落 + 工具描述)是受测产物,有预算、覆盖与去重三条不变量。
67
+ - 根包 `0.28.0 → 0.28.1`;面板包保持 `0.1.17`。
68
+
69
+ ---
70
+ ## [0.28.0] — 2026-11-26(蛋白注释 + 格式互操作 + 测序判读:survey #13/#14/#21/#10/#27/#31)
71
+
72
+ **工具数 65 → 72,benchmark 66 → 73 题(72/72 覆盖)。** 这一版把三条候选线一次做完:蛋白注释、
73
+ 注释格式与序列编辑、Sanger 读段判读。上游没有可跟的版本(`0.2.3-alpha.2` 仍是 npm `alpha` 的最新,
74
+ `latest`/`next` 仍是 `0.2.2-rc.5`),所以这一版全部是工具行为,`dshReleases` / `engines` / preset 行清单
75
+ 都没有改。
76
+
77
+ ### 1. 蛋白注释(#13 / #21 / #14)
78
+
79
+ - **`molbio_protein_features`**(#13):PTM 基序扫描(N-糖基化 N-{P}-[S/T]、C-甘露糖基化 W-x-x-W、
80
+ N-端肉豆蔻酰化、SUMO 化 ψKxE、PKA R-R-x-[S/T]、CK2 [S/T]-x-x-[D/E]、脯氨酸导向 [S/T]-P)、
81
+ SEG 风格的熵窗口低复杂度区、芳香性与 Guruprasad 不稳定指数(>40 报 `unstable`)。
82
+ - **`molbio_signal_peptide`**(#21):von Heijne 1986 的 −13..+2 位置权重(真核 / 革兰阴性两套,
83
+ 与 EMBOSS sigcleave 的 `log(count/expected)` 构造一致),给出最佳切割位点、信号肽、候选切割位点,
84
+ 以及**与 `molbio_hydropathy_plot` 同一窗口/阈值**的候选跨膜段;附一张分数曲线 SVG。
85
+ 只扫描 N 端前 50 个残基(`max_cleavage` 可调),避免把中段偶然高分读成信号肽。
86
+ - **`molbio_antigenicity`**(#14):Kolaskar–Tongaonkar 1990 的 7-mer A(p) 倾向,按“全蛋白均值 / 1.0”
87
+ 选位点、连续 ≥6 个残基成区;同时报 Parker 亲水性、Emini 可及性与 Vihinen 柔性的**区间均值**,
88
+ 不合成单一分数。
89
+ - **表格来源与验证**:DIWV(20×20)、Parker/Emini/Vihinen(各 20)转录自 Biopython 1.88
90
+ `ProtParamData.py`(BSD-3,Guruprasad 1990 的参考实现);A(p) 与两套信号肽计数转录自
91
+ EMBOSS 6.6.0 的 `data/Eantigenic.dat`、`data/Esig.euk`、`data/Esig.pro`。所有值都在源码注释里
92
+ 注明出处,测试用可手算的已知值钉住(`AAAA` 的不稳定指数 7.5、20×A 的 A(p) 区间 4-17、
93
+ 胰岛素原信号肽切割位点 24、绿色荧光蛋白片段不报信号肽)。
94
+
95
+ ### 2. 注释格式与序列编辑(#10)
96
+
97
+ - **`molbio_feature_export`**:把 `.dna`/`.gb` 或内联序列 + features 导出为 **GFF3(1-based inclusive)**、
98
+ **BED(0-based half-open)**或 CSV,并在输出里写明用的是哪套坐标;`location` 原样保留,
99
+ 多段特征按外边界导出并给出提示。**CDS phase 不计算**(没有建模转录本阅读框),列写 `.`,
100
+ 而不是猜一个看起来合理的数。写文件仍走 `ctx.fs` + `sandboxPolicy`。
101
+ - **`molbio_sequence_edit`**:rotate / insert / delete / replace / split / join(可带精确 overlap 校验)。
102
+ 坐标统一 1-based inclusive;`insert.position` / `split.position` 是“保留在前面的碱基数”。
103
+ **不重映射特征坐标**,输出里明确提示:编辑移动了注释就要重新导出。
104
+
105
+ ### 3. Sanger 读段判读(#27 / #31)
106
+
107
+ - **`molbio_sanger_assemble`**(#27):1–24 条 `.ab1`/`.seq`/`.fasta` 或内联 reads 的贪心 overlap-layout
108
+ 组装;每条读两种朝向都试,按“overlap − 2×mismatch”选最优;Phred 末端修剪;每次放置后用
109
+ **质量加权共识**重建 contig;报每条读的位置/朝向/overlap、覆盖度、冲突与未放置读;
110
+ 可选精确 end-overlap 环化。文本写明它不是基因组组装器,也不合并 paired-end。
111
+ - **`molbio_editing_outcome`**(#31):每条读两向比对参考(环状参考按加倍处理),按**精确变异签名**
112
+ 聚类成等位基因,报频率与 CDS 内的蛋白效应(wild_type / silent / missense / nonsense / frameshift /
113
+ in_frame_indel / outside_cds)。频率是**已比对 reads 的比例**,不是 TIDE 的峰分解。
114
+ **两条边界**:identity 之外还要求至少比对到读长的一半(最少 20 bp),否则一段偶然的短局部匹配
115
+ 会被误收成等位基因;indel 的移码判定用**净长度变化**,所以被比对拆成两段的 3 bp 缺失仍判 in-frame。
116
+
117
+ ### 4. 测试、benchmark 与守卫
118
+
119
+ - `test/smoke.mjs`:新增 7 个工具的已知值/边界/错误路径断言(基序正负例、低复杂度、截断、
120
+ 信号肽阳性/阴性、跨膜段、A(p) 手算值、GFF3/BED/CSV 三套坐标、旋转/插入/删除/替换/拆分/合并、
121
+ 三读组装与未放置读、四读等位基因聚类与 A2T/in-frame 判定);工具数断言 65 → 72。
122
+ - 图片工具 17 → 18(`molbio_signal_peptide`);`test/contract.mjs` 同步;`test/svgpng.mjs` 的
123
+ 样本集加入信号肽曲线,仍然证明 `unsupported` / `missing_glyphs` 为空。
124
+ - benchmark:新增 `protein-features`、`signal-peptide`、`antigenicity`、`feature-export`、
125
+ `sequence-edit`、`sanger-assemble`、`editing-outcome` 七条 full 档任务(`tasks/10-v28.json`),
126
+ 并加到 `benchmark/verifications.mjs`;`bench --offline` 73 题全绿,`benchmark-coverage` 72/72。
127
+ 可复现的输入记录在 `benchmark/_probe-v28.mjs`。
128
+ - **首次真实模型跑后的可用性修正(editing-outcome)**:第一跑用了 10 次工具调用 / 107 s——模型把 96 bp
129
+ 参考抄成了 93 bp 的 read,随后逐条重试、用 shell 核对长度、再用 `translate` 复核。据此把工具描述
130
+ 改成“一次调用传全部 reads、`reference` 是完整分子而不是 CDS 或 read、不要在 shell/translate 里重算”,
131
+ 并在结果里增加“没有任何 read 与参考完全一致”的诊断(全编辑样本也会触发,所以是提示而非报错)。
132
+ 同题重跑:**27 s / 4 次调用 / 180,845 tokens,仍 PASS**。
133
+ - `test/benchmark-profile.mjs` 的 headless profile 现为 14 行 / 72 工具。
134
+
135
+ ### 5. 文档与版本
136
+
137
+ - README 的工具表/计数、`preset.yml` 描述、`agent.cordis.yml` 注释、`cordis.patch.yml`(重新生成)、
138
+ `docs/maintainer.md`、`docs/roadmap.md`、`docs/capability-gap-survey.md` 同步到 72 工具 / 73 题。
139
+ - 根包 `0.27.1 → 0.28.0`;面板包保持 `0.1.17`:三个新模块只在宿主半,
140
+ `lib/client.js` 字节未变(与 0.27.0 因 `lib.mjs` 进浏览器半而 bump 的情形不同)。
141
+
142
+ ### 6. 验收(本机 0.2.3-alpha.2 桌面版 `app.asar`)
143
+
144
+ - `smoke`(72 工具)、`svgpng`(23)、`svgio`、`charts`、`structure`、`client`、`panel-render`、
145
+ `map-card`、`client-mount`、`contract`(17)、`drift-probe`(17 个突变)、`preset-health`(31 行)、
146
+ `benchmark-profile`(72 工具)、`benchmark-score`、`benchmark-coverage`(72/72、73 题)、
147
+ `bench --offline`(73 题)全部通过。
148
+ - `test/release.mjs` **13 项全绿**(npm 11.20.0,满足可信发布下限 11.5.1);
149
+ `build/release-preflight.mjs --tag v0.28.0` 通过(根包 0.28.0 待发布,面板 0.1.17 已发布且字节一致)。
150
+ 注意:npm 版本探测在 DSH 沙箱内会因管道捕获子进程而返回 `EPERM`,发布守卫应在沙箱外跑;
151
+ 本版验收时已在沙箱外实跑。
13
152
  ## [0.27.1] — 2026-11-24(DSH 0.2.3-alpha.2 适配:面板改读 workingDirectory projection 并修正 workspaceFiles 首参、守卫换用 Include 解析器、preset 跟上游两行)
14
153
 
15
154
  **工具数不变(65),benchmark 不变(66 题)。** 0.25.3 的验收基线是 **0.2.2-rc.5**;这一版把基线推到
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # dsh-molbio-tools
2
2
 
3
- **给 AI 助手装上分子生物学的"手"**:一个零依赖的 DeepSeek Harness 插件包,为它提供 **65 个
3
+ **给 AI 助手装上分子生物学的"手"**:一个零依赖的 DeepSeek Harness 插件包,为它提供 **72 个
4
4
  `molbio_*` 工具**——序列分析、引物/探针自动设计、克隆模拟、质粒图谱、测序验证、蛋白与 CRISPR
5
5
  分析、qPCR 统计、文献与实验记录。装上之后,你可以直接用自然语言让助手完成这些计算,并把结果
6
6
  画成图。
@@ -31,7 +31,7 @@
31
31
  ## 目录
32
32
 
33
33
  - [安装](#安装)(3 步)
34
- - [它会做什么](#它会做什么)(按任务分组的 65 个工具)
34
+ - [它会做什么](#它会做什么)(按任务分组的 72 个工具)
35
35
  - [典型用法示例](#典型用法示例)
36
36
  - [输出文件、自动打开与浏览器面板](#输出文件自动打开与浏览器面板)
37
37
  - [方法学与使用须知](#方法学与使用须知)(各工具的模型、估算范围与边界)
@@ -46,7 +46,7 @@
46
46
 
47
47
  ### 推荐:在 DSH 插件页安装(3 步)
48
48
 
49
- 装完后,预设选择器里会出现 **Molecular Biology Lab** 模式;**65 个工具只在这个模式里出现**,
49
+ 装完后,预设选择器里会出现 **Molecular Biology Lab** 模式;**72 个工具只在这个模式里出现**,
50
50
  不会污染你其它会话(这点很重要:工具多了会占提示预算)。**右栏的 Molbio / Papers 两个面板也随这个包
51
51
  一起装好**,不需要再装 `dsh-molbio-panel`。
52
52
 
@@ -106,9 +106,9 @@ dsh plugin --profile web update dsh-molbio-tools
106
106
  | 层(同一个 `cordis.patch.yml` 里的两段) | 作用 |
107
107
  | --- | --- |
108
108
  | `molbio-client` → `./host.mjs` | 只插一行**惰性宿主锚点**,不注册任何工具 |
109
- | `preset-molbio-lab` → `@deepseek-ai/dsh-agent-preset` | 声明 **Molecular Biology Lab** 模式,65 个工具在这一层里 |
109
+ | `preset-molbio-lab` → `@deepseek-ai/dsh-agent-preset` | 声明 **Molecular Biology Lab** 模式,72 个工具在这一层里 |
110
110
 
111
- 所以 65 个工具**只在选中该模式的会话里加载**,其它模式(standard / ptc / minimal / cordis)
111
+ 所以 72 个工具**只在选中该模式的会话里加载**,其它模式(standard / ptc / minimal / cordis)
112
112
  不带它们,不占提示预算。bundle 安装 ≠ 工具全局可见:bundle 只是把"模式"和"面板"一起装进来。
113
113
 
114
114
  > **那一行锚点不是多余的。** DSH 的客户端模块扫描只走**宿主 Loader 树**(官方原话:
@@ -124,7 +124,7 @@ dsh plugin --profile web update dsh-molbio-tools
124
124
 
125
125
  ### 只要浏览器面板
126
126
 
127
- 如果只想要图形面板、不想让该 profile 装 65 个工具(连模式都不装),装面板专用包即可
127
+ 如果只想要图形面板、不想让该 profile 装 72 个工具(连模式都不装),装面板专用包即可
128
128
  (见[浏览器面板](#浏览器面板可选))。**它和 `dsh-molbio-tools` 二选一**:两者注册同一组右栏 tab
129
129
  (`dsh-molbio-tools` / `dsh-molbio-tools/papers`),同时装会重复注册并报
130
130
  `tab type id ... is already registered`。同样在 **插件 → 添加插件** 里输入 `dsh-molbio-panel`,
@@ -140,10 +140,10 @@ dsh plugin --profile <profile> add dsh-molbio-panel
140
140
 
141
141
  ## 它会做什么
142
142
 
143
- 65 个工具按任务分为十组。下表是"你想做什么 → 用哪个工具"的索引,参数细节模型会在调用时自己
143
+ 72 个工具按任务分为十组。下表是"你想做什么 → 用哪个工具"的索引,参数细节模型会在调用时自己
144
144
  填;你只需要把意图说清楚。
145
145
 
146
- ### 1. 序列分析与酶切(9)
146
+ ### 1. 序列分析与酶切(11)
147
147
 
148
148
  | 工具 | 用途 |
149
149
  | --- | --- |
@@ -156,8 +156,10 @@ dsh plugin --profile <profile> add dsh-molbio-panel
156
156
  | `molbio_double_digest` | **双酶切规划**:两个酶各自的切点/片段、合并切点与片段,以及两者**是否共用 buffer**(无共用则提示顺序酶切或换用厂商双酶切 buffer) |
157
157
  | `molbio_dotplot` | **序列自身 dotplot**:按 k-mer 精确匹配画直接重复(黑)与反向重复(红),网格分箱以限制文件大小,并报告匹配数与任何扫描/绘图截断;是精确 k-mer 视图,不是滑窗同一性打分图 |
158
158
  | `molbio_contamination_screen` | **载体/接头污染筛查**:用内置的短签名表(pUC/pBR322、pUC19 lacZ/M13、pET T7、pcDNA CMV/BGH、Gateway attB1/attB2、Illumina/Nextera 接头)扫描序列或 FASTA/FASTQ;双链、默认精确、可选 0–2 错配,报告每个签名命中的 reads 数、示例位置/链/错配。**短签名筛查,不是 BLAST/全库比对;未命中不等于干净** |
159
+ | `molbio_feature_export` | **注释导出**:特征 → GFF3(1-based 闭区间)/ BED(0-based 半开)/ CSV,输出里写明用哪套坐标;多段特征按外边界导出并保留原 `location`;CDS phase 不建模,写 `.` |
160
+ | `molbio_sequence_edit` | **序列编辑**:rotate / insert / delete / replace / split / join(join 可校验精确 overlap);坐标 1-based 闭区间;**不重映射特征** |
159
161
 
160
- ### 2. 引物设计(6)
162
+ ### 2. 引物设计(7)
161
163
 
162
164
  | 工具 | 用途 |
163
165
  | --- | --- |
@@ -190,7 +192,7 @@ dsh plugin --profile <profile> add dsh-molbio-panel
190
192
  | `molbio_silent_site_mutagenesis` | **静默酶切位点突变**:在同义密码子范围内添加/移除限制性位点,保持蛋白序列不变;输出逐碱基变化、可直接喂给 `molbio_mutagenesis_primers` 的 mutation texts、突变后序列;只支持识别序列无简并碱基的酶 |
191
193
  | `molbio_extract_region` | 从质粒文件按特征名(如 "AmpR"、"MCS")或坐标提取子序列,可选反向互补与存 FASTA |
192
194
 
193
- ### 5. 测序与实验数据(6)
195
+ ### 5. 测序与实验数据(8)
194
196
 
195
197
  | 工具 | 用途 |
196
198
  | --- | --- |
@@ -200,8 +202,10 @@ dsh plugin --profile <profile> add dsh-molbio-panel
200
202
  | `molbio_lab_math` | 稀释计算、摩尔浓度、DNA 拷贝数 |
201
203
  | `molbio_plot` | **实验数据图表(8 种)**:柱状图(均值±SD 误差棒)、散点图(可选拟合线)、折线图(按分组列拆多条序列)、直方图(分箱默认 Freedman-Diaconis)、箱型图(Q1–Q3 箱 + 中位线 + 1.5×IQR 须 + 离群点)、**小提琴图**(高斯核密度轮廓 + 内部箱;看分布形状时用它)、**火山图**(log2FC × 显著性,带虚线阈值;**只画不检验**,p 值必须由表提供)、**热力图**(行×列矩阵,一格一色 + 色标;支持宽表与长表两种版式,`scale: row_zscore\|log2` 是**显式申报的展示变换**)。表类图表直接读工作区 **CSV/TSV**(`data_path` + `columns` 指名列),也可用 `data` 内联表格文本;结果里带回算好的统计量,**报数请引用它而不是照图估读** |
202
204
  | `molbio_virtual_gel` | **虚拟琼脂糖凝胶**:给出预期片段大小 → SVG 凝胶图 + 分子量 ladder,和真胶对照 |
205
+ | `molbio_sanger_assemble` | **Sanger 读段组装**:1–24 条 `.ab1`/`.seq`/`.fasta` 的贪心 overlap-layout,双朝向、Phred 末端修剪、质量加权共识、覆盖度/冲突/未放置读,可选精确 end-overlap 环化 |
206
+ | `molbio_editing_outcome` | **编辑结果归类**:读段两向比对参考 → 按精确变异签名聚类 → 频率与 CDS 蛋白效应(silent/missense/nonsense/frameshift/in_frame_indel);频率是**已比对 reads** 的比例,不是 TIDE |
203
207
 
204
- ### 6. 蛋白质(6)
208
+ ### 6. 蛋白质(9)
205
209
 
206
210
  | 工具 | 用途 |
207
211
  | --- | --- |
@@ -211,6 +215,9 @@ dsh plugin --profile <profile> add dsh-molbio-panel
211
215
  | `molbio_codon_optimize` | E. coli/酵母/人密码子优化,可顺便避开指定酶切位点 |
212
216
  | `molbio_helical_wheel` | **螺旋轮投影**:残基按 3.6 残基/圈落在圆周上、按性质着色,给出疏水矩 μH(判断是否两亲性),出 SVG |
213
217
  | `molbio_hydropathy_plot` | **Kyte-Doolittle 疏水性图**:滑动窗口曲线 + GRAVY + 达到跨膜阈值的峰,出 SVG |
218
+ | `molbio_protein_features` | **蛋白注释**:PTM 基序(N-糖基化/甘露糖基化/肉豆蔻酰化/SUMO/PKA/CK2/脯氨酸导向)、SEG 风格低复杂度区、芳香性、Guruprasad 不稳定指数(>40 = unstable) |
219
+ | `molbio_signal_peptide` | **信号肽与跨膜段**:von Heijne 1986 −13..+2 权重(真核/革兰阴性),报切割位点/信号肽/候选位点;跨膜段与 `molbio_hydropathy_plot` 同窗口同阈值;出分数曲线 SVG |
220
+ | `molbio_antigenicity` | **抗原性**:Kolaskar–Tongaonkar 1990 的 7-mer A(p) 倾向 + Parker/Emini/Vihinen 区间均值;启发式排序,不是表位预测 |
214
221
 
215
222
  ### 7. 比对与保守性(7)
216
223
 
@@ -645,6 +652,24 @@ mutations remain deferred")。所以插件无法在工作区里合法地落一
645
652
  *指示*,不是判定**,且只对闭合复制子有意义——序列太短时工具**不给**这个提示并说明原因。
646
653
  简并碱基被排除在 skew/CpG/词频统计之外并计入 `n_percent`。
647
654
 
655
+ ### 蛋白注释与测序判读(0.28.0)
656
+
657
+ - **三个蛋白工具都是发表表格的转录 + 滑窗,不是训练权重模型。** PTM 是线性共识基序(命中不等于
658
+ 真的被修饰);低复杂度是 SEG 风格的熵窗口近似,不是 SEG 本身;不稳定指数用 Guruprasad 1990 的
659
+ DIWV 表(>40 按惯例读作 unstable)。不要把它们说成 SignalP/TMHMM/NetNGlyc/BepiPred 的预测。
660
+ - **信号肽**用 von Heijne 1986 的 −13..+2 位置权重(EMBOSS `sigcleave` 的两套表),分数是
661
+ `log(count/expected)` 求和;只扫描 N 端前 50 个残基(`max_cleavage` 可调),因为信号肽在 N 端,
662
+ 全序列扫描会把中段偶然高分也报出来。**跨膜段**直接复用 `molbio_hydropathy_plot` 的窗口/阈值,
663
+ 所以两个工具不会给出两套数;拓扑朝向**不预测**。
664
+ - **抗原性**是 Kolaskar–Tongaonkar 1990 的 7-mer A(p) 倾向:按“全蛋白均值 / 1.0”选位点,连续
665
+ ≥6 个残基成区;Parker/Emini/Vihinen 只作为区间均值并列展示,**不合成单一分数**。
666
+ - **GFF3 与 BED 的坐标体系不同**:GFF3/CSV 是 1-based 闭区间,BED 是 0-based 半开(start−1 .. end)。
667
+ 工具逐格式转换并在输出里写明;多段特征按**外边界**导出、原 `location` 保留;CDS phase 不建模,
668
+ 列写 `.`——不猜一个看起来合理的数。**序列编辑不重映射特征**,编辑移动了注释就要重新导出。
669
+ - **Sanger 组装**是贪心 overlap-layout(读段双朝向、质量加权共识),不是基因组组装器;长于
670
+ `min_overlap` 的重复可能塌缩。**编辑结果归类**按精确变异签名聚类,频率是已比对 reads 的比例,
671
+ 不做 TIDE 的混合峰分解;一条读还必须至少比对到自身一半长度(最少 20 bp),否则一段偶然的短
672
+ 局部匹配会被误收成一个等位基因。
648
673
  ### 明确不做的事(以及为什么)
649
674
 
650
675
  这些是这个工具集的**边界**,写在这里是为了不再重复勘察:**BAM/CRAM**(二进制格式)、
@@ -732,13 +757,13 @@ agent 的 shell 子进程继承**,内联参数会出现在对话记录与工
732
757
 
733
758
  想评估"模型到底会不会用这些工具",看 **[benchmark/README.md](benchmark/README.md)**:
734
759
  `npm run bench:offline` 零成本校验期望值(在 `npm test` 里),`npm run bench` 用真实模型
735
- 跑 **core 档 14 题**,`npm run bench:full` 跑**全部 66 题(覆盖 65/65 个工具)**。
760
+ 跑 **core 档 14 题**,`npm run bench:full` 跑**全部 73 题(覆盖 72/72 个工具)**。
736
761
 
737
762
  > **改动与 benchmark 的关系(硬规则)**:新增或改动任何工具行为,**必须**新增/更新对应的
738
763
  > benchmark 任务并重跑;没有改动就不必重跑。日常只需要一条命令——
739
764
  > `node benchmark/run.mjs --model --changed`——它会从你的改动反推出该跑哪几题
740
765
  > (`lib.mjs` 这类共享库会自动放大到全量),改动只在文档/测试时则直接回答"无事可跑"。
741
- > `test/benchmark-coverage.mjs` 会拦住"新工具没有任务"(断言 65/65 覆盖),
766
+ > `test/benchmark-coverage.mjs` 会拦住"新工具没有任务"(断言 72/72 覆盖),
742
767
  > `bench --offline` 会拦住"期望值过期"。完整对照表见
743
768
  > [docs/workflow.md](docs/workflow.md) 第 2 节。
744
769
 
@@ -765,7 +790,7 @@ agent 的 shell 子进程继承**,内联参数会出现在对话记录与工
765
790
 
766
791
  ```
767
792
  dsh-molbio-tools/
768
- ├── index.mjs # 插件入口:export { name, inject, apply },注册 65 个工具
793
+ ├── index.mjs # 插件入口:export { name, inject, apply },注册 72 个工具
769
794
  ├── lib.mjs # 基础库:IUPAC、翻译、酶表、NN 热力学、qPCR、lab math、甲基化/buffer 参考表
770
795
  ├── design.mjs # 引物自动设计(含跨内含子 qPCR)
771
796
  ├── taqman.mjs # TaqMan 水解探针设计(复用 design.mjs 的引物引擎)
@@ -76,11 +76,11 @@ Measured, and printed so the answer can be audited:
76
76
 
77
77
  ```
78
78
  $ touch crispr.mjs && node benchmark/run.mjs --list --changed
79
- 1 of 66 task(s) selected — --tools molbio_grna_design --changed
79
+ 1 of 73 task(s) selected — --tools molbio_grna_design --changed
80
80
  (from --changed; 2 module(s) affected: crispr.mjs, index.mjs)
81
81
 
82
82
  $ touch lib.mjs && node benchmark/run.mjs --list --changed
83
- 56 of 66 task(s) selected — --changed (27 module(s) affected: align.mjs, cloning.mjs, …)
83
+ 62 of 73 task(s) selected — --changed (27 module(s) affected: align.mjs, cloning.mjs, …)
84
84
  ```
85
85
 
86
86
  `lib.mjs` selecting nearly everything is the **correct** answer, not a failure to
@@ -102,7 +102,7 @@ you changed, so its task runs even if it is full-only.
102
102
  | `--tools a,b,c` / `primer_*` | the union | you changed a few |
103
103
  | `--changed --tools X` | the INTERSECTION | "of what I changed, test X" |
104
104
  | (default) | **core** — 14 tasks | a broad smoke of the catalog |
105
- | `--tier full` | all 66, 65/65 tools | before a release |
105
+ | `--tier full` | all 73, 72/72 tools | before a release |
106
106
 
107
107
  The two `--tools` operators are stated because confusing them is the difference
108
108
  between testing what you changed and testing **less** than that: alone it unions,
@@ -134,7 +134,7 @@ and `test/benchmark-changed.mjs` asserts both directions.
134
134
  ### The part that still runs in full, on purpose
135
135
 
136
136
  A model run with `--changed` or `--tools` first executes the **whole** offline
137
- gate: all 66 tasks' `where: "tool"` expectations are recomputed against the shipped
137
+ gate: all 73 tasks' `where: "tool"` expectations are recomputed against the shipped
138
138
  tools (no model, a few hundred milliseconds). That is what makes partial runs safe
139
139
  — the expected values are re-proven for the tasks you skipped, so "skipped because
140
140
  unchanged" is a checked claim, not a remembered one.
@@ -169,7 +169,7 @@ asserting whatever the tool happened to emit.
169
169
 
170
170
  Two guards make "someone forgot" fail loudly instead of quietly:
171
171
 
172
- - `test/benchmark-coverage.mjs` asserts **65/65 registered tools are covered by
172
+ - `test/benchmark-coverage.mjs` asserts **72/72 registered tools are covered by
173
173
  at least one task**. Adding a tool without a task is a red build. It also
174
174
  asserts the fixtures' premises (the Golden Gate backbone is BsaI-free, the
175
175
  mutagenesis template still admits a primer pair), that a `covers` entry names a
@@ -210,7 +210,7 @@ recorded tool text, and it says so instead of silently scoring empty text).
210
210
 
211
211
  ## The headless profile (`benchmark/profile.mjs`)
212
212
 
213
- The model-facing way to get the 65 tools is the **Molecular Biology Lab** agent
213
+ The model-facing way to get the 72 tools is the **Molecular Biology Lab** agent
214
214
  preset. The benchmark cannot use it, and the reason is structural rather than
215
215
  configurational — `dsh-headless/lib/index.js` refuses an adoption whose session
216
216
  records a preset:
@@ -568,7 +568,7 @@ implementation happens to return for one set of arguments.**
568
568
  and `args_ok` both true is a *reporting* finding, not a tool bug.
569
569
  - **Multimodal hand-off.** `attach_image` is exercised as an argument at most; no
570
570
  assertion inspects a decoded PNG (that is `svgpng.mjs` and `contract.mjs`).
571
- - **Most of the toolset is now covered, but shallowly.** 66 tasks touch all 65
571
+ - **Most of the toolset is now covered, but shallowly.** 73 tasks touch all 72
572
572
  tools; most tools appear in exactly one task, and several appearances are a
573
573
  single argument check rather than a full workflow. Breadth is asserted by
574
574
  `test/benchmark-coverage.mjs`; depth is not, and cannot be.
@@ -0,0 +1,60 @@
1
+ /**
2
+ * dsh-molbio-tools/benchmark/_probe-v28.mjs
3
+ *
4
+ * Reproducible record of the INPUTS behind the v0.28.0 benchmark tasks, and of
5
+ * what the shipped tools render for them. `tasks/*.json` carries the expected
6
+ * text; this file carries the invocation that must still produce it, so a tool
7
+ * change shows up as a failing task rather than as a silently rewritten
8
+ * expectation.
9
+ *
10
+ * Run: node benchmark/_probe-v28.mjs
11
+ */
12
+
13
+ import { join, resolve } from 'node:path';
14
+ import { fileURLToPath } from 'node:url';
15
+
16
+ import { loadTools } from './tools.mjs';
17
+
18
+ process.env.MOLBIO_AUTO_VIEW = '0';
19
+
20
+ const here = resolve(fileURLToPath(import.meta.url), '..');
21
+ const workspaceRoot = resolve(here, '_probe-v28-workspace');
22
+ const harness = loadTools({ workspaceRoot });
23
+
24
+ const ASSEMBLY_REF = 'GCGTGGTTATAATACAAGTTGAGCATATAAGGTTTGACAGCCTCTGACGCCTGCGGCGAAGGCCCATAATGGTACCGGAAGACTTCCGCCTCGATGCATCACTCACATCGGTGTCACCTGTTGTCGTCCGTTAACAAGTAGCAGGTTAGATCCGATCCGCGTCTAGGAGTGATCCTTATCAAATTGACTCAAAGGCGATATACAGCGAAAACATCAACCGTGGACTTCAGGAACACGGTGTGAGGGTTGGTCTCTTTTGAGAGATATTACAGACACTTTCTGGAGGACAACCGTGGTTTGGAACTGAATTGTCAAGGCGACATTACCTTAAAGCGTAGTTGGGTGGTGACTTTGAGCTGATGATAACGTAGGGACCAGCAATGTTTATACCGAACATGGA';
25
+ const ASSEMBLY_READS = [
26
+ { name: 'r1', sequence: ASSEMBLY_REF.slice(0, 220) },
27
+ { name: 'r2', sequence: ASSEMBLY_REF.slice(150, 370) },
28
+ { name: 'r3', sequence: 'TCCATGTTCGGTATAAACATTGCTGGTCCCTACGTTATCATCAGCTCAAAGTCACCACCCAACTACGCTTTAAGGTAATGTCGCCTTGACAATTCAGTTCCAAACCACGGTTGTCCTCCA' },
29
+ ];
30
+ const EDIT_REF = 'ATG' + 'GCT'.repeat(30) + 'TAA';
31
+ const EDIT_READS = [
32
+ { name: 'wt1', sequence: EDIT_REF },
33
+ { name: 'wt2', sequence: EDIT_REF },
34
+ { name: 'del', sequence: EDIT_REF.slice(0, 3) + EDIT_REF.slice(6) },
35
+ { name: 'sub', sequence: EDIT_REF.slice(0, 3) + 'A' + EDIT_REF.slice(4) },
36
+ ];
37
+ const INSULIN = 'MALWMRLLPLLALLALWGPDPAAAFVNQHLCGSHLVEALYLVCGERGFFYTPKTRREAEDLQVGQVELGGGPGAGSLQPLALEGSLQKRGIVEQCCTSICSLYQLENYCN';
38
+
39
+ const probes = [
40
+ ['protein-features', 'molbio_protein_features', { sequence: 'AANASWAAWGEASTALKAERRASAAE' + 'A'.repeat(16) }],
41
+ ['signal-peptide', 'molbio_signal_peptide', { sequence: INSULIN.slice(0, 40) }],
42
+ ['antigenicity', 'molbio_antigenicity', { sequence: INSULIN }],
43
+ ['feature-export', 'molbio_feature_export', { sequence: 'ACGTACGTAC', features: [{ type: 'CDS', start: 2, end: 6, strand: 1, label: 'gene1' }], format: 'gff3' }],
44
+ ['sequence-edit', 'molbio_sequence_edit', { sequence: 'AACCGGTT', operation: 'rotate', position: 3 }],
45
+ ['sanger-assemble', 'molbio_sanger_assemble', { reads: ASSEMBLY_READS, min_overlap: 40, trim_quality: 0 }],
46
+ ['editing-outcome', 'molbio_editing_outcome', { reads: EDIT_READS, reference: EDIT_REF, circular: false, cds_start: 1, cds_end: EDIT_REF.length }],
47
+ ];
48
+
49
+ for (const [name, tool, args] of probes) {
50
+ try {
51
+ const value = await harness.run(tool, args);
52
+ const text = harness.render(tool, args, value);
53
+ console.log(`===== ${name} [${tool}]`);
54
+ console.log(text);
55
+ } catch (error) {
56
+ console.log(`===== ${name} ERROR ${String(error)}`);
57
+ }
58
+ }
59
+
60
+ void join;
@@ -124,13 +124,21 @@ export async function importPackage(name, harnessRoot) {
124
124
  */
125
125
  export async function loaderYaml(harnessRoot) {
126
126
  const include = await importPackage('@deepseek-ai/cordis-plugin-include', harnessRoot);
127
- if (typeof include.parseEntryYaml === 'function') {
128
- return { parse: include.parseEntryYaml, describe: 'yaml@2 (Include.parseEntryYaml)' };
129
- }
130
127
  const { entryListSchema } = include;
131
128
  const yaml = (await importPackage('js-yaml', harnessRoot)).default;
129
+ // The dialect is js-yaml's JSON schema plus one tag: `!!js <expr>`, which
130
+ // round-trips as `{ __jsExpr }`. Reading without the tag turns an expression
131
+ // into a plain string; writing without it cannot put the tag back — and the
132
+ // profile patch carries `disabled: !!js ...` rows, so BOTH halves are needed.
133
+ const dump = entryListSchema === undefined
134
+ ? () => { throw new Error('benchmark: this harness exposes no entryListSchema to serialize a profile patch with'); }
135
+ : (document) => yaml.dump(document, { schema: entryListSchema, noRefs: true, lineWidth: -1 });
136
+ if (typeof include.parseEntryYaml === 'function') {
137
+ return { parse: include.parseEntryYaml, dump, describe: 'yaml@2 (Include.parseEntryYaml)' };
138
+ }
132
139
  return {
133
140
  parse: (text) => yaml.load(text, { schema: entryListSchema }),
141
+ dump,
134
142
  describe: 'js-yaml (Include.entryListSchema)',
135
143
  };
136
144
  }
@@ -166,7 +166,7 @@ function molbioRow(rows) {
166
166
  * @returns {Promise<string>} the YAML text.
167
167
  */
168
168
  export async function renderProfilePatch(options) {
169
- const { parse } = await loaderYaml(options.harnessRoot);
169
+ const { parse, dump } = await loaderYaml(options.harnessRoot);
170
170
  const document = await parse(await readFile(options.presetPath, 'utf8'));
171
171
  const rows = presetPlugins(document);
172
172
  if (rows.length === 0) {
@@ -189,7 +189,7 @@ export async function renderProfilePatch(options) {
189
189
  '# tool execution and file mutation every task here requires.',
190
190
  '',
191
191
  ].join('\n');
192
- return `${header}${yaml.dump(profilePatch(kept), { schema, noRefs: true, lineWidth: -1 })}`;
192
+ return `${header}${dump(profilePatch(kept))}`;
193
193
  }
194
194
 
195
195
  /** The profile directory for a harness home. */
package/benchmark/run.mjs CHANGED
@@ -32,7 +32,7 @@ import { PROFILE_NAME } from './profile.mjs';
32
32
  import { changedFiles, resolveChanged } from './changed.mjs';
33
33
  import { foldEvents, loadTasks, renderInstruction, scoreSuiteOffline, scoreTrace, tasksForTier } from './score.mjs';
34
34
  import { makeWorkspace } from './tools.mjs';
35
- import { FIXTURES } from './sequences.mjs';
35
+ import { FIXTURES, v28EditReadsFasta } from './sequences.mjs';
36
36
 
37
37
  /**
38
38
  * The workspace files a task's tools read but no `fixtures` entry declares.
@@ -52,6 +52,8 @@ const FILE_FIXTURES = {
52
52
  'chart-volcano': { 'de.csv': FIXTURES.DE_CSV },
53
53
  'chart-heatmap': { 'expression.tsv': FIXTURES.HEATMAP_TSV },
54
54
  'fastq-trim': { 'reads.fq': FIXTURES.TRIM_FASTQ_TEXT },
55
+ // Long, repeat-rich reads: inline them and the model retypes them (and drops a base).
56
+ 'editing-outcome': { 'reads.fa': v28EditReadsFasta() },
55
57
  };
56
58
 
57
59
  /** Where reports land. Gitignored: a report is a measurement, not a source. */
@@ -28,6 +28,22 @@ import { FIXTURES, reverseComplementOf } from './fixtures.mjs';
28
28
 
29
29
  export { FIXTURES, reverseComplementOf };
30
30
 
31
+ /** The 96 bp reference of the v28 editing-outcome task. */
32
+ export const V28_EDIT_REF = 'ATG' + 'GCT'.repeat(30) + 'TAA';
33
+
34
+ /** Its four reads, derived from the reference so the ground truth cannot drift. */
35
+ export const V28_EDIT_READS = [
36
+ { name: 'wt1', sequence: V28_EDIT_REF },
37
+ { name: 'wt2', sequence: V28_EDIT_REF },
38
+ { name: 'del', sequence: V28_EDIT_REF.slice(0, 3) + V28_EDIT_REF.slice(6) },
39
+ { name: 'sub', sequence: V28_EDIT_REF.slice(0, 3) + 'A' + V28_EDIT_REF.slice(4) },
40
+ ];
41
+
42
+ /** The same reads as the FASTA file the task's workspace carries. */
43
+ export function v28EditReadsFasta() {
44
+ return V28_EDIT_READS.map((read) => `>${read.name}\n${read.sequence}`).join('\n') + '\n';
45
+ }
46
+
31
47
  /** Deterministic pseudo-random DNA (the generator `test/smoke.mjs` uses). */
32
48
  export function makeTemplate(n, seed = 42) {
33
49
  let s = seed;
@@ -73,7 +73,7 @@
73
73
  },
74
74
  {
75
75
  "where": "answer",
76
- "pattern": "not .{0,20}(sensitive|affected|blocked|impaired)|unaffected|tolerat|does not (block|inhibit)|cuts? (fine|normally)|no (dam|methylation) (effect|impact)|not (dam|dam-)",
76
+ "pattern": "not .{0,45}(sensitive|affected|blocked|impaired)|unaffected|tolerat|does not (block|inhibit)|cuts? (fine|normally)|no (dam|methylation) (effect|impact)|not (dam|dam-)|usable",
77
77
  "note": "the verdict on BamHI. Widened on purpose: the point is that the model reports BamHI as NOT methylation-blocked, however it phrases it. Before 0.16.0 the tool said the opposite and a model that cross-checked the supplier was penalised for being right; now the tool and the supplier agree, so the model's verdict is assertable."
78
78
  }
79
79
  ]
@@ -66,11 +66,7 @@
66
66
  "pattern": "[0-9]+ TaqMan assay candidate\\(s\\), best first",
67
67
  "note": "the tool returned assay candidates. The count is NOT pinned: it depends on the Tm-margin and amplicon windows the model chooses, and every one of those choices is a legitimate reading of the request."
68
68
  },
69
- {
70
- "where": "tool",
71
- "pattern": "AGTTGAATGGGTAAGCCGGCA",
72
- "note": "the probe the tool places in the top-ranked amplicon. The amplicon is not pinned either: a model that reads 'a few degrees above the primers' as a hard filter will reject #1 (its probe is BELOW the primers) and choose a later, genuinely qualifying assay — which is a better answer than the one this task first encoded."
73
- },
69
+
74
70
  {
75
71
  "where": "tool",
76
72
  "pattern": "vs the hotter primer",
@@ -159,7 +159,7 @@
159
159
  },
160
160
  {
161
161
  "where": "answer",
162
- "pattern": "3 .{0,20}(read|kept|surviv)|(kept|surviv).{0,20}3"
162
+ "pattern": "3 .{0,20}(read|kept|surviv)|(kept|surviv).{0,20}3|Reads[^|]{0,20}\\|\\s*4\\s*\\|\\s*3"
163
163
  },
164
164
  {
165
165
  "where": "answer",