@biolibs/bionet-tools 0.1.0 → 0.1.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.
Files changed (86) hide show
  1. package/README.md +183 -5
  2. package/dist/digest-bench.d.ts +76 -0
  3. package/dist/digest-bench.d.ts.map +1 -0
  4. package/dist/digest-bench.js +127 -0
  5. package/dist/digest-bench.js.map +1 -0
  6. package/dist/digest-tool.d.ts.map +1 -1
  7. package/dist/digest-tool.js +2 -1
  8. package/dist/digest-tool.js.map +1 -1
  9. package/dist/digest-working.d.ts +155 -0
  10. package/dist/digest-working.d.ts.map +1 -0
  11. package/dist/digest-working.js +216 -0
  12. package/dist/digest-working.js.map +1 -0
  13. package/dist/index.d.ts +24 -0
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +24 -0
  16. package/dist/index.js.map +1 -1
  17. package/dist/ligate-bench.d.ts +92 -0
  18. package/dist/ligate-bench.d.ts.map +1 -0
  19. package/dist/ligate-bench.js +139 -0
  20. package/dist/ligate-bench.js.map +1 -0
  21. package/dist/ligate-working.d.ts +96 -0
  22. package/dist/ligate-working.d.ts.map +1 -0
  23. package/dist/ligate-working.js +145 -0
  24. package/dist/ligate-working.js.map +1 -0
  25. package/dist/ligate.d.ts +152 -0
  26. package/dist/ligate.d.ts.map +1 -0
  27. package/dist/ligate.js +161 -0
  28. package/dist/ligate.js.map +1 -0
  29. package/dist/map.d.ts +69 -0
  30. package/dist/map.d.ts.map +1 -0
  31. package/dist/map.js +80 -0
  32. package/dist/map.js.map +1 -0
  33. package/dist/pcr-bench.d.ts +103 -0
  34. package/dist/pcr-bench.d.ts.map +1 -0
  35. package/dist/pcr-bench.js +211 -0
  36. package/dist/pcr-bench.js.map +1 -0
  37. package/dist/pcr-scene.d.ts +249 -0
  38. package/dist/pcr-scene.d.ts.map +1 -0
  39. package/dist/pcr-scene.js +287 -0
  40. package/dist/pcr-scene.js.map +1 -0
  41. package/dist/pcr-tool.d.ts.map +1 -1
  42. package/dist/pcr-tool.js +2 -1
  43. package/dist/pcr-tool.js.map +1 -1
  44. package/dist/pcr-working.d.ts +126 -0
  45. package/dist/pcr-working.d.ts.map +1 -0
  46. package/dist/pcr-working.js +175 -0
  47. package/dist/pcr-working.js.map +1 -0
  48. package/dist/run.d.ts +103 -5
  49. package/dist/run.d.ts.map +1 -1
  50. package/dist/run.js +132 -12
  51. package/dist/run.js.map +1 -1
  52. package/dist/sequence-file.d.ts +108 -0
  53. package/dist/sequence-file.d.ts.map +1 -0
  54. package/dist/sequence-file.js +145 -0
  55. package/dist/sequence-file.js.map +1 -0
  56. package/dist/sequences-tool.d.ts +13 -0
  57. package/dist/sequences-tool.d.ts.map +1 -0
  58. package/dist/sequences-tool.js +61 -0
  59. package/dist/sequences-tool.js.map +1 -0
  60. package/dist/tools.d.ts +7 -3
  61. package/dist/tools.d.ts.map +1 -1
  62. package/dist/tools.js +11 -5
  63. package/dist/tools.js.map +1 -1
  64. package/dist/working.d.ts +58 -0
  65. package/dist/working.d.ts.map +1 -0
  66. package/dist/working.js +55 -0
  67. package/dist/working.js.map +1 -0
  68. package/package.json +6 -2
  69. package/src/digest-bench.tsx +307 -0
  70. package/src/digest-tool.tsx +2 -1
  71. package/src/digest-working.ts +288 -0
  72. package/src/index.ts +24 -0
  73. package/src/ligate-bench.tsx +293 -0
  74. package/src/ligate-working.ts +182 -0
  75. package/src/ligate.ts +243 -0
  76. package/src/map.tsx +170 -0
  77. package/src/pcr-bench.tsx +403 -0
  78. package/src/pcr-scene.ts +410 -0
  79. package/src/pcr-tool.tsx +2 -1
  80. package/src/pcr-working.ts +228 -0
  81. package/src/run.ts +186 -14
  82. package/src/sequence-file.ts +172 -0
  83. package/src/sequences-tool.tsx +109 -0
  84. package/src/tools.tsx +15 -9
  85. package/src/working.tsx +96 -0
  86. package/tools.css +82 -0
