@biolibs/bionet-tools 0.1.9 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +79 -2
- package/dist/digest-tool.d.ts +12 -3
- package/dist/digest-tool.d.ts.map +1 -1
- package/dist/digest-tool.js +10 -4
- package/dist/digest-tool.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/induce-bench.d.ts +91 -0
- package/dist/induce-bench.d.ts.map +1 -0
- package/dist/induce-bench.js +201 -0
- package/dist/induce-bench.js.map +1 -0
- package/dist/induce.d.ts +280 -0
- package/dist/induce.d.ts.map +1 -0
- package/dist/induce.js +353 -0
- package/dist/induce.js.map +1 -0
- package/dist/modify.d.ts +197 -0
- package/dist/modify.d.ts.map +1 -0
- package/dist/modify.js +253 -0
- package/dist/modify.js.map +1 -0
- package/dist/protein.d.ts.map +1 -1
- package/dist/protein.js +3 -1
- package/dist/protein.js.map +1 -1
- package/dist/run.d.ts +1 -1
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +1 -1
- package/dist/run.js.map +1 -1
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +5 -3
- package/dist/tools.js.map +1 -1
- package/package.json +4 -4
- package/src/digest-tool.tsx +14 -5
- package/src/index.ts +6 -0
- package/src/induce-bench.tsx +406 -0
- package/src/induce.ts +448 -0
- package/src/modify.ts +350 -0
- package/src/protein.ts +3 -1
- package/src/run.ts +2 -2
- package/src/tools.tsx +4 -2
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* An induction and its gel, at the shaking incubator.
|
|
5
|
+
*
|
|
6
|
+
* The incubator shows a temperature, a speed and a time. It shows nothing of what the cells are
|
|
7
|
+
* doing, and nothing in this file pretends it does: the first three views are what is there to be
|
|
8
|
+
* read off the machine, the fourth is the gene the operator has to picture being read, and the fifth
|
|
9
|
+
* is the gel, which is where the answer actually comes from.
|
|
10
|
+
*
|
|
11
|
+
* The one place this tool differs from the others is the last step. A PCR's product is arithmetic,
|
|
12
|
+
* so the bench can offer to keep it. A culture's product is not: the band is there or it is not, and
|
|
13
|
+
* only the person holding the gel knows which. So both buttons record the run, and only one of them
|
|
14
|
+
* goes on to put a protein in the freezer.
|
|
15
|
+
*/
|
|
16
|
+
import { useEffect, useMemo, useState, type ReactNode } from "react";
|
|
17
|
+
import { PROTEIN_GELS, PROTEIN_LADDERS } from "@biolibs/gel";
|
|
18
|
+
import { useAct, useLab } from "@biolibs/bionet-react";
|
|
19
|
+
import { Glossed } from "@biolibs/glossary-react";
|
|
20
|
+
import { Gel } from "./digest-tool.js";
|
|
21
|
+
import { INDUCTION, USUAL_PROTEIN_GEL, inductionChecks, inductionCultures, inductionGenes, inductionRun, inductionWorking, markerFor } from "./induce.js";
|
|
22
|
+
import { SequenceMap } from "./map.js";
|
|
23
|
+
import { Proposed, withPlan, type Plan } from "./plans.js";
|
|
24
|
+
import { useRunning } from "./running.js";
|
|
25
|
+
import { moleculeOf, type DrawnMolecule } from "./sequence-file.js";
|
|
26
|
+
import { ShowWorking } from "./working.js";
|
|
27
|
+
|
|
28
|
+
/** The views of the incubator, by the same names every instrument's stage uses. */
|
|
29
|
+
export type InductionView = "machine" | "block" | "screen" | "tube" | "result";
|
|
30
|
+
|
|
31
|
+
/** What the scene is told to show. It is shaped to be spread onto `InstrumentStage`. */
|
|
32
|
+
export interface InductionStage {
|
|
33
|
+
model: "shaking-incubator";
|
|
34
|
+
name: string;
|
|
35
|
+
view: InductionView;
|
|
36
|
+
onView: (view: InductionView) => void;
|
|
37
|
+
/** What the incubator's display says. */
|
|
38
|
+
screen: { text: string; lit?: boolean }[];
|
|
39
|
+
/** The clamp the flask is in. */
|
|
40
|
+
well?: { row: number; column: number };
|
|
41
|
+
/** The gene being expressed, with its coding sequence marked, for the view into the cells. */
|
|
42
|
+
molecule?: DrawnMolecule;
|
|
43
|
+
/** The gel once run: the marker and the sample, for the last view. */
|
|
44
|
+
gel?: { lanes: { name: string; tone: "dim" | "held"; bands: { position: number; intensity: number; label: string }[] }[]; ran: number };
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const count = (value: number): string => value.toLocaleString("en-US");
|
|
48
|
+
const whole = (text: string): number | undefined => (/^\d+$/.test(text.trim()) ? Number(text) : undefined);
|
|
49
|
+
const kda = (value: number): string => `${Math.round(value * 10) / 10} kDa`;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* An induction and the gel that checks it, at the shaking incubator.
|
|
53
|
+
*
|
|
54
|
+
* @param options - `start` says what to open on, for a tour or a link; `instrument` is the incubator
|
|
55
|
+
* it is grown in, if the lab has one; `onDone` adds a way to leave.
|
|
56
|
+
* @returns `stage`, to spread onto `InstrumentStage` from `@biolibs/bionet-scene`, and `panel`, to
|
|
57
|
+
* put inside it.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```tsx
|
|
61
|
+
* import { useInductionBench } from "@biolibs/bionet-tools";
|
|
62
|
+
*
|
|
63
|
+
* const bench = useInductionBench({ instrument });
|
|
64
|
+
* <InstrumentStage {...bench.stage}>{bench.panel}</InstrumentStage>
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export function useInductionBench({ instrument = null, onDone, start }: {
|
|
68
|
+
instrument?: { id: string; name: string } | null; onDone?: () => void;
|
|
69
|
+
/** What to show: the view, the culture and gene chosen, how far the gel starts. Followed whenever it changes. */
|
|
70
|
+
start?: { view?: InductionView; culture?: string; gene?: string; cds?: string; ran?: number };
|
|
71
|
+
} = {}): { stage: InductionStage; panel: ReactNode } {
|
|
72
|
+
const lab = useLab()?.lab;
|
|
73
|
+
const act = useAct();
|
|
74
|
+
const [view, setView] = useState<InductionView>(start?.view ?? "machine");
|
|
75
|
+
const [culture, setCulture] = useState(start?.culture ?? "");
|
|
76
|
+
const [gene, setGene] = useState(start?.gene ?? "");
|
|
77
|
+
const [cds, setCds] = useState(start?.cds ?? "");
|
|
78
|
+
const [cutSignal, setCutSignal] = useState(false);
|
|
79
|
+
const [inducer, setInducer] = useState("IPTG");
|
|
80
|
+
const [concentration, setConcentration] = useState("0.5 mM");
|
|
81
|
+
const [celsius, setCelsius] = useState("30");
|
|
82
|
+
const [rpm, setRpm] = useState("220");
|
|
83
|
+
const [hours, setHours] = useState("4");
|
|
84
|
+
const [used, setUsed] = useState("1");
|
|
85
|
+
const [gel, setGel] = useState(USUAL_PROTEIN_GEL);
|
|
86
|
+
// Empty means "whichever suits the gel", which is what a person does until they want another.
|
|
87
|
+
const [ladder, setLadder] = useState("");
|
|
88
|
+
const [name, setName] = useState("");
|
|
89
|
+
const [amount, setAmount] = useState("1");
|
|
90
|
+
const [note, setNote] = useState("");
|
|
91
|
+
const [busy, setBusy] = useState(false);
|
|
92
|
+
const [said, setSaid] = useState<string | null>(null);
|
|
93
|
+
|
|
94
|
+
// A host driving the bench — a tour, or a link — says what to show by changing `start`.
|
|
95
|
+
const asked = JSON.stringify(start ?? null);
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
if (start === undefined) return;
|
|
98
|
+
if (start.view !== undefined) setView(start.view);
|
|
99
|
+
if (start.culture !== undefined) setCulture(start.culture);
|
|
100
|
+
if (start.gene !== undefined) setGene(start.gene);
|
|
101
|
+
if (start.cds !== undefined) setCds(start.cds);
|
|
102
|
+
}, [asked]);
|
|
103
|
+
|
|
104
|
+
const cultures = useMemo(() => (lab === null || lab === undefined ? [] : inductionCultures(lab)), [lab]);
|
|
105
|
+
const genes = useMemo(() => (lab === null || lab === undefined || culture === "" ? [] : inductionGenes(lab, culture)), [lab, culture]);
|
|
106
|
+
const chosen = genes.find((one) => one.part.checksum === gene);
|
|
107
|
+
// Arriving at the gel finds it running, because that is what a gel does.
|
|
108
|
+
const [ran, setRan, running] = useRunning(view === "result" && culture !== "" && gene !== "", start?.ran ?? 0);
|
|
109
|
+
const run = useMemo(() => (lab === null || lab === undefined ? null : inductionRun(lab, {
|
|
110
|
+
culture, gene, gel, ladder, instrument: instrument?.id ?? null, note, inducer, concentration,
|
|
111
|
+
...(cds === "" ? {} : { cds }), ...(cutSignal ? { cutSignal: true } : {}), ...(name === "" ? {} : { name }),
|
|
112
|
+
...(whole(used) === undefined ? {} : { used: whole(used)! }), ...(whole(amount) === undefined ? {} : { amount: whole(amount)! }),
|
|
113
|
+
...(whole(celsius) === undefined ? {} : { celsius: whole(celsius)! }),
|
|
114
|
+
...(whole(rpm) === undefined ? {} : { rpm: whole(rpm)! }),
|
|
115
|
+
...(whole(hours) === undefined ? {} : { hours: whole(hours)! }),
|
|
116
|
+
})), [lab, culture, gene, cds, cutSignal, gel, ladder, instrument, note, inducer, concentration, celsius, rpm, hours, used, amount, name]);
|
|
117
|
+
const plan = run?.plan ?? null;
|
|
118
|
+
const good = plan !== null && plan.problem === null && plan.kilodaltons !== null ? plan : null;
|
|
119
|
+
const checks = plan === null || plan.problem !== null ? [] : inductionChecks(plan);
|
|
120
|
+
const working = useMemo(() => (good === null ? [] : inductionWorking(good)), [good]);
|
|
121
|
+
// A protein the lab already holds is not added again: it is the same molecule, by the same checksum.
|
|
122
|
+
const already = good?.checksum == null ? undefined : lab?.parts.find((one) => one.checksum === good.checksum);
|
|
123
|
+
|
|
124
|
+
const stage: InductionStage = {
|
|
125
|
+
model: "shaking-incubator", name: instrument?.name ?? "Shaking incubator", view, onView: setView,
|
|
126
|
+
screen: [{ text: `${whole(celsius) ?? "—"} °C ${whole(rpm) ?? "—"} rpm`, lit: true }, { text: `${whole(hours) ?? "—"}:00 h` }],
|
|
127
|
+
...(culture === "" ? {} : { well: { row: 0, column: 1 } }),
|
|
128
|
+
...(chosen === undefined || view !== "tube" ? {} : { molecule: (() => {
|
|
129
|
+
const drawn = moleculeOf(chosen.part);
|
|
130
|
+
// The stretch being read is drawn on the gene, since that is the part of it that matters here.
|
|
131
|
+
const marked = cds === "" ? undefined : chosen.part.features.find((one) => one.label === cds)?.parts[0];
|
|
132
|
+
return marked === undefined ? drawn : {
|
|
133
|
+
...drawn,
|
|
134
|
+
features: [{ start: marked.start, end: marked.end, strand: 0 as const, tone: "found" as const, label: `read · ${cds}` }, ...drawn.features],
|
|
135
|
+
};
|
|
136
|
+
})() }),
|
|
137
|
+
...(good === null ? {} : { gel: { ran: ran / 100, lanes: [
|
|
138
|
+
// Bands the gel does not separate pile up in the well as one, and are named as the range they
|
|
139
|
+
// are. Labels that still crowd are the scene's to thin out, which it does by rank.
|
|
140
|
+
{ name: "marker", tone: "dim" as const, bands: good.ladder.map((band) => ({
|
|
141
|
+
position: band.position, intensity: 0.6,
|
|
142
|
+
label: band.sizes.length > 1 ? `${band.sizes.at(-1)}–${band.sizes[0]}` : `${band.size}` })) },
|
|
143
|
+
{ name: "induced", tone: "held" as const, bands: good.bands.map((band) => ({ position: band.position, intensity: band.intensity, label: kda(band.size) })) },
|
|
144
|
+
] } }),
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
/** Set the bench up as a plan says: its culture, and the gene it names. */
|
|
148
|
+
const setUp = (plan: Plan): void => {
|
|
149
|
+
setCulture(plan.inputs.find((one) => one.role === "culture")?.item ?? "");
|
|
150
|
+
setGene(typeof plan.settings["gene_part"] === "string" ? plan.settings["gene_part"] : "");
|
|
151
|
+
setCds(typeof plan.settings["cds"] === "string" ? plan.settings["cds"] : "");
|
|
152
|
+
setCutSignal(plan.settings["signal_cut"] === "yes");
|
|
153
|
+
if (typeof plan.settings["inducer"] === "string") setInducer(plan.settings["inducer"]);
|
|
154
|
+
if (typeof plan.settings["at"] === "string") setConcentration(plan.settings["at"]);
|
|
155
|
+
setSaid(null); setView("result");
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Record the run, and — if the band was there — keep the protein.
|
|
160
|
+
*
|
|
161
|
+
* The order is the order it happened in: the run, then the part, then the tube of it. Each is its
|
|
162
|
+
* own entry, so a device that cannot read one still reads the others; and if the part is one the
|
|
163
|
+
* lab already holds, only a tube is added, because two labs that made the same protein made the
|
|
164
|
+
* same protein.
|
|
165
|
+
*/
|
|
166
|
+
const record = async (showed: boolean): Promise<void> => {
|
|
167
|
+
const what = showed ? run?.showed ?? null : run?.nothing ?? null;
|
|
168
|
+
const keep = run?.keep ?? null;
|
|
169
|
+
if (what === null) return;
|
|
170
|
+
setBusy(true);
|
|
171
|
+
const answer = await act("recordRun", withPlan(lab, what));
|
|
172
|
+
if (!answer.ok) { setBusy(false); setSaid(answer.error); return; }
|
|
173
|
+
if (!showed || keep === null) {
|
|
174
|
+
setBusy(false); setNote("");
|
|
175
|
+
setSaid("Recorded: it was grown and induced, and nothing was at that mass.");
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
if (already === undefined) {
|
|
179
|
+
const added = await act("addPart", { name: keep.name, sequence: keep.sequence, kind: "protein" });
|
|
180
|
+
if (!added.ok) { setBusy(false); setSaid(added.error); return; }
|
|
181
|
+
}
|
|
182
|
+
const tube = await act("addItem", { part: keep.checksum, amount: keep.amount, unit: keep.unit });
|
|
183
|
+
setBusy(false);
|
|
184
|
+
setNote("");
|
|
185
|
+
setSaid(tube.ok
|
|
186
|
+
? `Recorded: the band is there, and ${keep.name} is in the freezer — ${keep.amount} ${keep.unit ?? ""}`.trim() + "."
|
|
187
|
+
: tube.error);
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
const here = lab === null || lab === undefined ? [] : lab.runs.filter((one) => one.kind === INDUCTION && (instrument === null || one.instrument === instrument.id)).slice(-5).reverse();
|
|
191
|
+
const strainName = (item: string | undefined): string => {
|
|
192
|
+
const held = lab?.items.find((one) => one.item === item);
|
|
193
|
+
return lab?.strains.find((one) => one.strain === held?.strain)?.name ?? "a culture";
|
|
194
|
+
};
|
|
195
|
+
const checked = checks.length === 0 ? <p className="small good">Nothing about this induction looks wrong for this gel.</p>
|
|
196
|
+
: <ul className="checks">{checks.map((check) => <li key={check.says} className={check.weight}>{check.says} <code className="because">{check.because}</code></li>)}</ul>;
|
|
197
|
+
|
|
198
|
+
const panel = lab === null || lab === undefined ? null : (
|
|
199
|
+
<div className="bionet benchpanel">
|
|
200
|
+
<section className="card">
|
|
201
|
+
<div className="toolhead">
|
|
202
|
+
<h2>Induction and gel</h2>
|
|
203
|
+
{onDone !== undefined && <button type="button" className="quiet" onClick={onDone}>Back to the lab</button>}
|
|
204
|
+
</div>
|
|
205
|
+
{cultures.length === 0 ? <p className="empty">There are no cultures to grow. A culture is of a strain: add a strain and a culture of it on the Strains tab, once something has been put into a host.</p> : (
|
|
206
|
+
<fieldset disabled={busy} className="stack">
|
|
207
|
+
<label>Culture
|
|
208
|
+
<select value={culture} onChange={(event) => { setCulture(event.target.value); setGene(""); setCds(""); setSaid(null); }} aria-label="Culture">
|
|
209
|
+
<option value="">Choose a culture…</option>
|
|
210
|
+
{cultures.map((one) => <option key={one.item} value={one.item}>{one.label}</option>)}
|
|
211
|
+
</select>
|
|
212
|
+
</label>
|
|
213
|
+
{culture !== "" && (
|
|
214
|
+
<label>Express
|
|
215
|
+
<select value={gene} onChange={(event) => { setGene(event.target.value); setCds(""); setSaid(null); }} aria-label="What to express">
|
|
216
|
+
<option value="">Choose what it carries…</option>
|
|
217
|
+
{genes.map((one) => <option key={one.part.checksum} value={one.part.checksum}>{one.part.name} · {count(one.part.length)} bp</option>)}
|
|
218
|
+
</select>
|
|
219
|
+
</label>
|
|
220
|
+
)}
|
|
221
|
+
{chosen !== undefined && chosen.coding.length > 0 && (
|
|
222
|
+
<label>Read which coding sequence
|
|
223
|
+
<select value={cds} onChange={(event) => { setCds(event.target.value); setSaid(null); }} aria-label="The coding sequence">
|
|
224
|
+
<option value="">the whole part</option>
|
|
225
|
+
{chosen.coding.map((one) => <option key={one} value={one}>{one}</option>)}
|
|
226
|
+
</select>
|
|
227
|
+
</label>
|
|
228
|
+
)}
|
|
229
|
+
{chosen !== undefined && (
|
|
230
|
+
<label className="check">
|
|
231
|
+
<input type="checkbox" checked={cutSignal} onChange={(event) => { setCutSignal(event.target.checked); setSaid(null); }} />
|
|
232
|
+
Take off a signal peptide, if one is marked
|
|
233
|
+
</label>
|
|
234
|
+
)}
|
|
235
|
+
</fieldset>
|
|
236
|
+
)}
|
|
237
|
+
{plan !== null && plan.problem !== null && culture !== "" && <p className="trouble" role="status">{plan.problem}</p>}
|
|
238
|
+
</section>
|
|
239
|
+
|
|
240
|
+
<Proposed kind={INDUCTION} now={run?.showed ?? null} onSetUp={setUp} />
|
|
241
|
+
|
|
242
|
+
{view === "machine" && (
|
|
243
|
+
<section className="card">
|
|
244
|
+
<h2>At the incubator</h2>
|
|
245
|
+
<p className="small"><Glossed text="Induction turns a promoter on, so that the cells carrying a gene start making the protein it codes for. A few hours later the protein is run on a polyacrylamide gel, which sorts proteins by mass." /></p>
|
|
246
|
+
<p className="dim small">An incubator shows a temperature, a speed and a time, and nothing of what the cells are doing. The first three views are what is there to see. The fourth is the gene you have to picture being read. The fifth is the gel, which is where the answer comes from.</p>
|
|
247
|
+
<p className="dim small">Nothing here predicts a yield. What the cells make depends on the host, the promoter, the temperature and the protein itself, and no sequence tells you it. What is worked out is the protein the gene codes for and the mass its band should run at; whether that band is there is yours to read.</p>
|
|
248
|
+
</section>
|
|
249
|
+
)}
|
|
250
|
+
|
|
251
|
+
{view === "block" && (
|
|
252
|
+
<section className="card">
|
|
253
|
+
<h2>The flasks</h2>
|
|
254
|
+
<p className="voice">The machine</p>
|
|
255
|
+
<fieldset disabled={busy} className="programme">
|
|
256
|
+
<label>Induce with<input value={inducer} onChange={(event) => setInducer(event.target.value)} maxLength={200} aria-label="The inducer" /></label>
|
|
257
|
+
<label>at<input value={concentration} onChange={(event) => setConcentration(event.target.value)} maxLength={200} aria-label="How much of it" /></label>
|
|
258
|
+
</fieldset>
|
|
259
|
+
<p className="small"><Glossed text="A flask of medium clamped to a platform that shakes, so that air is mixed in and the cells stay suspended." /></p>
|
|
260
|
+
<p className="voice">This run</p>
|
|
261
|
+
<p className="small">
|
|
262
|
+
{plan?.strain == null ? "Nothing is growing yet. Choose a culture above." : <>A flask of {plan.strain.name} — {plan.strain.host} — is in the second clamp.</>}
|
|
263
|
+
{plan?.gene != null && <> It carries {plan.gene.name}{cds === "" ? "" : `, and ${cds} is what is being read`}.</>}
|
|
264
|
+
</p>
|
|
265
|
+
<p className="dim small">What the inducer is and how much of it was used are kept with the run as they are written here. Nothing works out whether that concentration is right for this promoter: that is in the literature, and in what this lab has found before.</p>
|
|
266
|
+
</section>
|
|
267
|
+
)}
|
|
268
|
+
|
|
269
|
+
{view === "screen" && (
|
|
270
|
+
<section className="card">
|
|
271
|
+
<h2>The display</h2>
|
|
272
|
+
<p className="voice">The machine</p>
|
|
273
|
+
<fieldset disabled={busy} className="programme">
|
|
274
|
+
<label>Grow at<input type="number" min={4} max={60} step={1} value={celsius} onChange={(event) => setCelsius(event.target.value)} /> °C</label>
|
|
275
|
+
<label>shaking at<input type="number" min={0} max={400} step={10} value={rpm} onChange={(event) => setRpm(event.target.value)} /> rpm</label>
|
|
276
|
+
<label>for<input type="number" min={1} max={96} step={1} value={hours} onChange={(event) => setHours(event.target.value)} /> h</label>
|
|
277
|
+
</fieldset>
|
|
278
|
+
<p className="voice">What is going on</p>
|
|
279
|
+
<p className="small">The inducer lets the polymerase onto the promoter, so the gene behind it is read into messenger RNA and that is translated into protein. The cells go on growing and dividing while they do it, which is why the temperature and the shaking matter as much as the inducer.</p>
|
|
280
|
+
<p className="dim small">Growing cooler and for longer often gives less protein that is better folded, and warmer and briefly gives more of it stuck together in inclusion bodies. Nothing here works out which this will be. What is set is kept with the run, so that the next person can set it up the same way or deliberately differently.</p>
|
|
281
|
+
</section>
|
|
282
|
+
)}
|
|
283
|
+
|
|
284
|
+
{view === "tube" && (
|
|
285
|
+
<section className="card">
|
|
286
|
+
<h2>In the cells</h2>
|
|
287
|
+
{chosen === undefined || plan === null ? <p className="dim small">Choose a culture and what it carries to see the gene being read.</p> : (
|
|
288
|
+
<>
|
|
289
|
+
<SequenceMap name={chosen.part.name} length={chosen.part.length} circular={chosen.part.circular} features={chosen.part.features}
|
|
290
|
+
{...(cds === "" ? {} : { spans: chosen.part.features.filter((one) => one.label === cds).flatMap((one) => one.parts.map((piece) => ({ start: piece.start, end: piece.end, label: "read", strand: 0 as const }))) })} />
|
|
291
|
+
{plan.made === null ? <p className="dim small">{plan.problem ?? "There is nothing here that reads as a gene."}</p> : (
|
|
292
|
+
<>
|
|
293
|
+
<p className="voice">This run</p>
|
|
294
|
+
<p>
|
|
295
|
+
<strong>{count(plan.made.length)} amino acids</strong>
|
|
296
|
+
{plan.kilodaltons !== null && <span className="dim"> · {kda(plan.kilodaltons)}</span>}
|
|
297
|
+
{plan.made.signal !== null && <span className="dim"> · {plan.made.signal.label} cut off</span>}
|
|
298
|
+
</p>
|
|
299
|
+
<p className="small"><code className="seq">{plan.made.protein.slice(0, 120)}{plan.made.protein.length > 120 ? "…" : ""}</code></p>
|
|
300
|
+
{plan.facts !== null && (
|
|
301
|
+
<p className="small">
|
|
302
|
+
It carries no net charge at pH {plan.facts.isoelectric.toFixed(2)}, which is the pH it would come out of solution at.
|
|
303
|
+
{plan.facts.extinction.reduced > 0
|
|
304
|
+
? <> It absorbs at 280 nm with {count(plan.facts.extinction.reduced)} M⁻¹cm⁻¹, which is how its concentration is read off.</>
|
|
305
|
+
: <> It has no tryptophan, tyrosine or cystine, so it does not absorb at 280 nm at all and its concentration cannot be read there: use a dye-based assay instead.</>}
|
|
306
|
+
</p>
|
|
307
|
+
)}
|
|
308
|
+
<p className="small"><Glossed text="A signal peptide is the first stretch of a protein the cell means to let out, and is cut off on the way: what is collected from the medium is what is left." /></p>
|
|
309
|
+
<p className="voice">Checks</p>
|
|
310
|
+
{checked}
|
|
311
|
+
</>
|
|
312
|
+
)}
|
|
313
|
+
</>
|
|
314
|
+
)}
|
|
315
|
+
</section>
|
|
316
|
+
)}
|
|
317
|
+
|
|
318
|
+
{view === "result" && (
|
|
319
|
+
<section className="card">
|
|
320
|
+
<h2>The gel</h2>
|
|
321
|
+
{good === null ? <p className="dim small">{plan?.problem ?? "Choose a culture and a gene that codes for a protein to see the gel it should give."}</p> : (
|
|
322
|
+
<>
|
|
323
|
+
<p className="voice">The machine</p>
|
|
324
|
+
<fieldset disabled={busy} className="programme">
|
|
325
|
+
<label>Gel<select value={gel} onChange={(event) => setGel(event.target.value)}>{PROTEIN_GELS.map((one) => <option key={one.id} value={one.id}>{one.percent}% acrylamide</option>)}</select></label>
|
|
326
|
+
<label>Marker<select value={ladder} onChange={(event) => setLadder(event.target.value)}>
|
|
327
|
+
<option value="">{markerFor(good.gel).name} · the one for this gel</option>
|
|
328
|
+
{PROTEIN_LADDERS.map((one) => <option key={one.id} value={one.id}>{one.name}</option>)}
|
|
329
|
+
</select></label>
|
|
330
|
+
</fieldset>
|
|
331
|
+
<p className="voice">This run</p>
|
|
332
|
+
<Gel ladder={good.ladder} bands={good.bands} name="induced" unit="kilodaltons" marker="marker"
|
|
333
|
+
says={`A protein gel: a broad-range marker beside the induced culture, with one band to look for at ${kda(good.kilodaltons!)}`} />
|
|
334
|
+
<p className="small">The band to look for is at <strong>{kda(good.kilodaltons!)}</strong>, between the marker’s {good.ladder.filter((one) => one.size >= good.kilodaltons!).at(-1)?.size ?? good.gel.largest} and {good.ladder.filter((one) => one.size <= good.kilodaltons!)[0]?.size ?? good.gel.smallest} kDa bands. This gel separates {good.gel.largest} down to {good.gel.smallest} kDa.</p>
|
|
335
|
+
<label className="small">How far it has run{running ? " · running" : ""}
|
|
336
|
+
<input type="range" min={0} max={100} step={1} value={Math.round(ran)} onChange={(event) => setRan(Number(event.target.value))} aria-label="How far the gel has run" />
|
|
337
|
+
</label>
|
|
338
|
+
<p className="dim small">A lane of the same culture before it was induced, beside this one, is what makes a band mean anything: the protein is the band that is in one and not the other.</p>
|
|
339
|
+
<p className="voice">Checks</p>
|
|
340
|
+
{checked}
|
|
341
|
+
<p className="voice">The working</p>
|
|
342
|
+
{working.map((one) => <ShowWorking key={one.of} working={one} />)}
|
|
343
|
+
<fieldset disabled={busy} className="stack">
|
|
344
|
+
<label>Call the protein<input value={name} onChange={(event) => setName(event.target.value)} maxLength={200}
|
|
345
|
+
placeholder={run?.keep?.name ?? "a name for it"} aria-label="What to call the protein" /></label>
|
|
346
|
+
<label>Used, from the culture<input type="number" min={0} step={1} value={used} onChange={(event) => setUsed(event.target.value)} aria-label="Amount used" /></label>
|
|
347
|
+
<label>How much came out, in mL<input type="number" min={0} step={1} value={amount} onChange={(event) => setAmount(event.target.value)} aria-label="How much protein came out" /></label>
|
|
348
|
+
<label>Note<input value={note} onChange={(event) => setNote(event.target.value)} placeholder="Anything worth remembering about this induction" maxLength={2000} /></label>
|
|
349
|
+
{already !== undefined && <p className="small">The lab already holds this protein, as {already.name}. Only a tube of it will be added: it is the same molecule.</p>}
|
|
350
|
+
<div className="row">
|
|
351
|
+
<button type="button" onClick={() => void record(true)}>The band is there</button>
|
|
352
|
+
<button type="button" className="quiet" onClick={() => void record(false)}>Nothing at that mass</button>
|
|
353
|
+
</div>
|
|
354
|
+
<p className="dim small">Either way the run is recorded and the culture is used. Only the first puts a protein in the freezer, and it is named in the run’s settings by the checksum it will have, so the two can be put back together afterwards.</p>
|
|
355
|
+
</fieldset>
|
|
356
|
+
{said !== null && <p className="small" role="status">{said}</p>}
|
|
357
|
+
</>
|
|
358
|
+
)}
|
|
359
|
+
</section>
|
|
360
|
+
)}
|
|
361
|
+
|
|
362
|
+
{here.length > 0 && view === "result" && (
|
|
363
|
+
<section className="card">
|
|
364
|
+
<h2>Recent inductions{instrument === null ? "" : " here"}</h2>
|
|
365
|
+
<table>
|
|
366
|
+
<thead><tr><th>Culture</th><th>Gene</th><th>Induced with</th><th>Expected</th><th>Gel</th></tr></thead>
|
|
367
|
+
<tbody>
|
|
368
|
+
{here.map((one) => (
|
|
369
|
+
<tr key={one.run}>
|
|
370
|
+
<td>{strainName(one.inputs[0]?.item)}</td>
|
|
371
|
+
<td>{String(one.settings["gene"] ?? "—")}</td>
|
|
372
|
+
<td className="dim">{[one.settings["inducer"], one.settings["at"]].filter((each) => each !== undefined).join(" ") || "—"}</td>
|
|
373
|
+
<td className="dim">{one.settings["expected_kda"] === undefined ? "—" : `${String(one.settings["expected_kda"])} kDa`}</td>
|
|
374
|
+
<td>{one.outcome === "worked" ? "band there" : <span className="badge">nothing</span>}</td>
|
|
375
|
+
</tr>
|
|
376
|
+
))}
|
|
377
|
+
</tbody>
|
|
378
|
+
</table>
|
|
379
|
+
</section>
|
|
380
|
+
)}
|
|
381
|
+
</div>
|
|
382
|
+
);
|
|
383
|
+
return { stage, panel };
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* The induction tool on its own, for a lab that has not drawn its room.
|
|
388
|
+
*
|
|
389
|
+
* @param props - `instrument` is the incubator it is grown in, if the lab has one; `start` says what
|
|
390
|
+
* to open on; `onDone` adds a way to leave.
|
|
391
|
+
*/
|
|
392
|
+
export function InductionTool(props: Parameters<typeof useInductionBench>[0]) {
|
|
393
|
+
const bench = useInductionBench(props);
|
|
394
|
+
const names: [InductionView, string][] = [["machine", "The incubator"], ["block", "The flasks"], ["screen", "The display"], ["tube", "In the cells"], ["result", "The gel"]];
|
|
395
|
+
return (
|
|
396
|
+
<div className="pcr">
|
|
397
|
+
<div className="row tight pick" role="tablist" aria-label={`Views of ${bench.stage.name}`}>
|
|
398
|
+
{names.map(([one, said]) => (
|
|
399
|
+
<button key={one} type="button" role="tab" aria-selected={one === bench.stage.view} className={one === bench.stage.view ? "" : "quiet"}
|
|
400
|
+
onClick={() => bench.stage.onView(one)}>{said}</button>
|
|
401
|
+
))}
|
|
402
|
+
</div>
|
|
403
|
+
{bench.panel}
|
|
404
|
+
</div>
|
|
405
|
+
);
|
|
406
|
+
}
|