dsh-molbio-tools 0.28.0 → 0.28.2
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 +98 -0
- package/README.md +8 -6
- package/batch.mjs +53 -21
- package/benchmark/README.md +6 -0
- package/benchmark/harness.mjs +11 -3
- package/benchmark/profile.mjs +2 -2
- package/benchmark/run.mjs +3 -1
- package/benchmark/sequences.mjs +16 -0
- package/benchmark/tasks/01-core.json +1 -1
- package/benchmark/tasks/02-primers.json +1 -5
- package/benchmark/tasks/04-cloning.json +2 -2
- package/benchmark/tasks/09-formats.json +1 -1
- package/benchmark/tasks/10-v28.json +1 -1
- package/benchmark/verifications.mjs +3 -9
- package/build/check.mjs +463 -0
- package/build/client-bundle.mjs +1 -1
- package/build/panel-core.mjs +15 -3
- package/build/release-notes.mjs +82 -52
- package/build/release-preflight.mjs +1 -1
- package/docs/audit-2026-12.md +314 -0
- package/docs/change-process.md +305 -0
- package/docs/history.md +2 -0
- package/docs/maintainer.md +7 -2
- package/docs/roadmap.md +1 -1
- package/docs/rules.md +36 -6
- package/docs/store-evidence.md +17 -7
- package/docs/workflow.md +17 -5
- package/genbank.mjs +65 -14
- package/host.mjs +1 -1
- package/index.mjs +239 -140
- package/lib/client.js +89 -17
- package/package.json +11 -7
- package/pcr.mjs +29 -7
- package/phylo.mjs +0 -6
- package/seqio.mjs +5 -0
- package/taqman.mjs +4 -0
- package/test/client.mjs +6 -0
- package/test/contract.mjs +1 -1
- package/test/prompt.mjs +149 -0
- package/test/release.mjs +15 -8
- package/test/smoke.mjs +129 -4
- package/view.mjs +13 -1
package/genbank.mjs
CHANGED
|
@@ -41,15 +41,35 @@ function parseLocation(raw) {
|
|
|
41
41
|
const parts = [...cleaned.matchAll(/\d+(?:\.\.\d+)?/g)];
|
|
42
42
|
const numbers = [...cleaned.matchAll(/\d+/g)].map((match) => Number(match[0]));
|
|
43
43
|
if (numbers.length === 0) return undefined;
|
|
44
|
+
// Reduce with a loop, never `Math.min(...numbers)`: a 20 Mb join() with a few
|
|
45
|
+
// hundred thousand parts is a real NCBI record shape, and spreading it into
|
|
46
|
+
// the argument list throws `RangeError: Maximum call stack size exceeded`
|
|
47
|
+
// instead of returning a span.
|
|
48
|
+
let start = numbers[0];
|
|
49
|
+
let end = numbers[0];
|
|
50
|
+
for (const number of numbers) {
|
|
51
|
+
if (number < start) start = number;
|
|
52
|
+
if (number > end) end = number;
|
|
53
|
+
}
|
|
44
54
|
return {
|
|
45
|
-
start
|
|
46
|
-
end
|
|
55
|
+
start,
|
|
56
|
+
end,
|
|
47
57
|
strand: /complement/i.test(raw) ? -1 : 1,
|
|
48
58
|
raw: raw.trim(),
|
|
49
59
|
multiPart: parts.length > 1,
|
|
50
60
|
};
|
|
51
61
|
}
|
|
52
62
|
|
|
63
|
+
/** Does this location still have an unclosed `(` (i.e. it wraps onto the next line)? */
|
|
64
|
+
function isLocationOpen(text) {
|
|
65
|
+
let depth = 0;
|
|
66
|
+
for (const character of text) {
|
|
67
|
+
if (character === '(') depth += 1;
|
|
68
|
+
else if (character === ')') depth = Math.max(0, depth - 1);
|
|
69
|
+
}
|
|
70
|
+
return depth > 0;
|
|
71
|
+
}
|
|
72
|
+
|
|
53
73
|
/** Parse one qualifier line: /key="value" (or unquoted value). */
|
|
54
74
|
function parseQualifier(line) {
|
|
55
75
|
const match = /^\s*\/?([a-zA-Z_][a-zA-Z0-9_]*)\s*=\s*(?:"([^"]*)"|(\S+))/.exec(line);
|
|
@@ -82,6 +102,31 @@ export function parseGenBank(text) {
|
|
|
82
102
|
let inOrigin = false;
|
|
83
103
|
let currentFeature = undefined;
|
|
84
104
|
let currentQualifier = undefined;
|
|
105
|
+
let currentLocation = '';
|
|
106
|
+
let locationOpen = false;
|
|
107
|
+
let placed = false;
|
|
108
|
+
|
|
109
|
+
/** Publish the current feature once its location can be placed. */
|
|
110
|
+
const placeCurrentFeature = () => {
|
|
111
|
+
if (currentFeature === undefined) return;
|
|
112
|
+
const parsedLocation = parseLocation(currentLocation);
|
|
113
|
+
if (parsedLocation === undefined) return;
|
|
114
|
+
currentFeature.location = parsedLocation;
|
|
115
|
+
if (!placed) {
|
|
116
|
+
features.push(currentFeature);
|
|
117
|
+
placed = true;
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
/** Count a feature that never got a placeable location, then reset per-feature state. */
|
|
122
|
+
const finishFeature = () => {
|
|
123
|
+
if (currentFeature !== undefined && !placed) skippedFeatures += 1;
|
|
124
|
+
currentFeature = undefined;
|
|
125
|
+
currentQualifier = undefined;
|
|
126
|
+
currentLocation = '';
|
|
127
|
+
locationOpen = false;
|
|
128
|
+
placed = false;
|
|
129
|
+
};
|
|
85
130
|
|
|
86
131
|
for (let i = locusIndex; i < lines.length; i++) {
|
|
87
132
|
const line = lines[i];
|
|
@@ -92,29 +137,35 @@ export function parseGenBank(text) {
|
|
|
92
137
|
}
|
|
93
138
|
if (inFeatures) {
|
|
94
139
|
if (/^ORIGIN/.test(line)) {
|
|
140
|
+
finishFeature();
|
|
95
141
|
inFeatures = false;
|
|
96
142
|
inOrigin = true;
|
|
97
143
|
continue;
|
|
98
144
|
}
|
|
99
145
|
if (/^\s{5}\S/.test(line)) {
|
|
100
146
|
// New feature: 5 spaces, then type and location.
|
|
147
|
+
finishFeature();
|
|
101
148
|
const match = /^\s{5}(\S+)\s*(.*)$/.exec(line);
|
|
102
149
|
if (match === null) {
|
|
103
150
|
skippedFeatures += 1;
|
|
104
151
|
continue;
|
|
105
152
|
}
|
|
106
|
-
currentFeature = {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
153
|
+
currentFeature = { type: match[1], location: undefined, qualifiers: {} };
|
|
154
|
+
currentLocation = match[2] ?? '';
|
|
155
|
+
locationOpen = isLocationOpen(currentLocation);
|
|
156
|
+
placeCurrentFeature();
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
// A location wider than the column wraps onto 21-space continuation lines
|
|
160
|
+
// (`join(1..10,30..40,` + `50..60,70..80)`), which is how NCBI writes any
|
|
161
|
+
// long join(). Such a line belongs to the LOCATION. It used to be read as
|
|
162
|
+
// a qualifier continuation only, so the span silently stopped at the first
|
|
163
|
+
// line and every downstream coordinate (map, batch table, feature counts)
|
|
164
|
+
// sat on the wrong bases.
|
|
165
|
+
if (locationOpen && /^\s{21}[0-9()][0-9,().^<>?\s]*$/.test(line)) {
|
|
166
|
+
currentLocation += line.trim();
|
|
167
|
+
locationOpen = isLocationOpen(currentLocation);
|
|
168
|
+
placeCurrentFeature();
|
|
118
169
|
continue;
|
|
119
170
|
}
|
|
120
171
|
if (/^\s{21}\//.test(line) && currentFeature !== undefined) {
|
package/host.mjs
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
*
|
|
28
28
|
* ── WHY NOT JUST ANCHOR ON index.mjs ───────────────────────────────────────
|
|
29
29
|
*
|
|
30
|
-
* `index.mjs` is the TOOL plugin: importing it must register all
|
|
30
|
+
* `index.mjs` is the TOOL plugin: importing it must register all 72 tools and
|
|
31
31
|
* a prompt section. A host row naming it would put every tool back into every
|
|
32
32
|
* session, which is the thing the preset split exists to avoid. This anchor is
|
|
33
33
|
* deliberately inert.
|