@@ -0,0 +1,108 @@
1
+ /**
2
+ * Bringing a sequence in from the file a lab already has.
3
+ *
4
+ * Most labs keep their sequences as SnapGene or GenBank files, with the genes, promoters and origins
5
+ * already marked. This reads one into what a lab's freezer keeps of a part: a name, the bases,
6
+ * whether it is a circle, and what is marked on it. SnapGene's own format, GenBank, EMBL and FASTA
7
+ * are read, by `@biolibs/seqio`.
8
+ */
9
+ import type { PartFeature } from "@biolibs/bionet";
10
+ /** A sequence read from a file. */
11
+ export interface SequenceFile {
12
+ /** The file it came from. */
13
+ fileName: string;
14
+ /** What kind of file it was read as: `snapgene`, `genbank`, `embl` or `fasta`. */
15
+ format: string;
16
+ /** What the file calls the sequence. */
17
+ name: string;
18
+ /** What the file says about it. */
19
+ description: string;
20
+ /** The bases, in capitals. */
21
+ sequence: string;
22
+ /** Whether it is a circle. */
23
+ circular: boolean;
24
+ /** What is marked on it. */
25
+ features: PartFeature[];
26
+ }
27
+ /**
28
+ * What kind of sequence file something is, from its name or failing that from how it begins.
29
+ *
30
+ * @param name - The file's name.
31
+ * @param bytes - What is in it.
32
+ * @returns The format's name, or `null` if it is none this reads.
33
+ */
34
+ export declare function sequenceFormat(name: string, bytes: Uint8Array): string | null;
35
+ /**
36
+ * Read the first sequence in a file.
37
+ *
38
+ * @param name - The file's name.
39
+ * @param bytes - What is in it.
40
+ * @returns The sequence and what is marked on it.
41
+ * @throws If it is not a kind of file this reads, or holds no sequence.
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * import { readSequenceFile } from "@biolibs/bionet-tools";
46
+ *
47
+ * const read = readSequenceFile("pUC19.fa", new TextEncoder().encode(">pUC19\nGGATCACAGTCTACACTG\n"));
48
+ * read.name; // "pUC19"
49
+ * read.sequence; // "GGATCACAGTCTACACTG"
50
+ * ```
51
+ */
52
+ export declare function readSequenceFile(name: string, bytes: Uint8Array): SequenceFile;
53
+ /**
54
+ * What is marked on a stretch of a sequence, as it would be marked on that stretch alone.
55
+ *
56
+ * A PCR's product is a stretch of its template, so whatever was marked there is marked on the
57
+ * product, moved to where it now is. Something only partly inside is kept as far as it is inside,
58
+ * and its name says so, since half a gene is not the gene.
59
+ *
60
+ * @param features - What is marked on the whole sequence.
61
+ * @param from - Where the stretch starts.
62
+ * @param to - Where it stops.
63
+ * @param shift - How many bases the stretch is preceded by where it is going, such as a primer's tail.
64
+ * @returns What is marked on the stretch.
65
+ */
66
+ export declare function carryFeatures(features: readonly PartFeature[], from: number, to: number, shift?: number): PartFeature[];
67
+ /**
68
+ * What a kind of feature's colour means, in the theme's terms.
69
+ *
70
+ * @param type - The feature's type, as sequence files say it.
71
+ * @returns One of the theme's meanings.
72
+ */
73
+ export declare function featureTone(type: string): "yours" | "theirs" | "held" | "found" | "good" | "attention" | "dim";
74
+ /** A molecule as a scene draws one. It is the shape `@biolibs/bionet-scene` takes, so it can be handed straight over. */
75
+ export interface DrawnMolecule {
76
+ name: string;
77
+ length: number;
78
+ circular: boolean;
79
+ /** Each piece of each feature, with the theme's meaning for its colour. */
80
+ features: {
81
+ start: number;
82
+ end: number;
83
+ strand: -1 | 0 | 1;
84
+ tone: ReturnType<typeof featureTone>;
85
+ label: string;
86
+ }[];
87
+ }
88
+ /**
89
+ * A part as a molecule to draw in a scene.
90
+ *
91
+ * @param part - Its name, length, shape and what is marked on it.
92
+ * @returns The molecule, with each feature's pieces as stretches and its colour as a meaning.
93
+ *
94
+ * @example
95
+ * ```ts
96
+ * import { moleculeOf } from "@biolibs/bionet-tools";
97
+ *
98
+ * const drawn = moleculeOf({ name: "pUC19", length: 2686, circular: true, features: [{ type: "CDS", label: "bla", strand: -1, parts: [{ start: 1626, end: 2487 }] }] });
99
+ * drawn.features[0].tone; // "yours"
100
+ * ```
101
+ */
102
+ export declare function moleculeOf(part: {
103
+ name: string;
104
+ length: number;
105
+ circular: boolean;
106
+ features: readonly PartFeature[];
107
+ }): DrawnMolecule;
108
+ //# sourceMappingURL=sequence-file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sequence-file.d.ts","sourceRoot":"","sources":["../src/sequence-file.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO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AG,CAAC,GAAG,CAAC,CAAC;QAAC,IAAI,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACrH;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,SAAS,WAAW,EAAE,CAAA;CAAE,GAAG,aAAa,CAKrI"}
@@ -0,0 +1,145 @@
1
+ import { parse } from "@biolibs/seqio";
2
+ const TEXT_FORMATS = { gb: "genbank", gbk: "genbank", gbff: "genbank", genbank: "genbank", embl: "embl", fa: "fasta", fasta: "fasta", fna: "fasta" };
3
+ /**
4
+ * What kind of sequence file something is, from its name or failing that from how it begins.
5
+ *
6
+ * @param name - The file's name.
7
+ * @param bytes - What is in it.
8
+ * @returns The format's name, or `null` if it is none this reads.
9
+ */
10
+ export function sequenceFormat(name, bytes) {
11
+ const extension = name.split(".").pop()?.toLowerCase() ?? "";
12
+ if (extension === "dna")
13
+ return "snapgene";
14
+ if (Object.hasOwn(TEXT_FORMATS, extension))
15
+ return TEXT_FORMATS[extension];
16
+ if (bytes[0] === 0x09)
17
+ return "snapgene"; // every SnapGene file opens with a packet of type 9
18
+ const start = new TextDecoder().decode(bytes.slice(0, 16));
19
+ if (start.startsWith("LOCUS"))
20
+ return "genbank";
21
+ if (start.startsWith(">"))
22
+ return "fasta";
23
+ if (start.startsWith("ID "))
24
+ return "embl";
25
+ return null;
26
+ }
27
+ /**
28
+ * Read the first sequence in a file.
29
+ *
30
+ * @param name - The file's name.
31
+ * @param bytes - What is in it.
32
+ * @returns The sequence and what is marked on it.
33
+ * @throws If it is not a kind of file this reads, or holds no sequence.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * import { readSequenceFile } from "@biolibs/bionet-tools";
38
+ *
39
+ * const read = readSequenceFile("pUC19.fa", new TextEncoder().encode(">pUC19\nGGATCACAGTCTACACTG\n"));
40
+ * read.name; // "pUC19"
41
+ * read.sequence; // "GGATCACAGTCTACACTG"
42
+ * ```
43
+ */
44
+ export function readSequenceFile(name, bytes) {
45
+ const format = sequenceFormat(name, bytes);
46
+ if (format === null)
47
+ throw new Error("Could not tell what kind of file that is. SnapGene (.dna), GenBank (.gb), EMBL and FASTA are read.");
48
+ let record;
49
+ try {
50
+ // Binary formats take bytes and text formats take a string.
51
+ record = parse(format === "snapgene" ? bytes : new TextDecoder().decode(bytes), format)[Symbol.iterator]().next().value;
52
+ }
53
+ catch (cause) {
54
+ throw new Error(`That ${format} file could not be read: ${cause instanceof Error ? cause.message : String(cause)}`);
55
+ }
56
+ if (record === undefined || record === null || !record.seq)
57
+ throw new Error("That file holds no sequence.");
58
+ const sequence = String(record.seq).toUpperCase();
59
+ const whole = (position) => Number(position.position ?? position);
60
+ const first = (values) => (Array.isArray(values) && values.length > 0 ? String(values[0]) : undefined);
61
+ const features = [];
62
+ for (const feature of record.features) {
63
+ if (!feature.location || feature.type === "source")
64
+ continue;
65
+ const said = (key) => first(feature.qualifiers.get(key));
66
+ const parts = feature.location.parts.map((part) => ({ start: whole(part.start), end: whole(part.end) }))
67
+ .filter((part) => Number.isSafeInteger(part.start) && Number.isSafeInteger(part.end) && part.start >= 0 && part.end > part.start && part.end <= sequence.length);
68
+ if (parts.length === 0)
69
+ continue;
70
+ const strand = feature.location.strand === 1 ? 1 : feature.location.strand === -1 ? -1 : 0;
71
+ features.push({ type: String(feature.type).slice(0, 40), label: (said("label") ?? said("gene") ?? said("product") ?? said("note") ?? String(feature.type)).slice(0, 200), strand, parts });
72
+ }
73
+ const stem = name.replace(/\.[^.]+$/, "");
74
+ const called = record.name && record.name !== "<unknown name>" ? record.name : record.id && record.id !== "<unknown id>" ? record.id : stem;
75
+ return {
76
+ fileName: name, format, name: String(called || stem).slice(0, 200),
77
+ description: record.description === "<unknown description>" ? "" : String(record.description ?? ""),
78
+ sequence, circular: record.annotations.get("topology") === "circular", features,
79
+ };
80
+ }
81
+ /**
82
+ * What is marked on a stretch of a sequence, as it would be marked on that stretch alone.
83
+ *
84
+ * A PCR's product is a stretch of its template, so whatever was marked there is marked on the
85
+ * product, moved to where it now is. Something only partly inside is kept as far as it is inside,
86
+ * and its name says so, since half a gene is not the gene.
87
+ *
88
+ * @param features - What is marked on the whole sequence.
89
+ * @param from - Where the stretch starts.
90
+ * @param to - Where it stops.
91
+ * @param shift - How many bases the stretch is preceded by where it is going, such as a primer's tail.
92
+ * @returns What is marked on the stretch.
93
+ */
94
+ export function carryFeatures(features, from, to, shift = 0) {
95
+ const carried = [];
96
+ for (const feature of features) {
97
+ const inside = feature.parts.map((part) => ({ start: Math.max(part.start, from), end: Math.min(part.end, to) })).filter((part) => part.end > part.start);
98
+ if (inside.length === 0)
99
+ continue;
100
+ const whole = inside.length === feature.parts.length && inside.every((part, at) => part.start === feature.parts[at].start && part.end === feature.parts[at].end);
101
+ carried.push({ type: feature.type, strand: feature.strand, label: whole ? feature.label : `${feature.label} (part)`.slice(0, 200),
102
+ parts: inside.map((part) => ({ start: part.start - from + shift, end: part.end - from + shift })) });
103
+ }
104
+ return carried;
105
+ }
106
+ /**
107
+ * What a kind of feature's colour means, in the theme's terms.
108
+ *
109
+ * @param type - The feature's type, as sequence files say it.
110
+ * @returns One of the theme's meanings.
111
+ */
112
+ export function featureTone(type) {
113
+ switch (type) {
114
+ case "CDS":
115
+ case "gene": return "yours";
116
+ case "promoter": return "held";
117
+ case "terminator": return "attention";
118
+ case "rep_origin": return "theirs";
119
+ case "primer_bind": return "found";
120
+ case "misc_feature":
121
+ case "regulatory": return "good";
122
+ default: return "dim";
123
+ }
124
+ }
125
+ /**
126
+ * A part as a molecule to draw in a scene.
127
+ *
128
+ * @param part - Its name, length, shape and what is marked on it.
129
+ * @returns The molecule, with each feature's pieces as stretches and its colour as a meaning.
130
+ *
131
+ * @example
132
+ * ```ts
133
+ * import { moleculeOf } from "@biolibs/bionet-tools";
134
+ *
135
+ * const drawn = moleculeOf({ name: "pUC19", length: 2686, circular: true, features: [{ type: "CDS", label: "bla", strand: -1, parts: [{ start: 1626, end: 2487 }] }] });
136
+ * drawn.features[0].tone; // "yours"
137
+ * ```
138
+ */
139
+ export function moleculeOf(part) {
140
+ return {
141
+ name: part.name, length: part.length, circular: part.circular,
142
+ features: part.features.flatMap((feature) => feature.parts.map((piece) => ({ start: piece.start, end: piece.end, strand: feature.strand, tone: featureTone(feature.type), label: feature.label }))),
143
+ };
144
+ }
145
+ //# sourceMappingURL=sequence-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sequence-file.js","sourceRoot":"","sources":["../src/sequence-file.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAoBvC,MAAM,YAAY,GAAqC,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC;AAEvL;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,KAAiB;IAC5D,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;IAC7D,IAAI,SAAS,KAAK,KAAK;QAAE,OAAO,UAAU,CAAC;IAC3C,IAAI,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,SAAS,CAAC;QAAE,OAAO,YAAY,CAAC,SAAS,CAAE,CAAC;IAC5E,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI;QAAE,OAAO,UAAU,CAAC,CAAY,oDAAoD;IACzG,MAAM,KAAK,GAAG,IAAI,WAAW,EAAE,CA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K,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;KACpM,CAAC;AACJ,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Bring sequences in from files, and look at any part the lab has as a map.
3
+ *
4
+ * Choosing files adds each as a part, with the name, the shape and the features the file gives it.
5
+ * SnapGene's own files, GenBank, EMBL and FASTA are read. A part is known by its sequence, so
6
+ * bringing in one the lab already has adds nothing but what is marked on it.
7
+ *
8
+ * @param props - `part` is the checksum of the part to open on.
9
+ */
10
+ export declare function SequencesTool({ part: first }: {
11
+ part?: string;
12
+ }): import("react").JSX.Element | null;
13
+ //# sourceMappingURL=sequences-tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sequences-tool.d.ts","sourceRoot":"","sources":["../src/sequences-tool.tsx"],"names":[],"mappings":"AAkBA;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,sCAiF/D"}
@@ -0,0 +1,61 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ /**
4
+ * A lab's sequences: bringing them in from the files it already has, and reading one as a map.
5
+ *
6
+ * This is the part of a sequence editor most people use most: open a construct, see what is on it,
7
+ * see where the enzymes cut. Here the construct is a part in the lab's freezer, so what is being
8
+ * looked at is something the lab holds, and what is brought in is added to what it holds.
9
+ */
10
+ import { useMemo, useState } from "react";
11
+ import { useAct, useLab } from "@biolibs/bionet-react";
12
+ import { endsWords } from "@biolibs/bionet-panels";
13
+ import { cutters } from "./digest.js";
14
+ import { SequenceMap } from "./map.js";
15
+ import { featureTone, readSequenceFile } from "./sequence-file.js";
16
+ const count = (value) => value.toLocaleString("en-US");
17
+ /**
18
+ * Bring sequences in from files, and look at any part the lab has as a map.
19
+ *
20
+ * Choosing files adds each as a part, with the name, the shape and the features the file gives it.
21
+ * SnapGene's own files, GenBank, EMBL and FASTA are read. A part is known by its sequence, so
22
+ * bringing in one the lab already has adds nothing but what is marked on it.
23
+ *
24
+ * @param props - `part` is the checksum of the part to open on.
25
+ */
26
+ export function SequencesTool({ part: first }) {
27
+ const lab = useLab()?.lab;
28
+ const act = useAct();
29
+ const [chosen, setChosen] = useState(first ?? null);
30
+ const [said, setSaid] = useState([]);
31
+ const [busy, setBusy] = useState(false);
32
+ const [once, setOnce] = useState(true);
33
+ const part = lab?.parts.find((one) => one.checksum === chosen) ?? lab?.parts[0];
34
+ const cuts = useMemo(() => (part === undefined ? [] : cutters(part)), [part]);
35
+ if (lab === null || lab === undefined)
36
+ return null;
37
+ // On a map, the enzymes worth naming are the ones that cut once or twice: those are the ones to cut with.
38
+ const shown = cuts.filter((one) => one.positions.length <= (once ? 1 : 2));
39
+ const tubes = part === undefined ? 0 : lab.items.filter((item) => item.part === part.checksum && !item.retired).length;
40
+ const bring = async (files) => {
41
+ if (files === null || files.length === 0)
42
+ return;
43
+ setBusy(true);
44
+ const lines = [];
45
+ for (const file of Array.from(files)) {
46
+ try {
47
+ const read = readSequenceFile(file.name, new Uint8Array(await file.arrayBuffer()));
48
+ const answer = await act("addPart", { name: read.name, sequence: read.sequence, circular: read.circular, features: read.features });
49
+ lines.push(answer.ok ? `${read.name}: ${count(read.sequence.length)} bp, ${read.circular ? "circular" : "linear"}, ${read.features.length} ${read.features.length === 1 ? "feature" : "features"}, from ${read.format}`
50
+ : `${file.name}: ${answer.error}`);
51
+ }
52
+ catch (cause) {
53
+ lines.push(`${file.name}: ${cause instanceof Error ? cause.message : String(cause)}`);
54
+ }
55
+ }
56
+ setSaid(lines);
57
+ setBusy(false);
58
+ };
59
+ return (_jsxs("div", { className: "pcr sequences", children: [_jsxs("section", { className: "card", children: [_jsx("h2", { children: "Bring sequences in" }), _jsx("p", { className: "dim small", children: "Choose SnapGene (.dna), GenBank (.gb), EMBL or FASTA files. Each becomes a part in the freezer, with what the file marks on it. Add a tube of it on the Freezer tab when there is one." }), _jsx("input", { type: "file", multiple: true, disabled: busy, accept: ".dna,.gb,.gbk,.gbff,.genbank,.embl,.fa,.fasta,.fna", "aria-label": "Sequence files", onChange: (event) => { void bring(event.target.files); event.target.value = ""; } }), said.length > 0 && _jsx("ul", { className: "plainlist small", role: "status", children: said.map((line) => _jsx("li", { children: line }, line)) })] }), part === undefined ? _jsx("p", { className: "empty", children: "The lab has no parts yet." }) : (_jsxs("section", { className: "card", children: [_jsxs("div", { className: "toolhead", children: [_jsxs("label", { children: ["Part", _jsx("select", { value: part.checksum, onChange: (event) => setChosen(event.target.value), "aria-label": "Part", children: lab.parts.map((one) => _jsxs("option", { value: one.checksum, children: [one.name, " \u00B7 ", count(one.length), " bp", one.circular ? " · circular" : ""] }, one.checksum)) })] }), endsWords(part) !== null && _jsxs("span", { className: "small", children: ["ends ", _jsx("code", { children: endsWords(part) })] }), _jsx("span", { className: "dim small", children: tubes === 0 ? "no tubes of it" : `${tubes} ${tubes === 1 ? "tube" : "tubes"} of it` })] }), _jsxs("div", { className: "mapped", children: [_jsx(SequenceMap, { name: part.name, length: part.length, circular: part.circular, features: part.features, marks: shown.flatMap((one) => one.positions.map((at) => ({ at, label: one.name }))) }), _jsxs("div", { children: [_jsxs("table", { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "Feature" }), _jsx("th", { children: "Type" }), _jsx("th", { children: "Where" }), _jsx("th", { children: "Strand" })] }) }), _jsxs("tbody", { children: [part.features.map((feature, at) => (_jsxs("tr", { children: [_jsxs("td", { children: [_jsx("span", { className: `swatch tone-${featureTone(feature.type)}` }), feature.label] }), _jsx("td", { className: "dim", children: feature.type }), _jsx("td", { children: _jsx("code", { children: feature.parts.map((piece) => `${count(piece.start + 1)}..${count(piece.end)}`).join(", ") }) }), _jsx("td", { className: "dim", children: feature.strand === 1 ? "forward" : feature.strand === -1 ? "reverse" : "—" })] }, at))), part.features.length === 0 && _jsx("tr", { children: _jsx("td", { colSpan: 4, className: "dim", children: "Nothing is marked on this part. A part brought in from a SnapGene or GenBank file keeps what the file marks." }) })] })] }), _jsxs("p", { className: "small", children: [_jsx("strong", { children: "Cuts once:" }), " ", cuts.filter((one) => one.positions.length === 1).map((one) => one.name).join(", ") || "none of the usual enzymes", cuts.some((one) => one.positions.length === 2) && _jsxs(_Fragment, { children: [" \u00B7 ", _jsx("strong", { children: "twice:" }), " ", cuts.filter((one) => one.positions.length === 2).map((one) => one.name).join(", ")] })] }), _jsxs("label", { className: "check small", children: [_jsx("input", { type: "checkbox", checked: !once, onChange: (event) => setOnce(!event.target.checked) }), " Mark the ones that cut twice as well"] })] })] })] }))] }));
60
+ }
61
+ //# sourceMappingURL=sequences-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sequences-tool.js","sourceRoot":"","sources":["../src/sequences-tool.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb;;;;;;GAMG;AACH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEnE,MAAM,KAAK,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;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AAC,GAAG,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,CAAC,IAAI,0CAAK,sCAAuB,OAAE,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IACrK,EACJ,iBAAO,SAAS,EAAC,aAAa,aAAC,gBAAO,IAAI,EAAC,UAAU,EAAC,OAAO,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAAI,6CAA6C,IACtK,IACF,IACE,CACX,IACG,CACP,CAAC;AACJ,CAAC"}
package/dist/tools.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ /** Getting to a tool: from the instrument it is used at, or from a list of them all. */
2
+ import { type ReactNode } from "react";
1
3
  import { type ToolName } from "./run.js";
