@biolibs/bionet-tools 0.1.10 → 0.1.12

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 (51) hide show
  1. package/README.md +211 -0
  2. package/dist/codons.d.ts +35 -0
  3. package/dist/codons.d.ts.map +1 -1
  4. package/dist/codons.js +55 -0
  5. package/dist/codons.js.map +1 -1
  6. package/dist/fusion-bench.d.ts +62 -0
  7. package/dist/fusion-bench.d.ts.map +1 -0
  8. package/dist/fusion-bench.js +114 -0
  9. package/dist/fusion-bench.js.map +1 -0
  10. package/dist/fusion.d.ts +120 -0
  11. package/dist/fusion.d.ts.map +1 -0
  12. package/dist/fusion.js +176 -0
  13. package/dist/fusion.js.map +1 -0
  14. package/dist/index.d.ts +12 -0
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +12 -0
  17. package/dist/index.js.map +1 -1
  18. package/dist/modify.js +4 -4
  19. package/dist/modify.js.map +1 -1
  20. package/dist/ordering.d.ts +147 -0
  21. package/dist/ordering.d.ts.map +1 -0
  22. package/dist/ordering.js +203 -0
  23. package/dist/ordering.js.map +1 -0
  24. package/dist/protocol.d.ts +91 -0
  25. package/dist/protocol.d.ts.map +1 -0
  26. package/dist/protocol.js +278 -0
  27. package/dist/protocol.js.map +1 -0
  28. package/dist/remedy.d.ts +137 -0
  29. package/dist/remedy.d.ts.map +1 -0
  30. package/dist/remedy.js +234 -0
  31. package/dist/remedy.js.map +1 -0
  32. package/dist/tools.d.ts +1 -1
  33. package/dist/tools.d.ts.map +1 -1
  34. package/dist/tools.js +7 -3
  35. package/dist/tools.js.map +1 -1
  36. package/dist/work.d.ts +18 -0
  37. package/dist/work.d.ts.map +1 -0
  38. package/dist/work.js +155 -0
  39. package/dist/work.js.map +1 -0
  40. package/package.json +2 -2
  41. package/src/codons.ts +53 -0
  42. package/src/fusion-bench.tsx +209 -0
  43. package/src/fusion.ts +270 -0
  44. package/src/index.ts +12 -0
  45. package/src/modify.ts +4 -4
  46. package/src/ordering.ts +301 -0
  47. package/src/protocol.ts +332 -0
  48. package/src/remedy.ts +277 -0
  49. package/src/tools.tsx +8 -4
  50. package/src/work.tsx +319 -0
  51. package/tools.css +18 -0
