@biolibs/bionet-tools 0.1.7 → 0.1.9

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 (70) hide show
  1. package/dist/assembly-bench.d.ts +62 -0
  2. package/dist/assembly-bench.d.ts.map +1 -0
  3. package/dist/assembly-bench.js +114 -0
  4. package/dist/assembly-bench.js.map +1 -0
  5. package/dist/assembly-design.d.ts +119 -0
  6. package/dist/assembly-design.d.ts.map +1 -0
  7. package/dist/assembly-design.js +157 -0
  8. package/dist/assembly-design.js.map +1 -0
  9. package/dist/codon-bench.d.ts +51 -0
  10. package/dist/codon-bench.d.ts.map +1 -0
  11. package/dist/codon-bench.js +93 -0
  12. package/dist/codon-bench.js.map +1 -0
  13. package/dist/codons.d.ts +126 -0
  14. package/dist/codons.d.ts.map +1 -0
  15. package/dist/codons.js +287 -0
  16. package/dist/codons.js.map +1 -0
  17. package/dist/digest.d.ts +14 -0
  18. package/dist/digest.d.ts.map +1 -1
  19. package/dist/digest.js +18 -0
  20. package/dist/digest.js.map +1 -1
  21. package/dist/index.d.ts +14 -0
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +14 -0
  24. package/dist/index.js.map +1 -1
  25. package/dist/pcr-tool.js +1 -1
  26. package/dist/pcr-tool.js.map +1 -1
  27. package/dist/plans.d.ts.map +1 -1
  28. package/dist/plans.js +4 -1
  29. package/dist/plans.js.map +1 -1
  30. package/dist/primer-bench.js +1 -1
  31. package/dist/primer-bench.js.map +1 -1
  32. package/dist/protein.d.ts +106 -0
  33. package/dist/protein.d.ts.map +1 -0
  34. package/dist/protein.js +158 -0
  35. package/dist/protein.js.map +1 -0
  36. package/dist/run.d.ts +12 -0
  37. package/dist/run.d.ts.map +1 -1
  38. package/dist/run.js +19 -4
  39. package/dist/run.js.map +1 -1
  40. package/dist/sequences-tool.js +1 -1
  41. package/dist/sequences-tool.js.map +1 -1
  42. package/dist/tools.d.ts +1 -1
  43. package/dist/tools.d.ts.map +1 -1
  44. package/dist/tools.js +7 -3
  45. package/dist/tools.js.map +1 -1
  46. package/dist/verify-bench.d.ts +48 -0
  47. package/dist/verify-bench.d.ts.map +1 -0
  48. package/dist/verify-bench.js +77 -0
  49. package/dist/verify-bench.js.map +1 -0
  50. package/dist/verify.d.ts +138 -0
  51. package/dist/verify.d.ts.map +1 -0
  52. package/dist/verify.js +263 -0
  53. package/dist/verify.js.map +1 -0
  54. package/package.json +3 -1
  55. package/src/assembly-bench.tsx +232 -0
  56. package/src/assembly-design.ts +219 -0
  57. package/src/codon-bench.tsx +189 -0
  58. package/src/codons.ts +339 -0
  59. package/src/digest.ts +19 -0
  60. package/src/index.ts +14 -0
  61. package/src/pcr-tool.tsx +1 -1
  62. package/src/plans.tsx +4 -1
  63. package/src/primer-bench.tsx +1 -1
  64. package/src/protein.ts +204 -0
  65. package/src/run.ts +20 -4
  66. package/src/sequences-tool.tsx +1 -1
  67. package/src/tools.tsx +7 -3
  68. package/src/verify-bench.tsx +161 -0
  69. package/src/verify.ts +310 -0
  70. package/tools.css +13 -0
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Building a construct: the pieces in the order they go round the ring, and the primers that make
3
+ * them fit.
4
+ *
5
+ * This is the step between having a sequence and having something that can be put into a cell. A
6
+ * ligation joins pieces that have already been cut and whose ends happen to match; here you say
7
+ * what the ring should be made of and the overlaps are designed, which is how a promoter, a coding
8
+ * sequence and a terminator actually get into a vector.
9
+ *
10
+ * It is a desk, not a machine: nothing here is at an instrument. What it hands a scene is the ring
11
+ * it would make, drawn over the tube of the first piece.
12
+ */
13
+ import { type ReactNode } from "react";
14
+ import { type AssemblyDesign } from "./assembly-design.js";
15
+ import { type DrawnMolecule } from "./sequence-file.js";
16
+ /** The parts of the panel, in the order they are read, for a host that wants one of them in view. */
17
+ export type AssemblySection = "pieces" | "ring" | "junctions" | "primers" | "working";
18
+ /** What a host is handed to draw beside the panel. */
19
+ export interface AssemblyDesk {
20
+ /** The tube of the first piece, to look at, if the lab has one that has been put somewhere. */
21
+ focus: {
22
+ place: string;
23
+ item: string;
24
+ } | null;
25
+ /** The ring as a molecule, with what each piece carries marked on it. `null` until there is a design. */
26
+ molecule: DrawnMolecule | null;
27
+ /** The design as it stands, or `null`. */
28
+ design: AssemblyDesign | null;
29
+ }
30
+ /**
31
+ * Designing a construct from the lab's own parts.
32
+ *
33
+ * @param options - `start` says what to open on, for a tour or a link.
34
+ * @returns `panel`, the tool itself, and `desk`, what a scene beside it should look at and picture.
35
+ *
36
+ * @example
37
+ * ```tsx
38
+ * import { useAssemblyBench } from "@biolibs/bionet-tools";
39
+ *
40
+ * const bench = useAssemblyBench();
41
+ * <LabView lab={lab} wide beside={bench.panel} {...(bench.desk.focus === null ? {} : { focus: bench.desk.focus })} />
42
+ * ```
43
+ */
44
+ export declare function useAssemblyBench({ start }?: {
45
+ /** What to show: the pieces in order, the overlap, and which part of the panel to have in view. Followed whenever it changes. */
46
+ start?: {
47
+ pieces?: readonly string[];
48
+ overlap?: number;
49
+ name?: string;
50
+ section?: AssemblySection;
51
+ };
52
+ }): {
53
+ panel: ReactNode;
54
+ desk: AssemblyDesk;
55
+ };
56
+ /**
57
+ * The assembly design tool on its own, for a lab that has not drawn its room.
58
+ *
59
+ * @param props - `start` says what to open on.
60
+ */
61
+ export declare function AssemblyTool(props: Parameters<typeof useAssemblyBench>[0]): import("react").JSX.Element;
62
+ //# sourceMappingURL=assembly-bench.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assembly-bench.d.ts","sourceRoot":"","sources":["../src/assembly-bench.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,OAAO,EAAgC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGrE,OAAO,EAAkD,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3G,OAAO,EAAc,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGpE,qGAAqG;AACrG,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,SAAS,GAAG,SAAS,CAAC;AAEtF,sDAAsD;AACtD,MAAM,WAAW,YAAY;IAC3B,+FAA+F;IAC/F,KAAK,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC9C,yGAAyG;IACzG,QAAQ,EAAE,aAAa,GAAG,IAAI,CAAC;IAC/B,0CAA0C;IAC1C,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC;CAC/B;AAID;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,KAAK,EAAE,GAAE;IAC1C,iIAAiI;IACjI,KAAK,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,eAAe,CAAA;KAAE,CAAC;CAC/F,GAAG;IAAE,KAAK,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,YAAY,CAAA;CAAE,CAwKhD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC,CAAC,CAAC,+BAEzE"}
@@ -0,0 +1,114 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ /**
4
+ * Building a construct: the pieces in the order they go round the ring, and the primers that make
5
+ * them fit.
6
+ *
7
+ * This is the step between having a sequence and having something that can be put into a cell. A
8
+ * ligation joins pieces that have already been cut and whose ends happen to match; here you say
9
+ * what the ring should be made of and the overlaps are designed, which is how a promoter, a coding
10
+ * sequence and a terminator actually get into a vector.
11
+ *
12
+ * It is a desk, not a machine: nothing here is at an instrument. What it hands a scene is the ring
13
+ * it would make, drawn over the tube of the first piece.
14
+ */
15
+ import { useEffect, useMemo, useState } from "react";
16
+ import { useAct, useLab } from "@biolibs/bionet-react";
17
+ import { Glossed } from "@biolibs/glossary-react";
18
+ import { assemblyParts, assemblyWorking, designAssembly } from "./assembly-design.js";
19
+ import { SequenceMap } from "./map.js";
20
+ import { moleculeOf } from "./sequence-file.js";
21
+ import { ShowWorking } from "./working.js";
22
+ const count = (value) => value.toLocaleString("en-US");
23
+ /**
24
+ * Designing a construct from the lab's own parts.
25
+ *
26
+ * @param options - `start` says what to open on, for a tour or a link.
27
+ * @returns `panel`, the tool itself, and `desk`, what a scene beside it should look at and picture.
28
+ *
29
+ * @example
30
+ * ```tsx
31
+ * import { useAssemblyBench } from "@biolibs/bionet-tools";
32
+ *
33
+ * const bench = useAssemblyBench();
34
+ * <LabView lab={lab} wide beside={bench.panel} {...(bench.desk.focus === null ? {} : { focus: bench.desk.focus })} />
35
+ * ```
36
+ */
37
+ export function useAssemblyBench({ start } = {}) {
38
+ const lab = useLab()?.lab;
39
+ const act = useAct();
40
+ const [chosen, setChosen] = useState([...(start?.pieces ?? [])]);
41
+ const [fixed, setFixed] = useState([]);
42
+ const [overlap, setOverlap] = useState(String(start?.overlap ?? 25));
43
+ const [name, setName] = useState(start?.name ?? "");
44
+ const [busy, setBusy] = useState(false);
45
+ const [said, setSaid] = useState(null);
46
+ // A host driving the tool — a tour, or a link — says what to show by changing `start`.
47
+ const asked = JSON.stringify(start ?? null);
48
+ useEffect(() => {
49
+ if (start === undefined)
50
+ return;
51
+ if (start.pieces !== undefined)
52
+ setChosen([...start.pieces]);
53
+ if (start.overlap !== undefined)
54
+ setOverlap(String(start.overlap));
55
+ if (start.name !== undefined)
56
+ setName(start.name);
57
+ }, [asked]);
58
+ const whole = (text, fallback) => (/^\d+$/.test(text.trim()) ? Number(text) : fallback);
59
+ const offered = useMemo(() => (lab === null || lab === undefined ? [] : assemblyParts(lab, whole(overlap, 25))), [lab?.parts, overlap]);
60
+ const design = useMemo(() => {
61
+ if (lab === null || lab === undefined || chosen.length < 2)
62
+ return null;
63
+ return designAssembly(lab, {
64
+ pieces: chosen.map((one) => ({ part: one, amplify: !fixed.includes(one) })),
65
+ overlap: whole(overlap, 25), ...(name.trim() === "" ? {} : { name: name.trim() }),
66
+ });
67
+ }, [lab?.parts, chosen, fixed, overlap, name]);
68
+ const made = design !== null && design.problem === null ? design : null;
69
+ const working = useMemo(() => (made === null ? [] : assemblyWorking(made)), [made]);
70
+ const nameOf = (checksum) => lab?.parts.find((one) => one.checksum === checksum)?.name ?? "a part";
71
+ const firstTube = lab?.items.find((one) => one.part === chosen[0] && !one.retired && one.where !== null);
72
+ const desk = {
73
+ focus: firstTube?.where == null ? null : { place: firstTube.where.place, item: firstTube.item },
74
+ molecule: made === null ? null : moleculeOf({ name: made.name, length: made.length, circular: true, features: made.features }),
75
+ design,
76
+ };
77
+ const move = (at, by) => {
78
+ const to = at + by;
79
+ if (to < 0 || to >= chosen.length)
80
+ return;
81
+ const next = [...chosen];
82
+ [next[at], next[to]] = [next[to], next[at]];
83
+ setChosen(next);
84
+ setSaid(null);
85
+ };
86
+ /** Keep the designed primers as parts, so that they can be ordered and then used in the PCRs. */
87
+ const keep = async () => {
88
+ if (made === null)
89
+ return;
90
+ setBusy(true);
91
+ let added = 0;
92
+ for (const primer of made.primers) {
93
+ const answer = await act("addPart", { name: primer.name, sequence: primer.sequence });
94
+ if (answer.ok)
95
+ added += 1;
96
+ }
97
+ setBusy(false);
98
+ setSaid(`${added} of ${made.primers.length} primers are in the lab as parts. There are no tubes of them until they are ordered and arrive.`);
99
+ };
100
+ const panel = lab === null || lab === undefined ? null : (_jsxs("div", { className: "bionet assembly", children: [_jsxs("section", { className: "card", children: [_jsx("h2", { children: "Build a ring" }), _jsx("p", { className: "small", children: _jsx(Glossed, { text: "An assembly joins several pieces of DNA into one circle in a single reaction, with each piece overlapping the next." }) }), _jsx("p", { className: "dim small", children: "Choose the pieces in the order they go round. The overlaps are designed for you: each amplified piece gets primer tails that reach into its neighbours. A piece used as it is cannot be given tails, so its neighbours carry the whole overlap." }), offered.length < 2 ? _jsx("p", { className: "empty", children: "The lab has fewer than two parts long enough to be pieces. Bring sequences in on the Sequences tab." }) : (_jsxs("fieldset", { disabled: busy, className: "stack", children: [_jsxs("label", { children: ["Add a piece", _jsxs("select", { value: "", "aria-label": "Add a piece", onChange: (event) => { if (event.target.value !== "") {
101
+ setChosen([...chosen, event.target.value]);
102
+ setSaid(null);
103
+ } }, children: [_jsx("option", { value: "", children: "Choose a part\u2026" }), offered.map((one) => _jsxs("option", { value: one.checksum, children: [one.name, " \u00B7 ", count(one.length), " bp", one.circular ? " · circular" : ""] }, one.checksum))] })] }), _jsxs("label", { children: ["Overlap at each join", _jsx("input", { type: "number", min: 10, max: 80, step: 1, value: overlap, onChange: (event) => setOverlap(event.target.value), "aria-label": "Overlap in bases" }), " bases"] }), _jsxs("label", { children: ["Call the ring", _jsx("input", { value: name, onChange: (event) => setName(event.target.value), placeholder: made?.name ?? "", maxLength: 200, "aria-label": "What to call the ring" })] })] })), chosen.length > 0 && (_jsx("ol", { className: "pieces", children: chosen.map((one, at) => (_jsxs("li", { children: [_jsx("span", { children: nameOf(one) }), _jsxs("label", { className: "check small", children: [_jsx("input", { type: "checkbox", checked: !fixed.includes(one), onChange: (event) => { setFixed(event.target.checked ? fixed.filter((each) => each !== one) : [...fixed, one]); setSaid(null); } }), " amplify"] }), _jsx("button", { type: "button", className: "plain", onClick: () => move(at, -1), disabled: at === 0, "aria-label": `Move ${nameOf(one)} earlier`, children: "\u2191" }), _jsx("button", { type: "button", className: "plain", onClick: () => move(at, 1), disabled: at === chosen.length - 1, "aria-label": `Move ${nameOf(one)} later`, children: "\u2193" }), _jsx("button", { type: "button", className: "plain", onClick: () => { setChosen(chosen.filter((_, each) => each !== at)); setSaid(null); }, "aria-label": `Take ${nameOf(one)} out`, children: "take out" })] }, `${one} ${at}`))) })), design !== null && design.problem !== null && _jsx("p", { className: "trouble", role: "status", children: design.problem })] }), made !== null && (_jsxs(_Fragment, { children: [_jsxs("section", { className: "card", children: [_jsx("h2", { children: "The ring" }), _jsx("p", { className: "voice", children: "This design" }), _jsxs("p", { children: [_jsxs("strong", { children: [count(made.length), " bp"] }), " ", _jsxs("span", { className: "dim", children: ["circular \u00B7 ", made.pieces.length, " pieces \u00B7 ", made.junctions.length, " joins"] })] }), _jsx(SequenceMap, { name: made.name, length: made.length, circular: true, features: made.features, spans: made.pieces.map((one, at) => ({ start: one.start, end: one.end, label: one.part.name, strand: (at % 2 === 0 ? 1 : -1) })) }), _jsx("p", { className: "dim small", children: "What was marked on each piece is marked on the ring, where that piece now is." })] }), _jsxs("section", { className: "card", children: [_jsx("h2", { children: "The joins" }), _jsxs("table", { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "Between" }), _jsx("th", { children: "Overlap" }), _jsx("th", { children: "Melts near" }), _jsx("th", { children: "Carried by" })] }) }), _jsx("tbody", { children: made.junctions.map((one) => (_jsxs("tr", { children: [_jsxs("td", { children: [one.from, " \u2192 ", one.to] }), _jsx("td", { children: _jsxs("code", { children: [one.length, " bp"] }) }), _jsxs("td", { className: one.tm < 48 ? "attention" : undefined, children: [Math.round(one.tm), " \u00B0C"] }), _jsxs("td", { className: "dim small", children: [one.carried.toForward > 0 ? `${one.to}'s forward primer` : "", one.carried.toForward > 0 && one.carried.fromReverse > 0 ? " and " : "", one.carried.fromReverse > 0 ? `${one.from}'s reverse primer` : ""] })] }, `${one.from} ${one.to}`))) })] })] }), _jsxs("section", { className: "card", children: [_jsx("h2", { children: "The primers to order" }), made.primers.length === 0 ? _jsx("p", { className: "dim small", children: "Every piece is used as it is, so there is nothing to amplify and no primer to order." }) : (_jsxs(_Fragment, { children: [_jsxs("table", { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "Primer" }), _jsx("th", { children: "Tail" }), _jsx("th", { children: "Binds" }), _jsx("th", { children: "Melts near" })] }) }), _jsx("tbody", { children: made.primers.map((one) => (_jsxs("tr", { children: [_jsx("td", { children: one.name }), _jsx("td", { className: "dim", children: one.tail === "" ? "none" : `${one.tail.length} bases` }), _jsxs("td", { children: [one.binding.length, " bases"] }), _jsxs("td", { children: [Math.round(one.binding_report.tm), " \u00B0C"] })] }, one.name))) })] }), made.primers.map((one) => (_jsxs("p", { className: "small", children: [_jsx("strong", { children: one.name }), " ", _jsxs("code", { className: "wrap", children: [_jsx("span", { className: "dim", children: one.tail }), one.binding] })] }, one.name))), _jsx("p", { className: "dim small", children: "The tail is shown faint: it does not bind the template, it is the neighbour's end that makes the overlap. The annealing temperature comes from the binding part alone." }), _jsxs("fieldset", { disabled: busy, className: "row", children: [_jsx("button", { type: "button", onClick: () => void keep(), children: "Keep the primers as parts" }), _jsx("span", { className: "dim small", children: "No tubes: they have to be ordered." })] }), said !== null && _jsx("p", { className: "small", role: "status", children: said })] }))] }), made.warnings.length > 0 && (_jsxs("section", { className: "card", children: [_jsx("h2", { children: "Checks" }), _jsx("ul", { className: "checks", children: made.warnings.map((one) => _jsx("li", { className: "look", children: one }, one)) })] })), _jsxs("section", { className: "card", children: [_jsx("h2", { children: "The working" }), working.map((one) => _jsx(ShowWorking, { working: one }, one.of))] })] }))] }));
104
+ return { panel, desk };
105
+ }
106
+ /**
107
+ * The assembly design tool on its own, for a lab that has not drawn its room.
108
+ *
109
+ * @param props - `start` says what to open on.
110
+ */
111
+ export function AssemblyTool(props) {
112
+ return _jsx(_Fragment, { children: useAssemblyBench(props).panel });
113
+ }
114
+ //# sourceMappingURL=assembly-bench.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assembly-bench.js","sourceRoot":"","sources":["../src/assembly-bench.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,OAAO,EAA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AAC9C,CAAC"}
@@ -0,0 +1,119 @@
1
+ /**
2
+ * Designing an assembly over a lab's own parts: which pieces, in which order, and the primers that
3
+ * make them fit.
4
+ *
5
+ * A ligation joins pieces that have already been cut and whose ends happen to match. This is the
6
+ * other way round: you say what you want the ring to be made of, in order, and the primers are
7
+ * designed to give each piece the overlap it needs. That is what a construct is built by — a
8
+ * promoter, a signal, a gene and a terminator in a vector — and it is the step between having a
9
+ * sequence and having something that can be put into a cell.
10
+ *
11
+ * The designing itself is `designGibson` in `@biolibs/cloning`. What is here is everything that
12
+ * makes it the lab's: the parts it holds, what it would call the product, and the working behind
13
+ * every figure, so that nothing has to be taken on trust.
14
+ */
15
+ import { type DesignedJunction, type DesignedPrimer } from "@biolibs/cloning";
16
+ import type { PartFeature, PartState } from "@biolibs/bionet";
17
+ import type { ToolLab } from "./run.js";
18
+ import type { Working } from "./pcr-working.js";
19
+ /** The longest a designed ring may be, in bases. Past this it is not something to design in a window. */
20
+ export declare const LONGEST_RING = 200000;
21
+ /** One piece of a planned assembly, as the lab holds it. */
22
+ export interface AssemblyPiece {
23
+ /** The part, by checksum. */
24
+ part: string;
25
+ /**
26
+ * Whether it is to be amplified by PCR, and so can be given primer tails. A piece used as it is —
27
+ * a vector opened with an enzyme — cannot be, so its neighbours carry the whole overlap.
28
+ */
29
+ amplify: boolean;
30
+ }
31
+ /** What is being designed. */
32
+ export interface AssemblyChoice {
33
+ /** The pieces, in the order they go round the ring. At least two. */
34
+ pieces: readonly AssemblyPiece[];
35
+ /** The overlap to design at each junction, in bases. 25 unless said. */
36
+ overlap?: number;
37
+ /** The melting temperature each primer's binding part aims at, in °C. 60 unless said. */
38
+ targetTm?: number;
39
+ /** What to call the product. */
40
+ name?: string;
41
+ }
42
+ /** A piece of an assembly, placed on the ring. */
43
+ export interface AssemblyPlaced {
44
+ /** The part it is. */
45
+ part: PartState;
46
+ /** Whether it is amplified. */
47
+ amplify: boolean;
48
+ /** How many bases come before it on the ring. */
49
+ start: number;
50
+ /** One past its last base. */
51
+ end: number;
52
+ }
53
+ /** A designed assembly over a lab's parts. */
54
+ export interface AssemblyDesign {
55
+ /** The pieces, in order, each placed on the ring. */
56
+ pieces: AssemblyPlaced[];
57
+ /** The primers to order. */
58
+ primers: DesignedPrimer[];
59
+ /** The junctions, in the order they go round. */
60
+ junctions: DesignedJunction[];
61
+ /** The ring's bases. */
62
+ sequence: string;
63
+ /** How long it is. */
64
+ length: number;
65
+ /** What is marked on it: what each piece carried, moved to where that piece now is. */
66
+ features: PartFeature[];
67
+ /** What it would be called. */
68
+ name: string;
69
+ /** Anything a careful person would look at, worst first. */
70
+ warnings: string[];
71
+ /** Why it cannot be designed, or `null`. */
72
+ problem: string | null;
73
+ }
74
+ /** Parts worth offering as a piece: anything long enough to carry an overlap and a primer. */
75
+ export declare function assemblyParts(lab: Pick<ToolLab, "parts">, overlap?: number, shortest?: number): PartState[];
76
+ /**
77
+ * Design an assembly of a lab's parts.
78
+ *
79
+ * @param lab - The lab.
80
+ * @param choice - The pieces in order, and how to design them.
81
+ * @returns The design, with what it would make and what to watch for. `problem` says why if it
82
+ * could not be designed.
83
+ *
84
+ * @example
85
+ * ```ts
86
+ * import { designAssembly } from "@biolibs/bionet-tools";
87
+ *
88
+ * const design = designAssembly(lab, { pieces: [{ part: backbone, amplify: false }, { part: gene, amplify: true }] });
89
+ * design.length; // the ring, every piece end to end
90
+ * design.primers; // what to order
91
+ * ```
92
+ */
93
+ export declare function designAssembly(lab: Pick<ToolLab, "parts">, choice: AssemblyChoice): AssemblyDesign;
94
+ /**
95
+ * The working behind a designed assembly: where every figure comes from.
96
+ *
97
+ * @param design - The design.
98
+ * @returns One working for the ring's length, one for each junction, and one for each primer.
99
+ */
100
+ export declare function assemblyWorking(design: AssemblyDesign): Working[];
101
+ /**
102
+ * A designed assembly, as a run the lab would record.
103
+ *
104
+ * It is one run: the pieces go in, the ring comes out. The primers are not inputs, because they are
105
+ * used in the PCRs that make the pieces, which are runs of their own.
106
+ *
107
+ * @param design - The design.
108
+ * @param choice - The tubes of each piece, how much of each, and where it was done.
109
+ * @returns What to hand to the lab's `recordRun`, or `null` if there is nothing to record.
110
+ */
111
+ export declare function assemblyRun(design: AssemblyDesign, choice: {
112
+ tubes: Readonly<Record<string, string>>;
113
+ used?: Readonly<Record<string, number>>;
114
+ instrument?: string | null;
115
+ amount?: number;
116
+ unit?: string | null;
117
+ note?: string | null;
118
+ }): Record<string, unknown> | null;
119
+ //# sourceMappingURL=assembly-design.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assembly-design.d.ts","sourceRoot":"","sources":["../src/assembly-design.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAgB,KAAK,gBAAgB,EAAE,KAAK,cAAc,EAAqB,MAAM,kBAAkB,CAAC;AAC/G,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEhD,yGAAyG;AACzG,eAAO,MAAM,YAAY,SAAU,CAAC;AAEpC,4DAA4D;AAC5D,MAAM,WAAW,aAAa;IAC5B,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,8BAA8B;AAC9B,MAAM,WAAW,cAAc;IAC7B,qEAAqE;IACrE,MAAM,EAAE,SAAS,aAAa,EAAE,CAAC;IACjC,wEAAwE;IACxE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yFAAyF;IACzF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gCAAgC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,kDAAkD;AAClD,MAAM,WAAW,cAAc;IAC7B,sBAAsB;IACtB,IAAI,EAAE,SAAS,CAAC;IAChB,+BAA+B;IAC/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CAAC,CAAC,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3K,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAajC"}
@@ -0,0 +1,157 @@
1
+ /**
2
+ * Designing an assembly over a lab's own parts: which pieces, in which order, and the primers that
3
+ * make them fit.
4
+ *
5
+ * A ligation joins pieces that have already been cut and whose ends happen to match. This is the
6
+ * other way round: you say what you want the ring to be made of, in order, and the primers are
7
+ * designed to give each piece the overlap it needs. That is what a construct is built by — a
8
+ * promoter, a signal, a gene and a terminator in a vector — and it is the step between having a
9
+ * sequence and having something that can be put into a cell.
10
+ *
11
+ * The designing itself is `designGibson` in `@biolibs/cloning`. What is here is everything that
12
+ * makes it the lab's: the parts it holds, what it would call the product, and the working behind
13
+ * every figure, so that nothing has to be taken on trust.
14
+ */
15
+ import { designGibson } from "@biolibs/cloning";
16
+ import { carryFeatures } from "./sequence-file.js";
17
+ /** The longest a designed ring may be, in bases. Past this it is not something to design in a window. */
18
+ export const LONGEST_RING = 200_000;
19
+ const count = (value) => value.toLocaleString("en-US");
20
+ /** Parts worth offering as a piece: anything long enough to carry an overlap and a primer. */
21
+ export function assemblyParts(lab, overlap = 25, shortest = 18) {
22
+ return lab.parts.filter((one) => one.kind !== "protein" && one.length >= overlap + shortest);
23
+ }
24
+ /**
25
+ * Design an assembly of a lab's parts.
26
+ *
27
+ * @param lab - The lab.
28
+ * @param choice - The pieces in order, and how to design them.
29
+ * @returns The design, with what it would make and what to watch for. `problem` says why if it
30
+ * could not be designed.
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * import { designAssembly } from "@biolibs/bionet-tools";
35
+ *
36
+ * const design = designAssembly(lab, { pieces: [{ part: backbone, amplify: false }, { part: gene, amplify: true }] });
37
+ * design.length; // the ring, every piece end to end
38
+ * design.primers; // what to order
39
+ * ```
40
+ */
41
+ export function designAssembly(lab, choice) {
42
+ const nothing = (problem) => ({ pieces: [], primers: [], junctions: [], sequence: "", length: 0, features: [], name: "", warnings: [], problem });
43
+ const held = choice.pieces.map((one) => ({ piece: one, part: lab.parts.find((each) => each.checksum === one.part) }));
44
+ const missing = held.find((one) => one.part === undefined);
45
+ if (missing !== undefined)
46
+ return nothing("One of the pieces is not a part the lab has.");
47
+ const protein = held.filter((one) => one.part.kind === "protein");
48
+ if (protein.length > 0)
49
+ return nothing(`${protein.map((one) => one.part.name).join(" and ")} ${protein.length === 1 ? "is a protein" : "are proteins"}, which cannot be a piece of a ring of DNA.`);
50
+ if (held.length < 2)
51
+ return nothing("An assembly is of at least two pieces, in the order they go round the ring.");
52
+ const circles = held.filter((one) => one.part.circular && !one.piece.amplify);
53
+ if (circles.length > 0) {
54
+ return nothing(`${circles.map((one) => one.part.name).join(" and ")} ${circles.length === 1 ? "is a circle" : "are circles"}, which has no ends to join. Cut it first, or amplify it.`);
55
+ }
56
+ const whole = held.reduce((sum, one) => sum + one.part.length, 0);
57
+ if (whole > LONGEST_RING)
58
+ return nothing(`That would be ${count(whole)} bases, which is more than this designs in one go.`);
59
+ const designed = designGibson(held.map((one) => ({ name: one.part.name, residues: one.part.sequence, amplify: one.piece.amplify })), { ...(choice.overlap === undefined ? {} : { overlap: choice.overlap }), ...(choice.targetTm === undefined ? {} : { targetTm: choice.targetTm }) });
60
+ if (!designed.ok)
61
+ return nothing(designed.error);
62
+ const design = designed.design;
63
+ // Each piece goes on the ring where the pieces before it end, and takes what was marked on it there.
64
+ const pieces = [];
65
+ const features = [];
66
+ let sequence = "";
67
+ for (const { piece, part } of held) {
68
+ const start = sequence.length;
69
+ pieces.push({ part: part, amplify: piece.amplify, start, end: start + part.length });
70
+ for (const feature of carryFeatures(part.features, 0, part.length, start))
71
+ features.push(feature);
72
+ sequence += part.sequence;
73
+ }
74
+ const name = choice.name?.trim() !== undefined && choice.name.trim() !== "" ? choice.name.trim()
75
+ : held.map((one) => one.part.name).join(" + ");
76
+ return {
77
+ pieces, primers: design.primers, junctions: design.junctions, sequence, length: sequence.length,
78
+ features, name, warnings: [...design.warnings], problem: null,
79
+ };
80
+ }
81
+ /**
82
+ * The working behind a designed assembly: where every figure comes from.
83
+ *
84
+ * @param design - The design.
85
+ * @returns One working for the ring's length, one for each junction, and one for each primer.
86
+ */
87
+ export function assemblyWorking(design) {
88
+ if (design.problem !== null)
89
+ return [];
90
+ const out = [{
91
+ of: "the ring",
92
+ comes: `${count(design.length)} bases`,
93
+ kind: "exact",
94
+ steps: [
95
+ ...design.pieces.map((one) => `${one.part.name}: ${count(one.part.length)} bases, at ${count(one.start + 1)}–${count(one.end)}`),
96
+ `every piece end to end: ${design.pieces.map((one) => count(one.part.length)).join(" + ")} = ${count(design.length)}`,
97
+ "an overlap takes nothing away: it is the bases either side of a junction, which the primers' tails copy so the two products share them, and joining them puts each back once",
98
+ ],
99
+ }];
100
+ for (const junction of design.junctions) {
101
+ out.push({
102
+ of: `the join between ${junction.from} and ${junction.to}`,
103
+ comes: `${junction.length} bases, melting near ${Math.round(junction.tm)} °C`,
104
+ kind: "estimate",
105
+ steps: [
106
+ // A primer's tail reaches across the junction, so what each carries is its neighbour's
107
+ // bases: the forward primer of the second piece is what carries the end of the first.
108
+ `${junction.carried.toForward} bases from the end of ${junction.from}${junction.carried.toForward === 0 ? ", which contributes none here" : `, carried on ${junction.to}'s forward primer as a tail`}`,
109
+ `${junction.carried.fromReverse} bases from the start of ${junction.to}${junction.carried.fromReverse === 0 ? ", which contributes none here" : `, carried on ${junction.from}'s reverse primer as a tail`}`,
110
+ `the overlap the two products share: ${junction.overlap}`,
111
+ "its melting temperature: 2 °C for each A or T and 4 °C for each G or C, the rough figure written on a tube",
112
+ ],
113
+ rests: "The melting temperature is the Wallace rule, which is a guide and not a measurement.",
114
+ });
115
+ }
116
+ for (const primer of design.primers) {
117
+ out.push({
118
+ of: primer.name,
119
+ comes: `${primer.sequence.length} bases: a ${primer.tail.length}-base tail and a ${primer.binding.length}-base binding part`,
120
+ kind: "exact",
121
+ steps: [
122
+ `the tail: ${primer.tail === "" ? "none, since this end needs no overlap carried" : primer.tail}`,
123
+ `the part that binds: ${primer.binding}`,
124
+ `the annealing temperature comes from that part alone, which melts near ${Math.round(primer.binding_report.tm)} °C`,
125
+ `what is ordered: ${primer.sequence}`,
126
+ ],
127
+ });
128
+ }
129
+ return out;
130
+ }
131
+ /**
132
+ * A designed assembly, as a run the lab would record.
133
+ *
134
+ * It is one run: the pieces go in, the ring comes out. The primers are not inputs, because they are
135
+ * used in the PCRs that make the pieces, which are runs of their own.
136
+ *
137
+ * @param design - The design.
138
+ * @param choice - The tubes of each piece, how much of each, and where it was done.
139
+ * @returns What to hand to the lab's `recordRun`, or `null` if there is nothing to record.
140
+ */
141
+ export function assemblyRun(design, choice) {
142
+ if (design.problem !== null)
143
+ return null;
144
+ const inputs = design.pieces.flatMap((one) => {
145
+ const tube = choice.tubes[one.part.checksum];
146
+ return tube === undefined ? [] : [{ item: tube, amount: Math.max(0, Math.round(choice.used?.[tube] ?? 1)), role: "piece" }];
147
+ });
148
+ if (inputs.length !== design.pieces.length)
149
+ return null;
150
+ return {
151
+ kind: "assembly", instrument: choice.instrument ?? null, inputs,
152
+ outputs: [{ sequence: design.sequence, circular: true, name: design.name, amount: Math.max(0, Math.round(choice.amount ?? 20)), unit: choice.unit ?? "µL", features: design.features }],
153
+ settings: { pieces: design.pieces.length, joins: design.junctions.length, overlap: design.junctions[0]?.length ?? 0 },
154
+ outcome: "worked", note: choice.note ?? null,
155
+ };
156
+ }
157
+ //# sourceMappingURL=assembly-design.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assembly-design.js","sourceRoot":"","sources":["../src/assembly-design.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,YAAY,EAAiE,MAAM,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AAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IAC9H,CAAC,CAAC,CAAC;IACH,IAAI,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACxD,OAAO;QACL,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,IAAI,IAAI,EAAE,MAAM;QAC/D,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC;QACvL,QAAQ,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,IAAI,CAAC,EAAE;QACrH,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,IAAI;KAC7C,CAAC;AACJ,CAAC"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Writing a gene in a host's codons, at a desk.
3
+ *
4
+ * The whole of this tool turns on one thing being visible: where the host's preferences came from.
5
+ * There is no table built in and none is asserted. You choose which of the lab's own sequences are
6
+ * the host's genes, they are counted here, and the counts are on the screen beside the result. A
7
+ * table counted over three genes says so; a figure nobody can check is worse than no figure.
8
+ */
9
+ import { type ReactNode } from "react";
10
+ /** What a host is handed to draw beside the panel. */
11
+ export interface CodonDesk {
12
+ /** The tube of the gene being rewritten, to look at, if the lab has one that has been put somewhere. */
13
+ focus: {
14
+ place: string;
15
+ item: string;
16
+ } | null;
17
+ /** The rewritten sequence, once there is one. */
18
+ sequence: string | null;
19
+ }
20
+ /**
21
+ * Rewriting one of the lab's genes in a host's codons.
22
+ *
23
+ * @param options - `start` says what to open on, for a tour or a link.
24
+ * @returns `panel`, the tool itself, and `desk`, what a scene beside it should look at.
25
+ *
26
+ * @example
27
+ * ```tsx
28
+ * import { useCodonBench } from "@biolibs/bionet-tools";
29
+ *
30
+ * const bench = useCodonBench();
31
+ * <LabView lab={lab} wide beside={bench.panel} />
32
+ * ```
33
+ */
34
+ export declare function useCodonBench({ start }?: {
35
+ /** What to show: the gene, the host's genes, and sites to keep out. Followed whenever it changes. */
36
+ start?: {
37
+ gene?: string;
38
+ hostGenes?: readonly string[];
39
+ avoid?: readonly string[];
40
+ };
41
+ }): {
42
+ panel: ReactNode;
43
+ desk: CodonDesk;
44
+ };
45
+ /**
46
+ * The codon tool on its own, for a lab that has not drawn its room.
47
+ *
48
+ * @param props - `start` says what to open on.
49
+ */
50
+ export declare function CodonTool(props: Parameters<typeof useCodonBench>[0]): import("react").JSX.Element;
51
+ //# sourceMappingURL=codon-bench.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codon-bench.d.ts","sourceRoot":"","sources":["../src/codon-bench.tsx"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,OAAO,EAAgC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAUrE,sDAAsD;AACtD,MAAM,WAAW,SAAS;IACxB,wGAAwG;IACxG,KAAK,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC9C,iDAAiD;IACjD,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,GAAE;IACvC,qGAAqG;IACrG,KAAK,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;QAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,CAAC;CAChF,GAAG;IAAE,KAAK,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,SAAS,CAAA;CAAE,CAsI7C;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC,+BAEnE"}