2
4
  /** What each tool is called. */
3
5
  export declare const TOOL_NAMES: Readonly<Record<ToolName, string>>;
@@ -15,9 +17,11 @@ export declare function InstrumentTool({ place, onDone }: {
15
17
  *
16
18
  * A run is still recorded as done at the instrument for that tool, if the lab has placed one.
17
19
  *
18
- * @param props - `tool` is which to open on.
20
+ * @param props - `tool` is which to open on, `sequences` being the lab's sequences and their maps; `views` lets a host show a tool its own way, such as
21
+ * at its instrument in a scene, in place of the plain form.
19
22
  */
20
- export declare function Tools({ tool: first }: {
21
- tool?: ToolName;
23
+ export declare function Tools({ tool: first, views }: {
24
+ tool?: ToolName | "sequences";
25
+ views?: Partial<Record<ToolName, ReactNode>>;
22
26
  }): import("react").JSX.Element | null;
23
27
  //# sourceMappingURL=tools.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.tsx"],"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} from "@biolibs/bionet-react";
6
6
  import { DigestTool } from "./digest-tool.js";
7
7
  import { PcrTool } from "./pcr-tool.js";
8
8
  import { instrumentFor, toolFor } from "./run.js";
9
+ import { LigationTool } from "./ligate-bench.js";
10
+ import { SequencesTool } from "./sequences-tool.js";
9
11
  /** What each tool is called. */
10
- export const TOOL_NAMES = { pcr: "PCR", digest: "Digest and gel" };
12
+ export const TOOL_NAMES = { pcr: "PCR", digest: "Digest and gel", ligation: "Ligation" };
11
13
  function Tool({ tool, instrument, onDone }) {
12
14
  const more = onDone === undefined ? {} : { onDone };
13
- return tool === "pcr" ? _jsx(PcrTool, { instrument: instrument, ...more }) : _jsx(DigestTool, { instrument: instrument, ...more });
15
+ return tool === "pcr" ? _jsx(PcrTool, { instrument: instrument, ...more })
16
+ : tool === "ligation" ? _jsx(LigationTool, { instrument: instrument, ...more })
17
+ : _jsx(DigestTool, { instrument: instrument, ...more });
14
18
  }
15
19
  /**
16
20
  * The tool an instrument opens.
@@ -32,13 +36,15 @@ export function InstrumentTool({ place, onDone }) {
32
36
  *
33
37
  * A run is still recorded as done at the instrument for that tool, if the lab has placed one.
34
38
  *
35
- * @param props - `tool` is which to open on.
39
+ * @param props - `tool` is which to open on, `sequences` being the lab's sequences and their maps; `views` lets a host show a tool its own way, such as
40
+ * at its instrument in a scene, in place of the plain form.
36
41
  */
37
- export function Tools({ tool: first = "pcr" }) {
42
+ export function Tools({ tool: first = "pcr", views = {} }) {
38
43
  const lab = useLab()?.lab;
39
44
  const [tool, setTool] = useState(first);
40
45
  if (lab === null || lab === undefined)
41
46
  return null;
42
- return (_jsxs("div", { className: "tools", children: [_jsx("div", { className: "row tight pick", role: "tablist", "aria-label": "Tools", children: Object.keys(TOOL_NAMES).map((one) => (_jsx("button", { type: "button", role: "tab", "aria-selected": one === tool, className: one === tool ? "" : "quiet", onClick: () => setTool(one), children: TOOL_NAMES[one] }, one))) }), _jsx(Tool, { tool: tool, instrument: instrumentFor(lab, tool) }, tool)] }));
47
+ const names = [["sequences", "Sequences"], ...Object.keys(TOOL_NAMES).map((one) => [one, TOOL_NAMES[one]])];
48
+ return (_jsxs("div", { className: "tools", children: [_jsx("div", { className: "row tight pick", role: "tablist", "aria-label": "Tools", children: names.map(([one, name]) => (_jsx("button", { type: "button", role: "tab", "aria-selected": one === tool, className: one === tool ? "" : "quiet", onClick: () => setTool(one), children: name }, one))) }), tool === "sequences" ? _jsx(SequencesTool, {}) : views[tool] ?? _jsx(Tool, { tool: tool, instrument: instrumentFor(lab, tool) }, tool)] }));
43
49
  }
44
50
  //# sourceMappingURL=tools.js.map
package/dist/tools.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,wFAAwF;AACxF,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAiB,MAAM,UAAU,CAAC;AAEjE,gCAAgC;AAChC,MAAM,CAAC,MAAM,UAAU,GAAuC,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC;AAEvG,SAAS,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAA0G;IAChJ,MAAM,IAAI,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;IACpD,OAAO,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,KAAC,OAAO,IAAC,UAAU,EAAE,UAAU,KAAM,IAAI,GAAI,CAAC,CAAC,CAAC,KAAC,UAAU,IAAC,UAAU,EAAE,UAAU,KAAM,IAAI,GAAI,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AK,WAAW,CAAC,CAAC,CAAC,KAAC,aAAa,KAAG,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,KAAC,IAAI,IAAY,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC,IAAtD,IAAI,CAAsD,IAC5H,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * The working, drawn: a figure that opens to show the steps that give it.
3
+ *
4
+ * It is shut until asked for, so a tool reads the same as before to somebody who trusts it, and
5
+ * opens to somebody who wants to follow it. Whether a figure is exact or an estimate is said on the
6
+ * outside, since that is worth knowing without opening anything.
7
+ */
8
+ import type { ReactNode } from "react";
9
+ import type { CutSite } from "./digest-working.js";
10
+ import type { JoinOverhangs } from "./ligate-working.js";
11
+ import type { BindingWorking, Working } from "./pcr-working.js";
12
+ /**
13
+ * One figure and its working.
14
+ *
15
+ * @param props - `working` is the figure; `children` is drawn under the steps, for a table or a picture that goes with them.
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * import { ShowWorking, tmWorking } from "@biolibs/bionet-tools";
20
+ *
21
+ * const working = tmWorking("fwd", "GGATCACAGTCTACACTG");
22
+ * {working !== null && <ShowWorking working={working} />}
23
+ * ```
24
+ */
25
+ export declare function ShowWorking({ working, children }: {
26
+ working: Working;
27
+ children?: ReactNode;
28
+ }): import("react").JSX.Element;
29
+ /**
30
+ * A primer laid against the strand it binds, each base over the one it faces.
31
+ *
32
+ * The primer is written 5′ to 3′. A line joins each pair that holds. The bases at the 3′ end that
33
+ * must pair are underlined, and a tail that does not bind stands apart from the strand.
34
+ *
35
+ * @param props - `working` is from `bindingWorking`; `name` is what the primer is called.
36
+ */
37
+ export declare function FacedBases({ working, name }: {
38
+ working: BindingWorking;
39
+ name: string;
40
+ }): import("react").JSX.Element;
41
+ /**
42
+ * A cut, drawn in the bases it is made in: both strands, the recognised bases marked, and a bar
43
+ * where each strand is cut.
44
+ *
45
+ * @param props - `site` is from `cutSites`.
46
+ */
47
+ export declare function CutBases({ site }: {
48
+ site: CutSite;
49
+ }): import("react").JSX.Element;
50
+ /**
51
+ * Two ends of a ligation written one over the other, so that the pairing can be read.
52
+ *
53
+ * @param props - `bases` is from `joinWorking`.
54
+ */
55
+ export declare function JoinBases({ bases }: {
56
+ bases: JoinOverhangs;
57
+ }): import("react").JSX.Element;
58
+ //# sourceMappingURL=working.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"working.d.ts","sourceRoot":"","sources":["../src/working.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAa,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3E;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,+BAY5F;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IAAE,OAAO,EAAE,cAAc,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,+BAUtF;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,+BAYnD;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,aAAa,CAAA;CAAE,+BAW5D"}
@@ -0,0 +1,55 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * One figure and its working.
4
+ *
5
+ * @param props - `working` is the figure; `children` is drawn under the steps, for a table or a picture that goes with them.
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * import { ShowWorking, tmWorking } from "@biolibs/bionet-tools";
10
+ *
11
+ * const working = tmWorking("fwd", "GGATCACAGTCTACACTG");
12
+ * {working !== null && <ShowWorking working={working} />}
13
+ * ```
14
+ */
15
+ export function ShowWorking({ working, children }) {
16
+ return (_jsxs("details", { className: "working", children: [_jsxs("summary", { children: [_jsx("span", { className: "of", children: working.of }), " ", _jsx("strong", { children: working.comes }), _jsx("span", { className: `kind ${working.kind}`, title: working.kind === "exact" ? "This follows from the sequences alone." : "This rests on a rule of thumb. A different rule would give a different figure.", children: working.kind })] }), _jsx("ol", { children: working.steps.map((step) => _jsx("li", { children: step }, step)) }), children, working.rests !== undefined && _jsx("p", { className: "rests", children: working.rests })] }));
17
+ }
18
+ /**
19
+ * A primer laid against the strand it binds, each base over the one it faces.
20
+ *
21
+ * The primer is written 5′ to 3′. A line joins each pair that holds. The bases at the 3′ end that
22
+ * must pair are underlined, and a tail that does not bind stands apart from the strand.
23
+ *
24
+ * @param props - `working` is from `bindingWorking`; `name` is what the primer is called.
25
+ */
26
+ export function FacedBases({ working, name }) {
27
+ const says = `${name}, 5′ to 3′, against the ${working.strand} strand: ${working.faced.filter((one) => one.pairs).length} of ${working.faced.length} bases pair.`;
28
+ const cell = (base, extra = "") => _jsx("span", { className: `base base-${base.toLowerCase() || "none"} ${extra}`, children: base || "·" });
29
+ return (_jsxs("div", { className: "faced", role: "img", "aria-label": says, children: [_jsxs("div", { className: "row", children: [_jsx("span", { className: "end", children: "5\u2032" }), working.faced.map((one, at) => _jsx("span", { children: cell(one.primer, one.needed ? "needed" : "") }, at)), _jsxs("span", { className: "end", children: ["3\u2032 ", name] })] }), _jsxs("div", { className: "row", children: [_jsx("span", { className: "end" }), working.faced.map((one, at) => _jsx("span", { className: one.pairs ? "bond" : "bond none", children: one.pairs ? "|" : " " }, at)), _jsx("span", { className: "end" })] }), _jsxs("div", { className: "row", children: [_jsx("span", { className: "end", children: "3\u2032" }), working.faced.map((one, at) => _jsx("span", { children: cell(one.faces) }, at)), _jsxs("span", { className: "end", children: ["5\u2032 ", working.strand, " strand"] })] })] }));
30
+ }
31
+ /**
32
+ * A cut, drawn in the bases it is made in: both strands, the recognised bases marked, and a bar
33
+ * where each strand is cut.
34
+ *
35
+ * @param props - `site` is from `cutSites`.
36
+ */
37
+ export function CutBases({ site }) {
38
+ const { top, bottom, site: [start, end], cutTop, cutBottom } = site.around;
39
+ const says = `${site.enzyme} at base ${site.at.toLocaleString("en-US")}: it recognises ${site.recognises} and leaves ${site.overhang === "blunt" ? "a blunt end" : `a ${site.overhang} overhang of ${site.bases}`}.`;
40
+ const row = (bases, cut) => [...bases].map((base, at) => (_jsx("span", { className: `base base-${base.toLowerCase()}${at >= start && at < end ? " site" : ""}${at === cut ? " cut" : ""}`, children: base }, at)));
41
+ return (_jsxs("div", { className: "faced cutbases", role: "img", "aria-label": says, children: [_jsxs("div", { className: "row", children: [_jsx("span", { className: "end", children: "5\u2032" }), row(top, cutTop), _jsx("span", { className: "end", children: "3\u2032 top" })] }), _jsxs("div", { className: "row", children: [_jsx("span", { className: "end", children: "3\u2032" }), row(bottom, cutBottom), _jsx("span", { className: "end", children: "5\u2032 bottom" })] })] }));
42
+ }
43
+ /**
44
+ * Two ends of a ligation written one over the other, so that the pairing can be read.
45
+ *
46
+ * @param props - `bases` is from `joinWorking`.
47
+ */
48
+ export function JoinBases({ bases }) {
49
+ if (bases.kind === "blunt")
50
+ return _jsx("p", { className: "faced blunt", children: "Both ends are blunt, so there is nothing to pair: ligase seals them as they meet." });
51
+ const says = `${bases.from}'s ${bases.kind} overhang ${bases.left} against ${bases.to}'s ${bases.right}.`;
52
+ const row = (text) => [...text].map((base, at) => _jsx("span", { className: `base base-${base.toLowerCase()}`, children: base }, at));
53
+ return (_jsxs("div", { className: "faced", role: "img", "aria-label": says, children: [_jsxs("div", { className: "row", children: [_jsx("span", { className: "end", children: bases.from }), row(bases.left), _jsx("span", { className: "end" })] }), _jsxs("div", { className: "row", children: [_jsx("span", { className: "end" }), [...bases.left].map((base, at) => _jsx("span", { className: "bond", children: "|" }, at)), _jsx("span", { className: "end" })] }), _jsxs("div", { className: "row", children: [_jsx("span", { className: "end", children: bases.to }), row(bases.right), _jsx("span", { className: "end" })] })] }));
54
+ }
55
+ //# sourceMappingURL=working.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"working.js","sourceRoot":"","sources":["../src/working.tsx"],"names":[],"mappings":";AAYA;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,WAAW,CAAC,EAAE,OAAO,EAAE,QAAQ,EAA8C;IAC3F,OAAO,CACL,mBAAS,SAAS,EAAC,SAAS,aAC1B,8BACE,eAAM,SAAS,EAAC,IAAI,YAAE,OAAO,CAAC,EAAE,GAAQ,OAAC,2BAAS,OAAO,CAAC,KAAK,GAAU,EACzE,eAAM,SAAS,EAAE,QAAQ,OAAO,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,wCAAwC,CAAC,CAAC,CAAC,gFAAgF,YAAG,OAAO,CAAC,IAAI,GAAQ,IACrN,EACV,uBAAK,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,uBAAgB,IAAI,IAAX,IAAI,CAAa,CAAC,GAAM,EACjE,QAAQ,EACR,OAAO,CAAC,KAAK,KAAK,SAAS,IAAI,YAAG,SAAS,EAAC,OAAO,YAAE,OAAO,CAAC,KAAK,GAAK,IAChE,CACX,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU,CAAC,EAAE,OAAO,EAAE,IAAI,EAA6C;IACrF,MAAM,IAAI,GAAG,GAAG,IAAI,2BAA2B,OAAO,CAAC,MAAM,YAAY,OAAO,CAAC,KAAK,CAAC,MAAM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AAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,CAAC,eAAe,SAAS,EAAC,MAAM,mBAApB,EAAE,CAA2B,CAAC,EAAC,eAAM,SAAS,EAAC,KAAK,GAAG,IAAM,EACxJ,eAAK,SAAS,EAAC,KAAK,aAAC,eAAM,SAAS,EAAC,KAAK,YAAE,KAAK,CAAC,EAAE,GAAQ,EAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,EAAC,eAAM,SAAS,EAAC,KAAK,GAAG,IAAM,IACxG,CACP,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -4,13 +4,17 @@
4
4
  },
5
5
  "dependencies": {
6
6
  "@biolibs/assembly2": "^1.0.0",
7
- "@biolibs/bionet": "^1.3.1",
7
+ "@biolibs/bionet": "^1.3.2",
8
8
  "@biolibs/bionet-panels": "^0.3.1",
9
9
  "@biolibs/bionet-react": "^0.2.0",
10
+ "@biolibs/dseq": "^1.0.0",
10
11
  "@biolibs/dseqrecord": "^1.1.1",
11
12
  "@biolibs/gel": "^1.0.0",
13
+ "@biolibs/glossary-react": "^0.1.0",
12
14
  "@biolibs/restriction": "^1.0.0",
13
15
  "@biolibs/seq": "^1.0.0",
16
+ "@biolibs/seqio": "^1.1.2",
17
+ "@biolibs/seqmap": "^1.0.0",
14
18
  "@biolibs/seqtools": "^1.0.0"
15
19
  },
16
20
  "description": "The tools a lab uses at the bench, tied to its freezer: PCR and a check digest with its gel, run in silico from the tubes it holds and recorded, so what was used is taken and what was made becomes a tube",
@@ -58,5 +62,5 @@
58
62
  ],
59
63
  "type": "module",
60
64
  "types": "dist/index.d.ts",
61
- "version": "0.1.0"
65
+ "version": "0.1.2"
62
66
  }