@@ -0,0 +1,278 @@
1
+ import { planOfWork } from "./ordering.js";
2
+ /** What a kind of run is called on the page, and what a plan of that kind never says. */
3
+ const KINDS = {
4
+ pcr: {
5
+ title: "Copy it by PCR",
6
+ records: "at the PCR tool, which takes what it used from each tube and puts the product in the freezer.",
7
+ notSaid: ["which polymerase and which buffer", "the final volume of the reaction, and how much water",
8
+ "how much of each primer, by concentration", "the first denaturation and the last extension"],
9
+ },
10
+ digest: {
11
+ records: "at the digest and gel tool, which takes what it used and notes whether the gel showed what was expected.", title: "Cut it, and run a gel",
12
+ notSaid: ["which buffer, and how much enzyme", "what temperature to cut at and for how long",
13
+ "how the gel is stained and how it is looked at"],
14
+ },
15
+ ligation: {
16
+ records: "at the ligation tool, which takes what it used and puts what came out in the freezer.", title: "Join the pieces",
17
+ notSaid: ["which ligase and which buffer", "the ratio of insert to vector", "what temperature to leave it at, and for how long"],
18
+ },
19
+ assembly: {
20
+ records: "at the assembly tool, which takes what it used and puts the ring in the freezer.", title: "Build the ring",
21
+ notSaid: ["which assembly mix", "what temperature to hold it at, and for how long", "how much of each piece, by concentration"],
22
+ },
23
+ transformation: {
24
+ records: "on the Strains page. Whether it worked is whether colonies grew, which only you can say, and either way it used what it used.", title: "Put it into a host",
25
+ notSaid: ["how the cells are made competent", "heat shock or electroporation, and the settings for it",
26
+ "how long to let them recover, and in what", "what to select on"],
27
+ },
28
+ induction: {
29
+ records: "at the induction tool, which takes what it used and, if the band is there, puts the protein in the freezer.", title: "Grow it and look for the protein",
30
+ notSaid: ["which medium, and what volume", "what density to induce at", "how the cells are broken open, if they are",
31
+ "how the gel is stained"],
32
+ },
33
+ sequencing: { records: "at the checking tool, which compares the read against the design and records what it found.", title: "Have it sequenced", notSaid: ["which facility, and how they want it sent", "how much to send, and at what concentration"] },
34
+ };
35
+ const count = (value) => value.toLocaleString("en-US");
36
+ /**
37
+ * The work of one piece, written out as a protocol.
38
+ *
39
+ * @param lab - The lab, for the names of what its tubes hold and where they are.
40
+ * @param options - `project` picks one project's work; `title` names the sheet.
41
+ * @returns One protocol for each piece of work, in the order the pieces come.
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * import { protocolsFor, protocolText } from "@biolibs/bionet-tools";
46
+ *
47
+ * for (const sheet of protocolsFor(lab, { project: "Real Vegan Cheese" })) console.log(protocolText(sheet));
48
+ * ```
49
+ */
50
+ export function protocolsFor(lab, options = {}) {
51
+ const work = planOfWork(lab);
52
+ const threads = options.project === undefined ? work.threads
53
+ : work.projects.find((one) => one.name === options.project)?.threads ?? [];
54
+ const partName = (checksum) => lab.parts.find((one) => one.checksum === checksum)?.name ?? "a part";
55
+ const placeName = (place) => (lab.places ?? []).find((one) => one.place === place)?.name ?? null;
56
+ /** What is in a tube, by the lab's name for it. */
57
+ const whatIsIn = (item) => {
58
+ const held = lab.items.find((one) => one.item === item);
59
+ if (held === undefined)
60
+ return "something the lab no longer has";
61
+ return held.part === null
62
+ ? (lab.strains ?? []).find((one) => one.strain === held.strain)?.name ?? "a culture"
63
+ : partName(held.part);
64
+ };
65
+ /**
66
+ * How much of what, for an instruction: short, because the instruction is read while doing it.
67
+ */
68
+ const tubeWords = (item, amount) => {
69
+ const held = lab.items.find((one) => one.item === item);
70
+ const unit = held?.unit ?? "";
71
+ return `${count(amount)}${unit === "" ? "" : ` ${unit}`} of ${whatIsIn(item)}`;
72
+ };
73
+ /**
74
+ * The same, with where it is and how much the tube holds: for the list of what to fetch before
75
+ * starting, which is read standing in front of a freezer and wants rather more.
76
+ */
77
+ const fetchWords = (item, amount) => {
78
+ const held = lab.items.find((one) => one.item === item);
79
+ if (held === undefined)
80
+ return "a tube the lab no longer has";
81
+ const unit = held.unit ?? "";
82
+ const where = placeName(held.where?.place);
83
+ return `${tubeWords(item, amount)}${where === null ? "" : ` — in ${where}`}`
84
+ + ` (the tube holds ${count(held.amount)}${unit === "" ? "" : ` ${unit}`})`;
85
+ };
86
+ const says = (plan, key) => {
87
+ const value = plan.settings[key];
88
+ return value === undefined ? null : String(value);
89
+ };
90
+ /** What to do, for a kind of run, from what the plan actually recorded. */
91
+ const doingOf = (step) => {
92
+ const plan = step.plan;
93
+ const used = plan.inputs.map((one) => ({
94
+ // A part the lab has no tube of has an amount but no unit, since the unit belongs to the tube.
95
+ // A bare "1 of the insert" reads as a mistake, so it is simply named.
96
+ ...one, words: one.item === undefined ? partName(one.part) : tubeWords(one.item, one.amount),
97
+ }));
98
+ const byRole = (role) => used.filter((one) => one.role === role);
99
+ const makes = plan.expects.map((one) => `${one.name} (${count(one.length)} bp${one.circular ? ", a circle" : ""})`);
100
+ const set = [];
101
+ const doThis = [];
102
+ if (plan.kind === "pcr") {
103
+ const template = byRole("template")[0] ?? used[0];
104
+ const primers = used.filter((one) => /primer/.test(one.role));
105
+ doThis.push(`Set up the reaction with ${template?.words ?? "the template"} as the template`
106
+ + (primers.length === 0 ? "." : `, and ${primers.map((one) => one.words).join(" and ")}.`));
107
+ const programme = ["denature_c", "anneal_c", "anneal_s", "extend_c", "extend_s", "cycles"].map((key) => says(plan, key));
108
+ if (programme.every((one) => one !== null)) {
109
+ set.push({ what: "Denature", to: `${programme[0]} °C` });
110
+ set.push({ what: "Anneal", to: `${programme[1]} °C for ${programme[2]} s` });
111
+ set.push({ what: "Extend", to: `${programme[3]} °C for ${programme[4]} s` });
112
+ set.push({ what: "Cycles", to: String(programme[5]) });
113
+ doThis.push("Run the programme above.");
114
+ }
115
+ else {
116
+ doThis.push("Run it on the thermocycler. This plan does not record the programme, so set it as the lab usually does for these primers.");
117
+ }
118
+ doThis.push(`Expect ${makes.join(" and ") || "one product"}.`);
119
+ }
120
+ else if (plan.kind === "digest") {
121
+ const enzymes = (says(plan, "enzymes") ?? "").split("+").filter((one) => one !== "");
122
+ doThis.push(`Cut ${used.map((one) => one.words).join(" and ")}`
123
+ + (enzymes.length === 0 ? "." : ` with ${enzymes.join(" and ")}.`));
124
+ const gel = says(plan, "gel");
125
+ if (gel !== null)
126
+ set.push({ what: "Gel", to: `${gel}% agarose` });
127
+ for (const [key, what] of [["volts", "Run at"], ["minutes", "For"]]) {
128
+ const value = says(plan, key);
129
+ if (value !== null)
130
+ set.push({ what, to: key === "volts" ? `${value} V` : `${value} min` });
131
+ }
132
+ const expected = says(plan, "expected");
133
+ doThis.push("Run it on the gel beside a ladder.");
134
+ if (expected !== null)
135
+ doThis.push(`Expect bands at ${expected.split(",").map((one) => `${count(Number(one))} bp`).join(", ")}.`);
136
+ }
137
+ else if (plan.kind === "ligation" || plan.kind === "assembly") {
138
+ doThis.push(`Put ${used.map((one) => one.words).join(" and ")} together.`);
139
+ const overlap = says(plan, "overlap");
140
+ if (overlap !== null)
141
+ set.push({ what: "Overlap at each join", to: `${overlap} bp` });
142
+ const joins = says(plan, "joins");
143
+ if (joins !== null)
144
+ set.push({ what: "Joins", to: String(joins) });
145
+ doThis.push(`Expect ${makes.join(" and ") || "one product"}.`);
146
+ }
147
+ else if (plan.kind === "transformation") {
148
+ const construct = byRole("construct")[0];
149
+ const host = byRole("host")[0];
150
+ doThis.push(`Put ${construct?.words ?? "the construct"} into ${host?.words ?? "the host"}.`);
151
+ doThis.push("Plate them out and leave them to grow.");
152
+ doThis.push("Whether it worked is whether colonies grew, which only you can say. Either way it used what it used.");
153
+ }
154
+ else if (plan.kind === "induction") {
155
+ const culture = used[0];
156
+ doThis.push(`Grow ${culture?.words ?? "the culture"}.`);
157
+ const inducer = says(plan, "inducer");
158
+ const at = says(plan, "at");
159
+ if (inducer !== null)
160
+ doThis.push(`Add ${inducer}${at === null ? "" : ` to ${at}`}.`);
161
+ for (const [key, what, unit] of [["celsius", "Grow at", "°C"], ["rpm", "Shaking at", "rpm"], ["hours", "For", "h"]]) {
162
+ const value = says(plan, key);
163
+ if (value !== null)
164
+ set.push({ what, to: `${value} ${unit}` });
165
+ }
166
+ const kda = says(plan, "expected_kda");
167
+ doThis.push("Run a sample on a protein gel, beside a lane of the same culture before it was induced.");
168
+ if (kda !== null)
169
+ doThis.push(`Look for a band at ${kda} kDa that is in the induced lane and not the other.`);
170
+ }
171
+ else {
172
+ doThis.push(`Carry out the ${plan.kind} with ${used.map((one) => one.words).join(" and ") || "what it names"}.`);
173
+ if (makes.length > 0)
174
+ doThis.push(`Expect ${makes.join(" and ")}.`);
175
+ }
176
+ return { doThis, set };
177
+ };
178
+ return threads.map((thread) => {
179
+ const steps = thread.steps.map((step, at) => {
180
+ const known = KINDS[step.plan.kind];
181
+ const number = at + 1;
182
+ const { doThis, set } = doingOf(step);
183
+ // Something with no tube may be made by a step before this one, which the chain already
184
+ // knows. Saying "order it" when step 1 makes it would send somebody shopping for nothing.
185
+ const madeAt = (checksum) => {
186
+ const at = thread.steps.findIndex((each) => each.makes.includes(checksum ?? ""));
187
+ return at < 0 || at >= number ? null : at + 1;
188
+ };
189
+ const takeOut = step.plan.inputs.map((one) => {
190
+ if (one.item !== undefined)
191
+ return fetchWords(one.item, one.amount);
192
+ const from = madeAt(one.part);
193
+ return from === null
194
+ ? `${partName(one.part)} — the lab has no tube of it, and nothing here makes it: order or make it first`
195
+ : `${partName(one.part)} — what step ${from} makes`;
196
+ });
197
+ return {
198
+ number,
199
+ title: known?.title ?? `Carry out the ${step.plan.kind}`,
200
+ takeOut, set, doThis,
201
+ // Recording is what keeps the lab's history true, and where it is done differs by kind:
202
+ // a transformation is not run at a machine and is said on the Strains page.
203
+ thenRecord: `Record it ${known?.records ?? `at the ${step.plan.kind} tool.`}`,
204
+ notSaid: [...(known?.notSaid ?? ["what this plan does not record, the lab supplies as usual"])],
205
+ note: step.plan.note,
206
+ };
207
+ });
208
+ const needed = work.toGet.filter((one) => one.forSteps.some((each) => thread.steps.some((step) => step.plan.plan === each)));
209
+ // A chain that makes nothing — a digest, a check — has no product to be named by, so it is
210
+ // named by what it is done to, which is what somebody looking for the sheet would call it.
211
+ const actsOn = thread.steps[0]?.plan.inputs.flatMap((one) => (one.item === undefined ? [partName(one.part)] : [whatIsIn(one.item)])) ?? [];
212
+ return {
213
+ title: options.title ?? (thread.ends.length > 0 ? thread.name
214
+ : actsOn.length > 0 ? `${KINDS[thread.steps[0].plan.kind]?.title ?? thread.steps[0].plan.kind}: ${actsOn[0]}` : thread.name),
215
+ about: [
216
+ `${steps.length} ${steps.length === 1 ? "step" : "steps"}.`,
217
+ ...(thread.ends.length === 0 ? [] : [`It ends with ${thread.ends.map((one) => partName(one.checksum) === "a part" ? one.name : partName(one.checksum)).join(" and ")}.`]),
218
+ "Every step is proposed, not done: nothing is used and nothing is recorded until somebody carries it out and says so.",
219
+ ],
220
+ haveReady: [
221
+ ...needed.map((one) => `${partName(one.checksum) === "a part" ? one.name : partName(one.checksum)} — nothing here makes it and the lab has no tube: order or make it first.`),
222
+ ...[...new Set(thread.steps.flatMap((step) => step.plan.inputs.flatMap((one) => (one.item === undefined ? [] : [fetchWords(one.item, one.amount)]))))],
223
+ ],
224
+ steps,
225
+ atTheEnd: thread.ends.map((one) => partName(one.checksum) === "a part" ? one.name : partName(one.checksum)),
226
+ };
227
+ });
228
+ }
229
+ /**
230
+ * A protocol as text, to print or to paste.
231
+ *
232
+ * Markdown, because it reads as well unrendered as rendered, and somebody at a bench is as likely to
233
+ * have it in a terminal or a text file as on a page.
234
+ *
235
+ * @param protocol - What `protocolsFor` gave.
236
+ * @returns The sheet.
237
+ */
238
+ export function protocolText(protocol) {
239
+ const out = [`# ${protocol.title}`, ""];
240
+ for (const line of protocol.about)
241
+ out.push(line, "");
242
+ if (protocol.haveReady.length > 0) {
243
+ out.push("## Have ready", "");
244
+ for (const one of protocol.haveReady)
245
+ out.push(`- ${one}`);
246
+ out.push("");
247
+ }
248
+ for (const step of protocol.steps) {
249
+ out.push(`## ${step.number}. ${step.title}`, "");
250
+ if (step.note !== null)
251
+ out.push(`*${step.note}*`, "");
252
+ if (step.takeOut.length > 0) {
253
+ out.push("**Take out**", "");
254
+ for (const one of step.takeOut)
255
+ out.push(`- ${one}`);
256
+ out.push("");
257
+ }
258
+ if (step.set.length > 0) {
259
+ out.push("**Set**", "");
260
+ for (const one of step.set)
261
+ out.push(`- ${one.what}: ${one.to}`);
262
+ out.push("");
263
+ }
264
+ out.push("**Do**", "");
265
+ for (const [at, one] of step.doThis.entries())
266
+ out.push(`${at + 1}. ${one}`);
267
+ out.push("", `**Then** ${step.thenRecord}`, "");
268
+ out.push("**This plan does not say**", "");
269
+ for (const one of step.notSaid)
270
+ out.push(`- ${one}`);
271
+ out.push("");
272
+ }
273
+ if (protocol.atTheEnd.length > 0)
274
+ out.push(`At the end you have ${protocol.atTheEnd.join(" and ")}.`, "");
275
+ out.push("---", "", "Everything above that is a number — a volume, a temperature, a time, a length — is what somebody", "set or what the lab's own tools worked out. Nothing here was filled in to make the page look finished:", "what the plan does not say is listed under each step instead.");
276
+ return out.join("\n");
277
+ }
278
+ //# sourceMappingURL=protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,UAAU,EAA+B,MAAM,eAAe,CAAC;AAmDxE,yFAAyF;AACzF,MAAM,KAAK,GAA6F;IACtG,GAAG,EAAE;QACH,KAAK,EAAE,gBAAgB;QACvB,OAAO,EAAE,+FAA+F;QACxG,OAAO,EAAE,CAAC,mCAAmC,EAAE,sDAAsD;YAC3F,2CAA2C,EAAE,+CAA+C,CAAC;KACxG;IACD,MAAM,EAAE;QACN,OAAO,EAAE,0GAA0G,EAAE,KAAK,EAAE,uBAAuB;QACnJ,OAAO,EAAE,CAAC,mCAAmC,EAAE,6CAA6C;YAClF,gDAAgD,CAAC;KAC5D;IACD,QAAQ,EAAE;QACR,OAAO,EAAE,uFAAuF,EAAE,KAAK,EAAE,iBAAiB;QAC1H,OAAO,EAAE,CAAC,+BAA+B,EAAE,+BAA+B,EAAE,mDAAm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,137 @@
1
+ import type { HostKinases } from "./modify.js";
2
+ import type { Working } from "./pcr-working.js";
3
+ /** One way round a host that will not do it. */
4
+ export interface Remedy {
5
+ /** Short name, to pick it by. */
6
+ name: string;
7
+ /** What it is, in a sentence or two. */
8
+ what: string;
9
+ /** What it costs the lab: what it needs and what it gives up. */
10
+ costs: string;
11
+ /** How firmly the route is held to work at all. */
12
+ standing: "well established" | "reported" | "worth trying";
13
+ /** Whether anything here can work it out, or it is only described. */
14
+ computable: boolean;
15
+ }
16
+ /**
17
+ * The ways round a host that will not phosphorylate what it makes, in no order of preference.
18
+ *
19
+ * None is recommended, because which one suits depends on what a lab has — a tissue culture room, a
20
+ * second selection marker, a purified kinase, time — and nothing here knows that. What is said of
21
+ * each is what it costs and how firmly it is held.
22
+ */
23
+ export declare const REMEDIES: readonly Remedy[];
24
+ /** One residue swapped for something that carries a charge. */
25
+ export interface Swapped {
26
+ /** Where it is, counting from 1 on the protein given. */
27
+ at: number;
28
+ /** What was there, and what it became. */
29
+ was: string;
30
+ now: string;
31
+ }
32
+ /** A protein with its phosphosites swapped for something charged. */
33
+ export interface Phosphomimetic {
34
+ /** The protein, changed. */
35
+ protein: string;
36
+ /** Each residue that changed. */
37
+ swapped: Swapped[];
38
+ /** What was asked for but could not be changed, because that residue is not one that is phosphorylated. */
39
+ notSwapped: {
40
+ at: number;
41
+ was: string;
42
+ why: string;
43
+ }[];
44
+ /** What it weighs before and after, in daltons, and what that is on a gel. */
45
+ weight: {
46
+ before: number;
47
+ after: number;
48
+ } | null;
49
+ kilodaltons: {
50
+ before: number;
51
+ after: number;
52
+ } | null;
53
+ /** The pH it carries no net charge at, before and after: the figure this changes most. */
54
+ isoelectric: {
55
+ before: number;
56
+ after: number;
57
+ } | null;
58
+ /** What a careful person would know before leaning on it. */
59
+ warnings: string[];
60
+ /** Why nothing could be done, or `null`. */
61
+ problem: string | null;
62
+ }
63
+ /**
64
+ * Swap each named residue for something that carries a negative charge.
65
+ *
66
+ * @param protein - The amino acids.
67
+ * @param sites - Where the phosphosites are, counting from 1 on that sequence.
68
+ * @param options - `instead` is what to put there, `E` unless said.
69
+ * @returns The changed protein, what it changed, and what it does and does not reproduce.
70
+ *
71
+ * @example
72
+ * ```ts
73
+ * import { phosphomimetic } from "@biolibs/bionet-tools";
74
+ *
75
+ * const asked = phosphomimetic(casein, [15, 17, 18, 19, 35]);
76
+ * asked.isoelectric; // what the change really does: the charge, not the shape
77
+ * ```
78
+ */
79
+ export declare function phosphomimetic(protein: string, sites: readonly number[], options?: {
80
+ instead?: "E" | "D";
81
+ }): Phosphomimetic;
82
+ /** A gene rewritten so that it encodes a phosphomimetic. */
83
+ export interface MimeticGene {
84
+ /** The bases, changed. */
85
+ sequence: string;
86
+ /** Each codon that changed, by the amino acid it is, counting codons from 1. */
87
+ changed: {
88
+ codon: number;
89
+ was: string;
90
+ now: string;
91
+ aminoAcid: string;
92
+ }[];
93
+ /** Why nothing could be done, or `null`. */
94
+ problem: string | null;
95
+ }
96
+ /**
97
+ * Rewrite a coding sequence so that it encodes a phosphomimetic.
98
+ *
99
+ * The protein is what matters; this is how you get a lab something it can order. Each named codon is
100
+ * replaced with one for the substitute, and which codon that is can be the host's commonest, so that
101
+ * what comes out is as readable to the host as what went in.
102
+ *
103
+ * @param cds - The coding sequence, a whole number of codons.
104
+ * @param sites - Where the phosphosites are, counting amino acids from 1.
105
+ * @param options - `instead` is what to encode, `E` unless said; `codon` picks the codon to use for
106
+ * it, which `optimiseCodons` can choose from a host's own usage.
107
+ * @returns The gene, and what changed.
108
+ *
109
+ * @example
110
+ * ```ts
111
+ * import { mimeticGene } from "@biolibs/bionet-tools";
112
+ *
113
+ * mimeticGene(casein, [15, 17, 18, 19, 35], { codon: "GAA" }).sequence;
114
+ * ```
115
+ */
116
+ export declare function mimeticGene(cds: string, sites: readonly number[], options?: {
117
+ instead?: "E" | "D";
118
+ codon?: string;
119
+ }): MimeticGene;
120
+ /**
121
+ * The routes open to a lab whose host will not do it, with what each costs.
122
+ *
123
+ * @param host - What is held about the host, from `hostPhosphorylation`, or `null` if it is not known.
124
+ * @returns The routes, and a line about where they came from.
125
+ */
126
+ export declare function remediesFor(host: HostKinases | null): {
127
+ routes: Remedy[];
128
+ says: string[];
129
+ };
130
+ /**
131
+ * The working behind a phosphomimetic: what changed, and what it does and does not reproduce.
132
+ *
133
+ * @param made - What `phosphomimetic` gave.
134
+ * @returns The workings. Empty if nothing could be changed.
135
+ */
136
+ export declare function phosphomimeticWorking(made: Phosphomimetic): Working[];
137
+ //# sourceMappingURL=remedy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remedy.d.ts","sourceRoot":"","sources":["../src/remedy.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEhD,gDAAgD;AAChD,MAAM,WAAW,MAAM;IACrB,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,iEAAiE;IACjE,KAAK,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,QAAQ,EAAE,kBAAkB,GAAG,UAAU,GAAG,cAAc,CAAC;IAC3D,sEAAsE;IACtE,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,EAAE,SAAS,MAAM,EA+BrC,CAAC;AAEF,+DAA+D;AAC/D,MAAM,WAAW,OAAO;IACtB,yDAAyD;IACzD,EAAE,EAAE,MAAM,CAAC;IACX,0CAA0C;IAC1C,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb;AAED,qEAAqE;AACrE,MAAM,WAAW,cAAc;IAC7B,4BAA4B;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,iCAAiC;IACjC,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,2GAA2G;IA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