@biolibs/bionet-tools 0.1.0 → 0.1.1
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 +37 -1
- package/dist/digest-tool.d.ts.map +1 -1
- package/dist/digest-tool.js +2 -1
- package/dist/digest-tool.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/pcr-bench.d.ts +94 -0
- package/dist/pcr-bench.d.ts.map +1 -0
- package/dist/pcr-bench.js +187 -0
- package/dist/pcr-bench.js.map +1 -0
- package/dist/pcr-scene.d.ts +247 -0
- package/dist/pcr-scene.d.ts.map +1 -0
- package/dist/pcr-scene.js +287 -0
- package/dist/pcr-scene.js.map +1 -0
- package/dist/pcr-tool.d.ts.map +1 -1
- package/dist/pcr-tool.js +2 -1
- package/dist/pcr-tool.js.map +1 -1
- package/dist/run.d.ts +3 -0
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +5 -1
- package/dist/run.js.map +1 -1
- package/dist/tools.d.ts +6 -2
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +4 -3
- package/dist/tools.js.map +1 -1
- package/package.json +2 -1
- package/src/digest-tool.tsx +2 -1
- package/src/index.ts +4 -0
- package/src/pcr-bench.tsx +350 -0
- package/src/pcr-scene.ts +408 -0
- package/src/pcr-tool.tsx +2 -1
- package/src/run.ts +8 -1
- package/src/tools.tsx +5 -4
- package/tools.css +28 -0
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A PCR as a person at the machine meets it: what the machine shows, and what they have to picture.
|
|
3
|
+
*
|
|
4
|
+
* A thermocycler shows a programme, a temperature and a cycle count. It says nothing about DNA. What
|
|
5
|
+
* is happening in the tube — strands parting, primers finding their places, copies being made, and
|
|
6
|
+
* which of those copies are the product — the operator has to picture. This works both out as plain
|
|
7
|
+
* data, so a scene can draw them and a test can check them:
|
|
8
|
+
*
|
|
9
|
+
* - the **programme**, as the machine shows it, suggested from the reaction;
|
|
10
|
+
* - the **checks** a careful operator would make of it, each about this run and each able to be wrong;
|
|
11
|
+
* - where each **primer binds**, on which strand;
|
|
12
|
+
* - what is **in the tube** at each step of each cycle.
|
|
13
|
+
*/
|
|
14
|
+
/** The three things a cycle does. */
|
|
15
|
+
export type PcrStepName = "denature" | "anneal" | "extend";
|
|
16
|
+
/** One step of a programme: how hot, and for how long. */
|
|
17
|
+
export interface PcrStep {
|
|
18
|
+
/** Which step it is. */
|
|
19
|
+
name: PcrStepName;
|
|
20
|
+
/** The block's temperature, in whole degrees Celsius. */
|
|
21
|
+
celsius: number;
|
|
22
|
+
/** How long it is held, in whole seconds. */
|
|
23
|
+
seconds: number;
|
|
24
|
+
}
|
|
25
|
+
/** A thermocycler's programme. */
|
|
26
|
+
export interface PcrProgramme {
|
|
27
|
+
/** The first, longer melt before cycling starts. */
|
|
28
|
+
initial: {
|
|
29
|
+
celsius: number;
|
|
30
|
+
seconds: number;
|
|
31
|
+
};
|
|
32
|
+
/** The three steps of a cycle, in order. */
|
|
33
|
+
steps: [PcrStep, PcrStep, PcrStep];
|
|
34
|
+
/** How many times the cycle is run. */
|
|
35
|
+
cycles: number;
|
|
36
|
+
/** The last, longer extension after cycling ends. */
|
|
37
|
+
final: {
|
|
38
|
+
celsius: number;
|
|
39
|
+
seconds: number;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/** What the tool knows of a reaction when it suggests or checks a programme. */
|
|
43
|
+
export interface PcrReaction {
|
|
44
|
+
/** How long the product is, in bases. */
|
|
45
|
+
length: number;
|
|
46
|
+
/** Each primer's name and rough melting temperature, in degrees Celsius. */
|
|
47
|
+
primers: {
|
|
48
|
+
name: string;
|
|
49
|
+
tm: number;
|
|
50
|
+
}[];
|
|
51
|
+
}
|
|
52
|
+
/** How long a polymerase is usually given: a minute for every thousand bases. */
|
|
53
|
+
export declare const SECONDS_PER_KB = 60;
|
|
54
|
+
/**
|
|
55
|
+
* A programme that suits a reaction, to start from.
|
|
56
|
+
*
|
|
57
|
+
* The annealing step is five degrees under the cooler primer, and the extension allows a minute for
|
|
58
|
+
* every thousand bases. Both are conventions, and the operator may know better.
|
|
59
|
+
*
|
|
60
|
+
* @param reaction - The product's length and the primers' melting temperatures.
|
|
61
|
+
* @returns The programme.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* import { suggestProgramme } from "@biolibs/bionet-tools";
|
|
66
|
+
*
|
|
67
|
+
* const programme = suggestProgramme({ length: 1500, primers: [{ name: "fwd", tm: 60 }, { name: "rev", tm: 58 }] });
|
|
68
|
+
* programme.steps[1]; // { name: "anneal", celsius: 53, seconds: 30 }
|
|
69
|
+
* programme.steps[2]; // { name: "extend", celsius: 72, seconds: 90 }
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
export declare function suggestProgramme(reaction: PcrReaction): PcrProgramme;
|
|
73
|
+
/** One line of a thermocycler's screen. */
|
|
74
|
+
export interface ScreenLine {
|
|
75
|
+
/** What it says. */
|
|
76
|
+
text: string;
|
|
77
|
+
/** The step of the cycle it is, if it is one. */
|
|
78
|
+
step?: PcrStepName;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* A programme as a thermocycler's screen shows it.
|
|
82
|
+
*
|
|
83
|
+
* @param programme - The programme.
|
|
84
|
+
* @returns The lines, top to bottom.
|
|
85
|
+
*/
|
|
86
|
+
export declare function screenOf(programme: PcrProgramme): ScreenLine[];
|
|
87
|
+
/**
|
|
88
|
+
* How long a programme takes, not counting the time the block spends changing temperature.
|
|
89
|
+
*
|
|
90
|
+
* @param programme - The programme.
|
|
91
|
+
* @returns Seconds.
|
|
92
|
+
*/
|
|
93
|
+
export declare function runSeconds(programme: PcrProgramme): number;
|
|
94
|
+
/** Something a careful operator would stop and ask about a programme. */
|
|
95
|
+
export interface PcrCheck {
|
|
96
|
+
/** The part of the programme it is about. */
|
|
97
|
+
about: PcrStepName | "cycles";
|
|
98
|
+
/** `stop` if the run is unlikely to work as set, `look` if it is only worth a second glance. */
|
|
99
|
+
weight: "stop" | "look";
|
|
100
|
+
/** What to ask, said for a person. */
|
|
101
|
+
says: string;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* What a careful operator would ask of a programme, given the reaction it is for.
|
|
105
|
+
*
|
|
106
|
+
* Each is about this run and may be wrong: an operator who knows their polymerase extends at fifteen
|
|
107
|
+
* seconds a thousand bases can ignore what is said about extension. None of them stops a run.
|
|
108
|
+
*
|
|
109
|
+
* @param programme - The programme as set.
|
|
110
|
+
* @param reaction - The product's length and the primers' melting temperatures.
|
|
111
|
+
* @returns The checks that apply, the ones most likely to matter first.
|
|
112
|
+
*/
|
|
113
|
+
export declare function programmeChecks(programme: PcrProgramme, reaction: PcrReaction): PcrCheck[];
|
|
114
|
+
/** Where a primer binds a template. Positions count bases from the start of the template's top strand. */
|
|
115
|
+
export interface Binding {
|
|
116
|
+
/** The first base it covers. */
|
|
117
|
+
start: number;
|
|
118
|
+
/** One past the last base it covers. */
|
|
119
|
+
end: number;
|
|
120
|
+
/** `top` if it has the top strand's sequence, and so binds the bottom strand and is copied rightwards; `bottom` the other way. */
|
|
121
|
+
reads: "top" | "bottom";
|
|
122
|
+
/** How many bases at its 5′ end do not bind: a tail it carries onto the product. */
|
|
123
|
+
tail: number;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Where one primer binds a template, if it does.
|
|
127
|
+
*
|
|
128
|
+
* It is looked for by the bases at its 3′ end, which are the ones that have to match, on either
|
|
129
|
+
* strand. Its match is then followed back towards its 5′ end for as long as it holds.
|
|
130
|
+
*
|
|
131
|
+
* @param template - The template's top strand.
|
|
132
|
+
* @param primer - The primer, 5′ to 3′.
|
|
133
|
+
* @param least - How many bases at its 3′ end must match.
|
|
134
|
+
* @returns Where it binds, or `null` if it does not or binds in more than one place.
|
|
135
|
+
*/
|
|
136
|
+
export declare function primerBinding(template: string, primer: string, least?: number): Binding | null;
|
|
137
|
+
/** One line drawn in the tube: a strand, or a primer on one. */
|
|
138
|
+
export interface TubeStrand {
|
|
139
|
+
/** Where it starts and ends, in bases along the template. */
|
|
140
|
+
from: number;
|
|
141
|
+
to: number;
|
|
142
|
+
/** Which of the four rows it is drawn on, from the top: 0 and 3 are the template's strands, 1 and 2 what lies between them. */
|
|
143
|
+
row: 0 | 1 | 2 | 3;
|
|
144
|
+
/** What it is. */
|
|
145
|
+
kind: "template" | "primer" | "growing" | "long" | "product";
|
|
146
|
+
/** Whether its 3′ end is at `to` (it points right) or at `from`. */
|
|
147
|
+
points: "right" | "left";
|
|
148
|
+
/**
|
|
149
|
+
* What it does during the step, if it does anything: `parts` from the strand it was paired with,
|
|
150
|
+
* `lands` on the strand it matches, or `grows` from its primer towards its 3′ end.
|
|
151
|
+
*/
|
|
152
|
+
moves?: "parts" | "lands" | "grows";
|
|
153
|
+
}
|
|
154
|
+
/** What is in the tube at one step of one cycle. */
|
|
155
|
+
export interface TubeView {
|
|
156
|
+
/** What to draw. */
|
|
157
|
+
strands: TubeStrand[];
|
|
158
|
+
/** How many strands of each kind there are after this cycle, starting from one double-stranded template. */
|
|
159
|
+
counts: {
|
|
160
|
+
template: number;
|
|
161
|
+
long: number;
|
|
162
|
+
product: number;
|
|
163
|
+
};
|
|
164
|
+
/** What is happening, in a sentence. */
|
|
165
|
+
says: string;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* How many strands of each kind a tube holds after some cycles, from one double-stranded template.
|
|
169
|
+
*
|
|
170
|
+
* The template's two strands are never made more of. Each cycle copies them once more into strands
|
|
171
|
+
* that start at a primer and run on past the other one: there are two more of those every cycle.
|
|
172
|
+
* Everything else is the product, cut to length at both ends, and it doubles.
|
|
173
|
+
*
|
|
174
|
+
* @param cycles - How many cycles have finished.
|
|
175
|
+
* @returns The counts. They add up to twice two to the power of the cycles.
|
|
176
|
+
*/
|
|
177
|
+
export declare function strandCounts(cycles: number): {
|
|
178
|
+
template: number;
|
|
179
|
+
long: number;
|
|
180
|
+
product: number;
|
|
181
|
+
};
|
|
182
|
+
/**
|
|
183
|
+
* What is in the tube at one step of one cycle.
|
|
184
|
+
*
|
|
185
|
+
* It draws the one thing each early cycle adds, since that is what is hard to picture: the first
|
|
186
|
+
* cycle makes strands that run on past the far primer, the second makes the first strands of exactly
|
|
187
|
+
* the product's length, and from the third the product is double-stranded and takes over.
|
|
188
|
+
*
|
|
189
|
+
* @param length - How long the template is, in bases.
|
|
190
|
+
* @param forward - Where the primer that reads as the top strand binds.
|
|
191
|
+
* @param reverse - Where the primer that reads as the bottom strand binds.
|
|
192
|
+
* @param step - Which step of the cycle.
|
|
193
|
+
* @param cycle - Which cycle, counting from 1.
|
|
194
|
+
* @returns What to draw, how many strands of each kind there are once the cycle ends, and a sentence.
|
|
195
|
+
*/
|
|
196
|
+
export declare function tubeView(length: number, forward: Binding, reverse: Binding, step: PcrStepName, cycle: number): TubeView;
|
|
197
|
+
/** One base in the magnified view, and what it is doing. */
|
|
198
|
+
export interface LensCell {
|
|
199
|
+
/** The base, or `""` where the strand has none at this place. */
|
|
200
|
+
base: string;
|
|
201
|
+
/** `paired` with the base opposite, `single`, or `fresh`: just added by the polymerase, and paired. */
|
|
202
|
+
state: "paired" | "single" | "fresh";
|
|
203
|
+
}
|
|
204
|
+
/** The real bases around one primer's site, at one moment of one step. */
|
|
205
|
+
export interface TubeLens {
|
|
206
|
+
/** The stretch of the template it shows, in bases from the start of the top strand. */
|
|
207
|
+
from: number;
|
|
208
|
+
to: number;
|
|
209
|
+
/** The upper strand, written 5′ to 3′ from the left, one cell for each place on the template. */
|
|
210
|
+
upper: {
|
|
211
|
+
label: string;
|
|
212
|
+
cells: LensCell[];
|
|
213
|
+
};
|
|
214
|
+
/** The lower strand, written 3′ to 5′ from the left, so that each base is under the one it pairs with. */
|
|
215
|
+
lower: {
|
|
216
|
+
label: string;
|
|
217
|
+
cells: LensCell[];
|
|
218
|
+
};
|
|
219
|
+
/** For each place, whether the base above is paired with the base below. */
|
|
220
|
+
joined: boolean[];
|
|
221
|
+
/** The place the polymerase is at, counted from the left of the view, if it is copying. */
|
|
222
|
+
polymerase: number | null;
|
|
223
|
+
/** How many more bases the copy has to go beyond what is shown, when it is being made. */
|
|
224
|
+
beyond: number;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* The real bases at a primer's site, at one moment of one step.
|
|
228
|
+
*
|
|
229
|
+
* The strands in the tube are thousands of bases long and are drawn as lines. This is the same
|
|
230
|
+
* moment magnified at the one place worth reading: where a primer binds. Heat unzips the template
|
|
231
|
+
* there base by base; the primer lands and pairs, A with T and G with C, leaving any tail it carries
|
|
232
|
+
* unpaired; and the polymerase adds the next bases one at a time, each the partner of the base
|
|
233
|
+
* opposite. Every letter is from the lab's own sequences.
|
|
234
|
+
*
|
|
235
|
+
* @param template - The template's top strand.
|
|
236
|
+
* @param primer - The primer, 5′ to 3′.
|
|
237
|
+
* @param binding - Where it binds, from `primerBinding`.
|
|
238
|
+
* @param step - Which step of the cycle.
|
|
239
|
+
* @param through - How far through the step it is, from 0 to 1.
|
|
240
|
+
* @param names - What to call the primer and the template.
|
|
241
|
+
* @returns The two rows of bases, which are paired, and where the polymerase is.
|
|
242
|
+
*/
|
|
243
|
+
export declare function tubeLens(template: string, primer: string, binding: Binding, step: PcrStepName, through: number, names?: {
|
|
244
|
+
primer?: string;
|
|
245
|
+
template?: string;
|
|
246
|
+
}): TubeLens;
|
|
247
|
+
//# sourceMappingURL=pcr-scene.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pcr-scene.d.ts","sourceRoot":"","sources":["../src/pcr-scene.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,qCAAqC;AACrC,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE3D,0DAA0D;AAC1D,MAAM,WAAW,OAAO;I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OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EACtF,KAAK,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,QAAQ,CAsDrF"}
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A PCR as a person at the machine meets it: what the machine shows, and what they have to picture.
|
|
3
|
+
*
|
|
4
|
+
* A thermocycler shows a programme, a temperature and a cycle count. It says nothing about DNA. What
|
|
5
|
+
* is happening in the tube — strands parting, primers finding their places, copies being made, and
|
|
6
|
+
* which of those copies are the product — the operator has to picture. This works both out as plain
|
|
7
|
+
* data, so a scene can draw them and a test can check them:
|
|
8
|
+
*
|
|
9
|
+
* - the **programme**, as the machine shows it, suggested from the reaction;
|
|
10
|
+
* - the **checks** a careful operator would make of it, each about this run and each able to be wrong;
|
|
11
|
+
* - where each **primer binds**, on which strand;
|
|
12
|
+
* - what is **in the tube** at each step of each cycle.
|
|
13
|
+
*/
|
|
14
|
+
const clamp = (value, least, most) => Math.min(Math.max(value, least), most);
|
|
15
|
+
/** How long a polymerase is usually given: a minute for every thousand bases. */
|
|
16
|
+
export const SECONDS_PER_KB = 60;
|
|
17
|
+
/**
|
|
18
|
+
* A programme that suits a reaction, to start from.
|
|
19
|
+
*
|
|
20
|
+
* The annealing step is five degrees under the cooler primer, and the extension allows a minute for
|
|
21
|
+
* every thousand bases. Both are conventions, and the operator may know better.
|
|
22
|
+
*
|
|
23
|
+
* @param reaction - The product's length and the primers' melting temperatures.
|
|
24
|
+
* @returns The programme.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* import { suggestProgramme } from "@biolibs/bionet-tools";
|
|
29
|
+
*
|
|
30
|
+
* const programme = suggestProgramme({ length: 1500, primers: [{ name: "fwd", tm: 60 }, { name: "rev", tm: 58 }] });
|
|
31
|
+
* programme.steps[1]; // { name: "anneal", celsius: 53, seconds: 30 }
|
|
32
|
+
* programme.steps[2]; // { name: "extend", celsius: 72, seconds: 90 }
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export function suggestProgramme(reaction) {
|
|
36
|
+
const coolest = reaction.primers.length === 0 ? 60 : Math.min(...reaction.primers.map((one) => one.tm));
|
|
37
|
+
const extend = Math.max(15, Math.ceil(((reaction.length / 1000) * SECONDS_PER_KB) / 5) * 5);
|
|
38
|
+
return {
|
|
39
|
+
initial: { celsius: 95, seconds: 120 },
|
|
40
|
+
steps: [
|
|
41
|
+
{ name: "denature", celsius: 95, seconds: 30 },
|
|
42
|
+
{ name: "anneal", celsius: clamp(Math.round(coolest) - 5, 45, 72), seconds: 30 },
|
|
43
|
+
{ name: "extend", celsius: 72, seconds: extend },
|
|
44
|
+
],
|
|
45
|
+
cycles: 30,
|
|
46
|
+
final: { celsius: 72, seconds: 300 },
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/** A length of time as a machine writes it: minutes and seconds. */
|
|
50
|
+
const clock = (seconds) => `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, "0")}`;
|
|
51
|
+
/**
|
|
52
|
+
* A programme as a thermocycler's screen shows it.
|
|
53
|
+
*
|
|
54
|
+
* @param programme - The programme.
|
|
55
|
+
* @returns The lines, top to bottom.
|
|
56
|
+
*/
|
|
57
|
+
export function screenOf(programme) {
|
|
58
|
+
const row = (label, at) => `${label.padEnd(9)}${String(at.celsius).padStart(3)} °C ${clock(at.seconds).padStart(5)}`;
|
|
59
|
+
return [
|
|
60
|
+
{ text: row("Start", programme.initial) },
|
|
61
|
+
{ text: `${programme.cycles} cycles of` },
|
|
62
|
+
...programme.steps.map((step) => ({ text: row(` ${step.name[0].toUpperCase()}${step.name.slice(1)}`, step), step: step.name })),
|
|
63
|
+
{ text: row("Finish", programme.final) },
|
|
64
|
+
{ text: `About ${clock(runSeconds(programme))} in all` },
|
|
65
|
+
];
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* How long a programme takes, not counting the time the block spends changing temperature.
|
|
69
|
+
*
|
|
70
|
+
* @param programme - The programme.
|
|
71
|
+
* @returns Seconds.
|
|
72
|
+
*/
|
|
73
|
+
export function runSeconds(programme) {
|
|
74
|
+
return programme.initial.seconds + programme.cycles * programme.steps.reduce((sum, step) => sum + step.seconds, 0) + programme.final.seconds;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* What a careful operator would ask of a programme, given the reaction it is for.
|
|
78
|
+
*
|
|
79
|
+
* Each is about this run and may be wrong: an operator who knows their polymerase extends at fifteen
|
|
80
|
+
* seconds a thousand bases can ignore what is said about extension. None of them stops a run.
|
|
81
|
+
*
|
|
82
|
+
* @param programme - The programme as set.
|
|
83
|
+
* @param reaction - The product's length and the primers' melting temperatures.
|
|
84
|
+
* @returns The checks that apply, the ones most likely to matter first.
|
|
85
|
+
*/
|
|
86
|
+
export function programmeChecks(programme, reaction) {
|
|
87
|
+
const checks = [];
|
|
88
|
+
const [denature, anneal, extend] = programme.steps;
|
|
89
|
+
const sorted = [...reaction.primers].sort((a, b) => a.tm - b.tm);
|
|
90
|
+
const coolest = sorted[0];
|
|
91
|
+
const warmest = sorted.at(-1);
|
|
92
|
+
if (coolest !== undefined && anneal.celsius > coolest.tm) {
|
|
93
|
+
checks.push({ about: "anneal", weight: "stop", says: `Annealing at ${anneal.celsius} °C is above ${coolest.name}'s melting temperature, about ${Math.round(coolest.tm)} °C. It may not bind.` });
|
|
94
|
+
}
|
|
95
|
+
else if (coolest !== undefined && anneal.celsius < coolest.tm - 10) {
|
|
96
|
+
checks.push({ about: "anneal", weight: "look", says: `Annealing at ${anneal.celsius} °C is more than ten degrees under the primers' melting temperatures. They may bind in places they should not.` });
|
|
97
|
+
}
|
|
98
|
+
if (coolest !== undefined && warmest !== undefined && warmest.tm - coolest.tm > 5) {
|
|
99
|
+
checks.push({ about: "anneal", weight: "look", says: `${warmest.name} melts about ${Math.round(warmest.tm - coolest.tm)} degrees above ${coolest.name}. No one annealing temperature suits both well.` });
|
|
100
|
+
}
|
|
101
|
+
const wanted = (reaction.length / 1000) * SECONDS_PER_KB;
|
|
102
|
+
if (extend.seconds < wanted / 2) {
|
|
103
|
+
checks.push({ about: "extend", weight: "stop", says: `${extend.seconds} seconds is short for a ${reaction.length.toLocaleString("en-US")} base product. Allow about a minute for every thousand bases unless the polymerase is a fast one.` });
|
|
104
|
+
}
|
|
105
|
+
else if (extend.seconds < wanted) {
|
|
106
|
+
checks.push({ about: "extend", weight: "look", says: `${extend.seconds} seconds is under a minute per thousand bases for a ${reaction.length.toLocaleString("en-US")} base product. Fine for a fast polymerase.` });
|
|
107
|
+
}
|
|
108
|
+
if (denature.celsius < 90)
|
|
109
|
+
checks.push({ about: "denature", weight: "stop", says: `${denature.celsius} °C may not separate the strands. It is usually 94 to 98 °C.` });
|
|
110
|
+
if (programme.cycles > 40)
|
|
111
|
+
checks.push({ about: "cycles", weight: "look", says: `${programme.cycles} cycles is a lot. Past about 35, wrong products build up faster than the right one.` });
|
|
112
|
+
if (programme.cycles < 15)
|
|
113
|
+
checks.push({ about: "cycles", weight: "look", says: `${programme.cycles} cycles may not make enough to see on a gel.` });
|
|
114
|
+
return checks.sort((a, b) => Number(b.weight === "stop") - Number(a.weight === "stop"));
|
|
115
|
+
}
|
|
116
|
+
const PAIR = { A: "T", T: "A", G: "C", C: "G", U: "A", N: "N" };
|
|
117
|
+
const reversed = (bases) => [...bases].reverse().map((base) => PAIR[base] ?? "N").join("");
|
|
118
|
+
/**
|
|
119
|
+
* Where one primer binds a template, if it does.
|
|
120
|
+
*
|
|
121
|
+
* It is looked for by the bases at its 3′ end, which are the ones that have to match, on either
|
|
122
|
+
* strand. Its match is then followed back towards its 5′ end for as long as it holds.
|
|
123
|
+
*
|
|
124
|
+
* @param template - The template's top strand.
|
|
125
|
+
* @param primer - The primer, 5′ to 3′.
|
|
126
|
+
* @param least - How many bases at its 3′ end must match.
|
|
127
|
+
* @returns Where it binds, or `null` if it does not or binds in more than one place.
|
|
128
|
+
*/
|
|
129
|
+
export function primerBinding(template, primer, least = 18) {
|
|
130
|
+
const top = template.replace(/\s+/g, "").toUpperCase();
|
|
131
|
+
const bases = primer.replace(/\s+/g, "").toUpperCase();
|
|
132
|
+
if (bases.length < least || least < 1)
|
|
133
|
+
return null;
|
|
134
|
+
const found = [];
|
|
135
|
+
// Reading as the top strand: its 3′ end is its right-hand end.
|
|
136
|
+
const end3 = bases.slice(-least);
|
|
137
|
+
for (let at = top.indexOf(end3); at !== -1; at = top.indexOf(end3, at + 1)) {
|
|
138
|
+
let matched = least;
|
|
139
|
+
while (matched < bases.length && at - (matched - least) - 1 >= 0 && top[at - (matched - least) - 1] === bases[bases.length - matched - 1])
|
|
140
|
+
matched++;
|
|
141
|
+
found.push({ start: at - (matched - least), end: at + least, reads: "top", tail: bases.length - matched });
|
|
142
|
+
}
|
|
143
|
+
// Reading as the bottom strand: reversed, its 3′ end is its left-hand end.
|
|
144
|
+
const flipped = reversed(bases);
|
|
145
|
+
const start3 = flipped.slice(0, least);
|
|
146
|
+
for (let at = top.indexOf(start3); at !== -1; at = top.indexOf(start3, at + 1)) {
|
|
147
|
+
let matched = least;
|
|
148
|
+
while (matched < flipped.length && at + matched < top.length && top[at + matched] === flipped[matched])
|
|
149
|
+
matched++;
|
|
150
|
+
found.push({ start: at, end: at + matched, reads: "bottom", tail: bases.length - matched });
|
|
151
|
+
}
|
|
152
|
+
return found.length === 1 ? found[0] : null;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* How many strands of each kind a tube holds after some cycles, from one double-stranded template.
|
|
156
|
+
*
|
|
157
|
+
* The template's two strands are never made more of. Each cycle copies them once more into strands
|
|
158
|
+
* that start at a primer and run on past the other one: there are two more of those every cycle.
|
|
159
|
+
* Everything else is the product, cut to length at both ends, and it doubles.
|
|
160
|
+
*
|
|
161
|
+
* @param cycles - How many cycles have finished.
|
|
162
|
+
* @returns The counts. They add up to twice two to the power of the cycles.
|
|
163
|
+
*/
|
|
164
|
+
export function strandCounts(cycles) {
|
|
165
|
+
const done = Math.max(0, Math.floor(cycles));
|
|
166
|
+
return { template: 2, long: 2 * done, product: Math.max(0, 2 ** (done + 1) - 2 * done - 2) };
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* What is in the tube at one step of one cycle.
|
|
170
|
+
*
|
|
171
|
+
* It draws the one thing each early cycle adds, since that is what is hard to picture: the first
|
|
172
|
+
* cycle makes strands that run on past the far primer, the second makes the first strands of exactly
|
|
173
|
+
* the product's length, and from the third the product is double-stranded and takes over.
|
|
174
|
+
*
|
|
175
|
+
* @param length - How long the template is, in bases.
|
|
176
|
+
* @param forward - Where the primer that reads as the top strand binds.
|
|
177
|
+
* @param reverse - Where the primer that reads as the bottom strand binds.
|
|
178
|
+
* @param step - Which step of the cycle.
|
|
179
|
+
* @param cycle - Which cycle, counting from 1.
|
|
180
|
+
* @returns What to draw, how many strands of each kind there are once the cycle ends, and a sentence.
|
|
181
|
+
*/
|
|
182
|
+
export function tubeView(length, forward, reverse, step, cycle) {
|
|
183
|
+
const at = Math.max(1, Math.floor(cycle));
|
|
184
|
+
const template = [
|
|
185
|
+
{ from: 0, to: length, row: 0, kind: "template", points: "right" },
|
|
186
|
+
{ from: 0, to: length, row: 3, kind: "template", points: "left" },
|
|
187
|
+
];
|
|
188
|
+
const primers = [
|
|
189
|
+
{ from: reverse.start, to: reverse.end, row: 1, kind: "primer", points: "left" },
|
|
190
|
+
{ from: forward.start, to: forward.end, row: 2, kind: "primer", points: "right" },
|
|
191
|
+
];
|
|
192
|
+
// What each strand is copied into depends on what it is copied from, which changes over the first cycles.
|
|
193
|
+
const made = (kind) => (at === 1
|
|
194
|
+
? [{ from: 0, to: reverse.end, row: 1, kind, points: "left" }, { from: forward.start, to: length, row: 2, kind, points: "right" }]
|
|
195
|
+
: [{ from: forward.start, to: reverse.end, row: 1, kind, points: "left" }, { from: forward.start, to: reverse.end, row: 2, kind, points: "right" }]);
|
|
196
|
+
const templates = at === 1 ? template
|
|
197
|
+
: at === 2 ? [{ from: forward.start, to: length, row: 0, kind: "long", points: "right" }, { from: 0, to: reverse.end, row: 3, kind: "long", points: "left" }]
|
|
198
|
+
: [{ from: forward.start, to: reverse.end, row: 0, kind: "product", points: "right" }, { from: forward.start, to: reverse.end, row: 3, kind: "product", points: "left" }];
|
|
199
|
+
const counts = strandCounts(step === "extend" ? at : at - 1);
|
|
200
|
+
if (step === "denature") {
|
|
201
|
+
return { strands: templates.map((one) => ({ ...one, moves: "parts" })), counts, says: at === 1
|
|
202
|
+
? "Heat pulls the template's two strands apart. Nothing can be copied until they are single."
|
|
203
|
+
: at === 2 ? "The strands made in the first cycle part from the template. Each starts at a primer and runs on past the other."
|
|
204
|
+
: "Every double strand parts, including the product made so far." };
|
|
205
|
+
}
|
|
206
|
+
if (step === "anneal") {
|
|
207
|
+
return { strands: [...templates, ...primers.map((one) => ({ ...one, moves: "lands" }))], counts, says: "Cooler, the primers find the one place each matches and bind. A primer always points along the strand towards the other primer." };
|
|
208
|
+
}
|
|
209
|
+
return {
|
|
210
|
+
strands: [...templates, ...made(at === 1 ? "long" : "product").map((one) => ({ ...one, moves: "grows" }))], counts,
|
|
211
|
+
says: at === 1 ? "The polymerase copies from each primer to the end of the template. These first copies start in the right place and run on too far."
|
|
212
|
+
: at === 2 ? "Copied from a strand that already starts at a primer, the new strand stops where that one began. These are the first strands of exactly the product's length."
|
|
213
|
+
: "From the third cycle the product is copied from the product. It doubles each cycle, and the over-long strands are left behind.",
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* The real bases at a primer's site, at one moment of one step.
|
|
218
|
+
*
|
|
219
|
+
* The strands in the tube are thousands of bases long and are drawn as lines. This is the same
|
|
220
|
+
* moment magnified at the one place worth reading: where a primer binds. Heat unzips the template
|
|
221
|
+
* there base by base; the primer lands and pairs, A with T and G with C, leaving any tail it carries
|
|
222
|
+
* unpaired; and the polymerase adds the next bases one at a time, each the partner of the base
|
|
223
|
+
* opposite. Every letter is from the lab's own sequences.
|
|
224
|
+
*
|
|
225
|
+
* @param template - The template's top strand.
|
|
226
|
+
* @param primer - The primer, 5′ to 3′.
|
|
227
|
+
* @param binding - Where it binds, from `primerBinding`.
|
|
228
|
+
* @param step - Which step of the cycle.
|
|
229
|
+
* @param through - How far through the step it is, from 0 to 1.
|
|
230
|
+
* @param names - What to call the primer and the template.
|
|
231
|
+
* @returns The two rows of bases, which are paired, and where the polymerase is.
|
|
232
|
+
*/
|
|
233
|
+
export function tubeLens(template, primer, binding, step, through, names = {}) {
|
|
234
|
+
const top = template.replace(/\s+/g, "").toUpperCase();
|
|
235
|
+
const bases = primer.replace(/\s+/g, "").toUpperCase();
|
|
236
|
+
const at = Math.min(Math.max(through, 0), 1);
|
|
237
|
+
const rightward = binding.reads === "top";
|
|
238
|
+
const [ahead, behind] = [22, 3];
|
|
239
|
+
// Room for the primer and its tail, a little behind it, and the first bases copied ahead of it.
|
|
240
|
+
const from = Math.max(0, rightward ? binding.start - binding.tail - behind : binding.start - ahead);
|
|
241
|
+
const to = Math.min(top.length, rightward ? binding.end + ahead : binding.end + binding.tail + behind);
|
|
242
|
+
const places = Array.from({ length: to - from }, (_, index) => from + index);
|
|
243
|
+
const templateName = names.template ?? "template";
|
|
244
|
+
const primerName = names.primer ?? "primer";
|
|
245
|
+
if (step === "denature") {
|
|
246
|
+
// The two strands come apart from one end of the view to the other.
|
|
247
|
+
const joined = places.map((_, index) => (index + 0.5) / places.length > at * 1.2);
|
|
248
|
+
const cell = (base, index) => ({ base, state: joined[index] ? "paired" : "single" });
|
|
249
|
+
return {
|
|
250
|
+
from, to, joined, polymerase: null, beyond: 0,
|
|
251
|
+
upper: { label: `${templateName}, top strand`, cells: places.map((place, index) => cell(top[place], index)) },
|
|
252
|
+
lower: { label: `${templateName}, bottom strand`, cells: places.map((place, index) => cell(PAIR[top[place]] ?? "N", index)) },
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
// The primer, laid where it binds: left to right 5′→3′ if it reads as the top strand, 3′→5′ if not.
|
|
256
|
+
const laid = rightward ? bases : [...bases].reverse().join("");
|
|
257
|
+
const first = rightward ? binding.start - binding.tail : binding.start;
|
|
258
|
+
const primerBase = (place) => (place >= first && place < first + laid.length ? laid[place - first] : "");
|
|
259
|
+
const binds = (place) => place >= binding.start && place < binding.end;
|
|
260
|
+
const width = binding.end - binding.start;
|
|
261
|
+
// Pairs form along the primer from its 5′ end to its 3′ end, in the second half of the step.
|
|
262
|
+
const zipped = (place) => {
|
|
263
|
+
const along = rightward ? place - binding.start : binding.end - 1 - place;
|
|
264
|
+
return step === "extend" || (along + 0.5) / width < (at - 0.45) / 0.5;
|
|
265
|
+
};
|
|
266
|
+
// How many bases the polymerase has added, of those the view has room for.
|
|
267
|
+
const room = rightward ? to - binding.end : binding.start - from;
|
|
268
|
+
const added = step === "extend" ? Math.min(room, Math.floor(at * (room + 1))) : 0;
|
|
269
|
+
const copied = (place) => (rightward ? place >= binding.end && place < binding.end + added : place < binding.start && place >= binding.start - added);
|
|
270
|
+
const joined = places.map((place) => (binds(place) && zipped(place)) || copied(place));
|
|
271
|
+
const strand = places.map((place, index) => {
|
|
272
|
+
if (copied(place))
|
|
273
|
+
return { base: rightward ? top[place] : PAIR[top[place]] ?? "N", state: "fresh" };
|
|
274
|
+
const base = primerBase(place);
|
|
275
|
+
return { base, state: base !== "" && joined[index] ? "paired" : "single" };
|
|
276
|
+
});
|
|
277
|
+
const other = places.map((place, index) => ({ base: rightward ? PAIR[top[place]] ?? "N" : top[place], state: joined[index] ? "paired" : "single" }));
|
|
278
|
+
const length = rightward ? top.length - binding.end : binding.start;
|
|
279
|
+
return {
|
|
280
|
+
from, to, joined,
|
|
281
|
+
polymerase: step === "extend" && added < room ? (rightward ? binding.end + added : binding.start - added - 1) - from : null,
|
|
282
|
+
beyond: step === "extend" ? Math.max(0, length - added) : 0,
|
|
283
|
+
upper: rightward ? { label: step === "extend" ? `${primerName}, and the copy` : primerName, cells: strand } : { label: `${templateName}, top strand`, cells: other },
|
|
284
|
+
lower: rightward ? { label: `${templateName}, bottom strand`, cells: other } : { label: step === "extend" ? `${primerName}, and the copy` : primerName, cells: strand },
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
//# sourceMappingURL=pcr-scene.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pcr-scene.js","sourceRoot":"","sources":["../src/pcr-scene.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAmCH,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,KAAa,EAAE,IAAY,EAAU,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;AAE7G,iFAAiF;AACjF,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAC;AAEjC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAqB;IACpD,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IACxG,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5F,OAAO;QACL,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE;QACtC,KAAK,EAAE;YACL,EAAE,IAAI,EAA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AK,EAAE,GAAG,YAAY,cAAc,EAAE,KAAK,EAAE,KAAK,EAAE;QACpK,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,YAAY,iBAAiB,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,UAAU,gBAAgB,CAAC,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE;KACxK,CAAC;AACJ,CAAC"}
|
package/dist/pcr-tool.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pcr-tool.d.ts","sourceRoot":"","sources":["../src/pcr-tool.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pcr-tool.d.ts","sourceRoot":"","sources":["../src/pcr-tool.tsx"],"names":[],"mappings":"AAsCA;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CAAC,EAAE,UAAiB,EAAE,MAAM,EAAE,EAAE;IAAE,UAAU,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,sCA+G/H"}
|
package/dist/pcr-tool.js
CHANGED
|
@@ -9,6 +9,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
9
9
|
*/
|
|
10
10
|
import { useMemo, useState } from "react";
|
|
11
11
|
import { useAct, useLab } from "@biolibs/bionet-react";
|
|
12
|
+
import { Glossed } from "@biolibs/glossary-react";
|
|
12
13
|
import { primerTm } from "./pcr.js";
|
|
13
14
|
import { pcrRun, pcrTubes } from "./run.js";
|
|
14
15
|
const whole = (text) => (text.trim() === "" ? undefined : Number(text));
|
|
@@ -64,7 +65,7 @@ export function PcrTool({ instrument = null, onDone }) {
|
|
|
64
65
|
const product = run.plan !== null && run.plan.problem === null ? run.plan.products[0] : null;
|
|
65
66
|
const here = lab.runs.filter((one) => one.kind === "pcr" && (instrument === null || one.instrument === instrument.id)).slice(-5).reverse();
|
|
66
67
|
const partName = (checksum) => lab.parts.find((part) => part.checksum === checksum)?.name ?? "a part";
|
|
67
|
-
return (_jsxs("div", { className: "pcr", children: [_jsxs("section", { className: "card", children: [_jsxs("div", { className: "toolhead", children: [_jsxs("div", { children: [_jsxs("h2", { children: ["PCR", instrument === null ? "" : ` · ${instrument.name}`] }), _jsx("p", { className: "dim small", children: "Choose tubes from the freezer. The product is worked out from their sequences, and recording the run takes what was used from each." })] }), onDone !== undefined && _jsx("button", { type: "button", className: "quiet", onClick: onDone, children: "Back to the lab" })] }), tubes.templates.length === 0 ? _jsx("p", { className: "empty", children: "There are no tubes to run a PCR from. Add a part and a tube of it on the Freezer tab." }) : (_jsxs("fieldset", { disabled: busy, className: "choose", children: [_jsx(Tube, { label: "Template", name: "template", choices: tubes.templates, value: template, onChange: (item) => { setTemplate(item); setSaid(null); }, used: used.template, onUsed: (value) => setUsed({ ...used, template: value }) }), _jsx(Tube, { label: "Forward primer", name: "forward", choices: tubes.primers, value: forward, onChange: (item) => { setForward(item); setSaid(null); }, used: used.forward, onUsed: (value) => setUsed({ ...used, forward: value }) }), _jsx(Tube, { label: "Reverse primer", name: "reverse", choices: tubes.primers, value: reverse, onChange: (item) => { setReverse(item); setSaid(null); }, used: used.reverse, onUsed: (value) => setUsed({ ...used, reverse: value }) }), _jsxs("label", { className: "least", children: ["Bases at each primer's 3\u2032 end that must bind", _jsx("input", { type: "number", min: 8, max: 60, step: 1, value: least, onChange: (event) => setLeast(event.target.value) })] })] }))] }), run.plan !== null && (_jsxs("section", { className: "card", children: [_jsx("h2", { children: "What it makes" }), product === null ? _jsx("p", { className: "trouble", role: "status", children: run.plan.problem }) : (_jsxs(_Fragment, { children: [_jsxs("p", { children: [_jsxs("strong", { children: [product.length, " bp"] }), " ", _jsx("span", { className: "dim", children: "linear" })] }), _jsx("code", { className: "wrap", children: product.length <= 120 ? product.sequence : `${product.sequence.slice(0, 60)} … ${product.sequence.slice(-60)}` })] })), _jsxs("fieldset", { disabled: busy, className: "stack", children: [product !== null && (_jsxs("div", { className: "row tight", children: [_jsxs("label", { children: ["Call the product", _jsx("input", { value: name, onChange: (event) => setName(event.target.value), placeholder: run.name, maxLength: 200 })] }), _jsxs("label", { children: ["Amount", _jsx("input", { type: "number", min: 0, step: 1, value: amount, onChange: (event) => setAmount(event.target.value), className: "num" })] }), _jsxs("label", { children: ["Unit", _jsx("input", { value: unit, onChange: (event) => setUnit(event.target.value), maxLength: 20, className: "num" })] })] })), _jsxs("label", { children: ["Note", _jsx("input", { value: note, onChange: (event) => setNote(event.target.value), placeholder: "Anything worth remembering about this run", maxLength: 2000 })] }), _jsxs("div", { className: "row", children: [product !== null && _jsx("button", { type: "button", onClick: () => void record(run.worked, `Recorded. There is a new tube of ${run.name}, not yet put anywhere.`), children: "Record the run" }), _jsx("button", { type: "button", className: "quiet", onClick: () => void record(run.failed, "Recorded as a run that gave nothing. The tubes were used all the same."), children: "It was run and gave nothing" })] })] }), said !== null && _jsx("p", { className: "small", role: "status", children: said })] })), here.length > 0 && (_jsxs("section", { className: "card", children: [_jsxs("h2", { children: ["Recent runs", instrument === null ? "" : " here"] }), _jsxs("table", { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "Template" }), _jsx("th", { children: "Made" }), _jsx("th", { children: "Note" })] }) }), _jsx("tbody", { children: here.map((one) => {
|
|
68
|
+
return (_jsxs("div", { className: "pcr", children: [_jsxs("section", { className: "card", children: [_jsxs("div", { className: "toolhead", children: [_jsxs("div", { children: [_jsxs("h2", { children: ["PCR", instrument === null ? "" : ` · ${instrument.name}`] }), _jsx("p", { className: "dim small", children: _jsx(Glossed, { text: "PCR copies the stretch of a template that lies between two primers. Choose tubes from the freezer. The product is worked out from their sequences, and recording the run takes what was used from each." }) })] }), onDone !== undefined && _jsx("button", { type: "button", className: "quiet", onClick: onDone, children: "Back to the lab" })] }), tubes.templates.length === 0 ? _jsx("p", { className: "empty", children: "There are no tubes to run a PCR from. Add a part and a tube of it on the Freezer tab." }) : (_jsxs("fieldset", { disabled: busy, className: "choose", children: [_jsx(Tube, { label: "Template", name: "template", choices: tubes.templates, value: template, onChange: (item) => { setTemplate(item); setSaid(null); }, used: used.template, onUsed: (value) => setUsed({ ...used, template: value }) }), _jsx(Tube, { label: "Forward primer", name: "forward", choices: tubes.primers, value: forward, onChange: (item) => { setForward(item); setSaid(null); }, used: used.forward, onUsed: (value) => setUsed({ ...used, forward: value }) }), _jsx(Tube, { label: "Reverse primer", name: "reverse", choices: tubes.primers, value: reverse, onChange: (item) => { setReverse(item); setSaid(null); }, used: used.reverse, onUsed: (value) => setUsed({ ...used, reverse: value }) }), _jsxs("label", { className: "least", children: ["Bases at each primer's 3\u2032 end that must bind", _jsx("input", { type: "number", min: 8, max: 60, step: 1, value: least, onChange: (event) => setLeast(event.target.value) })] })] }))] }), run.plan !== null && (_jsxs("section", { className: "card", children: [_jsx("h2", { children: "What it makes" }), product === null ? _jsx("p", { className: "trouble", role: "status", children: run.plan.problem }) : (_jsxs(_Fragment, { children: [_jsxs("p", { children: [_jsxs("strong", { children: [product.length, " bp"] }), " ", _jsx("span", { className: "dim", children: "linear" })] }), _jsx("code", { className: "wrap", children: product.length <= 120 ? product.sequence : `${product.sequence.slice(0, 60)} … ${product.sequence.slice(-60)}` })] })), _jsxs("fieldset", { disabled: busy, className: "stack", children: [product !== null && (_jsxs("div", { className: "row tight", children: [_jsxs("label", { children: ["Call the product", _jsx("input", { value: name, onChange: (event) => setName(event.target.value), placeholder: run.name, maxLength: 200 })] }), _jsxs("label", { children: ["Amount", _jsx("input", { type: "number", min: 0, step: 1, value: amount, onChange: (event) => setAmount(event.target.value), className: "num" })] }), _jsxs("label", { children: ["Unit", _jsx("input", { value: unit, onChange: (event) => setUnit(event.target.value), maxLength: 20, className: "num" })] })] })), _jsxs("label", { children: ["Note", _jsx("input", { value: note, onChange: (event) => setNote(event.target.value), placeholder: "Anything worth remembering about this run", maxLength: 2000 })] }), _jsxs("div", { className: "row", children: [product !== null && _jsx("button", { type: "button", onClick: () => void record(run.worked, `Recorded. There is a new tube of ${run.name}, not yet put anywhere.`), children: "Record the run" }), _jsx("button", { type: "button", className: "quiet", onClick: () => void record(run.failed, "Recorded as a run that gave nothing. The tubes were used all the same."), children: "It was run and gave nothing" })] })] }), said !== null && _jsx("p", { className: "small", role: "status", children: said })] })), here.length > 0 && (_jsxs("section", { className: "card", children: [_jsxs("h2", { children: ["Recent runs", instrument === null ? "" : " here"] }), _jsxs("table", { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "Template" }), _jsx("th", { children: "Made" }), _jsx("th", { children: "Note" })] }) }), _jsx("tbody", { children: here.map((one) => {
|
|
68
69
|
const from = lab.items.find((item) => item.item === one.inputs.find((input) => input.role === "template")?.item);
|
|
69
70
|
return (_jsxs("tr", { children: [_jsx("td", { children: from === undefined ? "a tube" : partName(from.part) }), _jsx("td", { children: one.outcome === "worked" ? one.outputs.map((made) => partName(made.part)).join(", ") : _jsx("span", { className: "badge", children: "gave nothing" }) }), _jsx("td", { className: "dim", children: one.note ?? "" })] }, one.run));
|
|
70
71
|
}) })] })] }))] }));
|