@biolibs/gel 1.0.0 → 1.0.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 CHANGED
@@ -1,8 +1,9 @@
1
1
  # @biolibs/gel
2
2
 
3
- A virtual agarose gel: where DNA fragments of a given size would run, and which of them a gel would tell
4
- apart. This is the data behind the gel photograph that a tool such as SnapGene or Benchling draws beside
5
- a digest.
3
+ A virtual gel: where a molecule of a given size would run, and which sizes a gel would tell apart.
4
+ Agarose for DNA, sorted by length in base pairs; polyacrylamide for protein, sorted by mass in
5
+ kilodaltons. This is the data behind the gel photograph that a tool such as SnapGene or Benchling draws
6
+ beside a digest.
6
7
 
7
8
  - **`bandPosition`** — log-linear migration over the range a gel resolves, 0 at the wells and 1 at the
8
9
  front
@@ -12,6 +13,8 @@ a digest.
12
13
  - **`LADDERS`** — the generic 1 kb and 100 bp size markers, and `ladderBands` to run them
13
14
  - **`fragmentSizes`** — cut positions to fragment lengths, linear or circular, with no enzyme library
14
15
  needed
16
+ - **`PROTEIN_GELS`** — four acrylamide concentrations (7.5, 10, 12, 15%) and the kilodalton range each
17
+ one resolves, with `PROTEIN_LADDERS`, `proteinBands` and `proteinBandPosition`
15
18
  - **One dependency**, `@biolibs/core`, for the error class
16
19
 
17
20
  ## What is verified
@@ -288,6 +291,37 @@ on their ratio and the width of the gel's range in logs — which for the 1.0% a
288
291
  the same (both span a factor of 40). Picking a gel is about which fragments fall **inside** the range,
289
292
  not about stretching the ones that already do.
290
293
 
294
+ ## Protein on acrylamide
295
+
296
+ A protein gel is read the same way, and the functions are shared rather than copied: `bandPosition` and
297
+ `bandsOf` take a `Resolving` — a largest and a smallest — and not a kind of gel. What changes is the
298
+ unit. SDS coats a chain with much the same charge for every unit of mass and undoes its shape, so what
299
+ is left to sort proteins by is size, and over the range a gel resolves the distance run is again close
300
+ to a straight line against the logarithm of it.
301
+
302
+ ```ts
303
+ import { bandPosition, proteinBandPosition, proteinBands, proteinGelById, proteinLadderById } from "@biolibs/gel";
304
+
305
+ const gel = proteinGelById("12");
306
+ [gel.percent, gel.largest, gel.smallest]; // [12, 100, 10] — kilodaltons, not base pairs
307
+
308
+ proteinBandPosition(100, gel); // 0 — at the well
309
+ proteinBandPosition(10, gel); // 1 — at the front
310
+ proteinBandPosition(Math.sqrt(100 * 10), gel)
311
+ .toFixed(4); // "0.5000" — the geometric mean, halfway
312
+
313
+ // The same arithmetic, which is the point of sharing it.
314
+ proteinBandPosition(28, gel) === bandPosition(28, { largest: 100, smallest: 10 }); // true
315
+
316
+ proteinLadderById("broad").sizes; // [250, 150, 100, 75, 50, 37, 25, 20, 15, 10]
317
+ proteinBands([28, 28.5, 62], gel).length; // 2 — 28 and 28.5 run as one band
318
+ ```
319
+
320
+ Two things about a real protein gel that this model does not know, and that matter when a band is read
321
+ against it: a prestained marker's bands are themselves calibrated and run a little off their printed
322
+ weights, and a protein that is glycosylated or not fully reduced runs at a size that is not the mass its
323
+ sequence comes to.
324
+
291
325
  ## Testing
292
326
 
293
327
  ```bash
@@ -324,6 +358,8 @@ Coverage from this package's own tests — `npx vitest run --coverage packages/g
324
358
  - **Cuts are 0-based boundaries**, one less than Biopython reports. `@biolibs/cloning`'s `cutsIn`
325
359
  converts for you.
326
360
  - **A ladder is drawn evenly.** Every marker gets `intensity: 1`, which no real ladder does.
361
+ - **The unit is the caller's to remember.** A `Band`'s `size` is base pairs on agarose and kilodaltons on
362
+ acrylamide; nothing in the type says which, so say it when you print it.
327
363
 
328
364
  ## License
329
365
 
package/dist/bands.d.ts CHANGED
@@ -11,16 +11,16 @@
11
11
  * the gel's range are not separated at all, so they are merged regardless of tolerance: the small ones pile up
12
12
  * together at the front, and the large ones stay bunched at the wells.
13
13
  */
14
- import type { GelType } from "./gels.js";
14
+ import type { Resolving } from "./gels.js";
15
15
  /** Default band-merging tolerance: fragments within 3% of each other run as one band. */
16
16
  export declare const DEFAULT_TOLERANCE = 0.03;
17
17
  /**
18
18
  * How far down the gel a fragment of `size` runs, as a fraction of the distance from the wells to the front.
19
19
  *
20
- * @param size - Fragment length in base pairs.
21
- * @param gel - The gel being run.
22
- * @returns 0 at the wells, 1 at the front. Fragments larger than {@link GelType.largest} clamp to 0 and ones
23
- * smaller than {@link GelType.smallest} clamp to 1, since the gel does not separate them.
20
+ * @param size - Fragment length in base pairs, or a protein's mass in kilodaltons.
21
+ * @param gel - The range the gel separates.
22
+ * @returns 0 at the wells, 1 at the front. Fragments larger than {@link Resolving.largest} clamp to 0 and ones
23
+ * smaller than {@link Resolving.smallest} clamp to 1, since the gel does not separate them.
24
24
  * @throws {@link ValueError} for a size that is not a positive finite number.
25
25
  * @example
26
26
  * ```ts
@@ -30,7 +30,7 @@ export declare const DEFAULT_TOLERANCE = 0.03;
30
30
  * bandPosition(1581, gel); // ~0.5 (the geometric mean of the two ends)
31
31
  * ```
32
32
  */
33
- export declare function bandPosition(size: number, gel: GelType): number;
33
+ export declare function bandPosition(size: number, gel: Resolving): number;
34
34
  /**
35
35
  * Whether a gel separates a fragment of this size from its neighbours, i.e. whether it falls inside the gel's
36
36
  * resolving range.
@@ -39,18 +39,18 @@ export declare function bandPosition(size: number, gel: GelType): number;
39
39
  * @param gel - The gel being run.
40
40
  * @returns `true` when `gel.smallest <= size <= gel.largest`.
41
41
  */
42
- export declare const resolves: (size: number, gel: GelType) => boolean;
42
+ export declare const resolves: (size: number, gel: Resolving) => boolean;
43
43
  /** One visible band: the fragments that run together at a single place on the gel. */
44
44
  export interface Band {
45
- /** Representative size in base pairs — the largest fragment in the band. */
45
+ /** Representative size — the largest in the band, in whatever the gel sorts by: base pairs for DNA, kilodaltons for protein. */
46
46
  size: number;
47
- /** Every fragment size merged into this band, largest first. */
47
+ /** Every size merged into this band, largest first. */
48
48
  sizes: readonly number[];
49
49
  /** Distance from the wells, 0 to 1, as {@link bandPosition} gives it. */
50
50
  position: number;
51
- /** Total base pairs in the band; a band holding more DNA stains more brightly. */
51
+ /** The sizes in the band added up; a band holding more of what is stained shows more brightly. */
52
52
  totalBases: number;
53
- /** Brightness from 0 to 1, the band's share of the lane's base pairs, scaled so the heaviest band is 1. */
53
+ /** Brightness from 0 to 1, the band's share of the lane's total, scaled so the heaviest band is 1. */
54
54
  intensity: number;
55
55
  /**
56
56
  * True when every fragment in the band is outside the gel's resolving range, so the gel does not separate them:
@@ -73,7 +73,7 @@ export interface Band {
73
73
  * bandsOf([2000, 2010, 500], gel).length; // 2 — 2000 and 2010 run together
74
74
  * ```
75
75
  */
76
- export declare function bandsOf(sizes: readonly number[], gel: GelType, tolerance?: number): Band[];
76
+ export declare function bandsOf(sizes: readonly number[], gel: Resolving, tolerance?: number): Band[];
77
77
  /**
78
78
  * The bands a ladder would show on a gel, as a lane of single fragments.
79
79
  *
@@ -83,5 +83,5 @@ export declare function bandsOf(sizes: readonly number[], gel: GelType, toleranc
83
83
  * marked `unresolved` but, unlike a sample lane, are never merged: a ladder's bands are known sizes and worth
84
84
  * showing individually even where the gel would not separate them.
85
85
  */
86
- export declare function ladderBands(ladderSizes: readonly number[], gel: GelType): Band[];
86
+ export declare function ladderBands(ladderSizes: readonly number[], gel: Resolving): Band[];
87
87
  //# sourceMappingURL=bands.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bands.d.ts","sourceRoot":"","sources":["../src/bands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,yFAAyF;AACzF,eAAO,MAAM,iBAAiB,OAAO,CAAC;AAEtC;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,MAAM,CAQ/D;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,GAAI,MAAM,MAAM,EAAE,KAAK,OAAO,KAAG,OAAsD,CAAC;AAE7G,sFAAsF;AACtF,MAAM,WAAW,IAAI;IACnB,4EAA4E;IA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AAC;IAClB;;;OAGG;IACH,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,SAAoB,GAAG,IAAI,EAAE,CAoCvG;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,EAAE,GAAG,EAAE,SAAS,GAAG,IAAI,EAAE,CAWlF"}
package/dist/bands.js CHANGED
@@ -17,10 +17,10 @@ export const DEFAULT_TOLERANCE = 0.03;
17
17
  /**
18
18
  * How far down the gel a fragment of `size` runs, as a fraction of the distance from the wells to the front.
19
19
  *
20
- * @param size - Fragment length in base pairs.
21
- * @param gel - The gel being run.
22
- * @returns 0 at the wells, 1 at the front. Fragments larger than {@link GelType.largest} clamp to 0 and ones
23
- * smaller than {@link GelType.smallest} clamp to 1, since the gel does not separate them.
20
+ * @param size - Fragment length in base pairs, or a protein's mass in kilodaltons.
21
+ * @param gel - The range the gel separates.
22
+ * @returns 0 at the wells, 1 at the front. Fragments larger than {@link Resolving.largest} clamp to 0 and ones
23
+ * smaller than {@link Resolving.smallest} clamp to 1, since the gel does not separate them.
24
24
  * @throws {@link ValueError} for a size that is not a positive finite number.
25
25
  * @example
26
26
  * ```ts
package/dist/bands.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"bands.js","sourceRoot":"","sources":["../src/bands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,yFAAyF;AACzF,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAEtC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,GAAY;IACrD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,I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ell apart*, and are not
7
7
  * measurements of migration distance — a real gel depends on buffer, voltage, run time and the dye used.
8
8
  */
9
+ /**
10
+ * The range of sizes a gel separates, whatever is being run on it.
11
+ *
12
+ * It is this and not a kind of gel because the arithmetic of a band's position is the same
13
+ * arithmetic either way: the two ends bracket the range over which the log-linear model in
14
+ * {@link bandPosition} holds, and the unit they are in is whatever the gel sorts by — base pairs for
15
+ * DNA on agarose, kilodaltons for protein on acrylamide.
16
+ */
17
+ export interface Resolving {
18
+ /** The largest the gel still separates. */
19
+ largest: number;
20
+ /** The smallest the gel still separates. */
21
+ smallest: number;
22
+ }
9
23
  /**
10
24
  * One agarose concentration and the fragment sizes it resolves.
11
25
  *
@@ -13,7 +27,7 @@
13
27
  * it, fragments still migrate but are not separated: above `largest` they stay bunched near the wells, below
14
28
  * `smallest` they run off together at the front.
15
29
  */
16
- export interface GelType {
30
+ export interface GelType extends Resolving {
17
31
  /** Short identifier, e.g. `"1.0"`. */
18
32
  id: string;
19
33
  /** Agarose concentration as a percentage (w/v). */
@@ -1 +1 @@
1
- {"version":3,"file":"gels.d.ts","sourceRoot":"","sources":["../src/gels.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;;;;;GAMG;AACH,MAAM,WAAW,OAAO;IACtB,sCAAsC;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,mDAAmD;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,gEAAgE;IAChE,OAAO,EAAE,MAAM,CAAC;IAChB,iEAAiE;IACjE,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,IAAI,EAAE,SAAS,OAAO,EAKlC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAI3C"}
1
+ {"version":3,"file":"gels.d.ts","sourceRoot":"","sources":["../src/gels.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;;;;;;GAOG;AAC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AE,MAAM,IAAI,UAAU,CAAC,gBAAgB,EAAE,qBAAqB,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1G,OAAO,GAAG,CAAC;AACb,CAAC"}
package/dist/index.d.ts CHANGED
@@ -8,10 +8,11 @@
8
8
  * resolves, described in `bands.ts`. The figures are conventional working values for agarose in TAE, enough to show
9
9
  * which fragments would be distinguishable, not measurements of a particular rig.
10
10
  *
11
- * - `gels.ts`: `GelType`, `GELS`, `gelById` — agarose concentrations and their resolving ranges
11
+ * - `gels.ts`: `Resolving`, `GelType`, `GELS`, `gelById` — agarose concentrations and their resolving ranges
12
12
  * - `ladders.ts`: `Ladder`, `LADDERS`, `ladderById` — size markers
13
13
  * - `bands.ts`: `bandPosition`, `resolves`, `Band`, `bandsOf`, `ladderBands` — fragment sizes to visible bands
14
14
  * - `fragments.ts`: `Topology`, `fragmentSizes` — cut positions to fragment lengths
15
+ * - `protein.ts`: `ProteinGel`, `PROTEIN_GELS`, `PROTEIN_LADDERS`, `proteinBands` — the same, for protein on acrylamide
15
16
  *
16
17
  * @example
17
18
  * ```ts
@@ -28,4 +29,5 @@ export * from "./gels.js";
28
29
  export * from "./ladders.js";
29
30
  export * from "./bands.js";
30
31
  export * from "./fragments.js";
32
+ export * from "./protein.js";
31
33
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC"}
package/dist/index.js CHANGED
@@ -8,10 +8,11 @@
8
8
  * resolves, described in `bands.ts`. The figures are conventional working values for agarose in TAE, enough to show
9
9
  * which fragments would be distinguishable, not measurements of a particular rig.
10
10
  *
11
- * - `gels.ts`: `GelType`, `GELS`, `gelById` — agarose concentrations and their resolving ranges
11
+ * - `gels.ts`: `Resolving`, `GelType`, `GELS`, `gelById` — agarose concentrations and their resolving ranges
12
12
  * - `ladders.ts`: `Ladder`, `LADDERS`, `ladderById` — size markers
13
13
  * - `bands.ts`: `bandPosition`, `resolves`, `Band`, `bandsOf`, `ladderBands` — fragment sizes to visible bands
14
14
  * - `fragments.ts`: `Topology`, `fragmentSizes` — cut positions to fragment lengths
15
+ * - `protein.ts`: `ProteinGel`, `PROTEIN_GELS`, `PROTEIN_LADDERS`, `proteinBands` — the same, for protein on acrylamide
15
16
  *
16
17
  * @example
17
18
  * ```ts
@@ -28,4 +29,5 @@ export * from "./gels.js";
28
29
  export * from "./ladders.js";
29
30
  export * from "./bands.js";
30
31
  export * from "./fragments.js";
32
+ export * from "./protein.js";
31
33
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC"}
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Polyacrylamide gels for protein, and the markers run beside them.
3
+ *
4
+ * A protein gel is read the same way an agarose one is, and for the same reason: a mesh holds large
5
+ * molecules back more than small ones, so over the range a gel resolves the distance run is close to
6
+ * a straight line against the logarithm of size. The one difference is what is being measured.
7
+ * Agarose sorts DNA by length in base pairs; SDS-PAGE sorts protein by mass in kilodaltons, because
8
+ * the detergent coats every chain with much the same charge per unit mass and undoes its shape, so
9
+ * what is left to tell two proteins apart is how big they are. That is why {@link bandPosition} and
10
+ * {@link bandsOf} are the functions used here too: they take a resolving range, not a kind of gel.
11
+ *
12
+ * The percentages and ranges are the conventional working figures printed in supplier guides for
13
+ * SDS-PAGE in Tris-glycine. They say which proteins a gel would *tell apart*, and are not
14
+ * measurements. Two things to keep in mind when reading a real gel against them: a prestained
15
+ * marker's bands are calibrated against unstained standards and run a little off their printed
16
+ * weights, and a protein that is glycosylated, or that has not been fully reduced, runs at a size
17
+ * that is not the mass its sequence comes to.
18
+ */
19
+ import { type Band } from "./bands.js";
20
+ /** One acrylamide concentration and the protein sizes it resolves, in kilodaltons. */
21
+ export interface ProteinGel {
22
+ /** Short identifier, e.g. `"12"`. */
23
+ id: string;
24
+ /** Acrylamide concentration as a percentage (w/v). */
25
+ percent: number;
26
+ /** Largest protein, in kilodaltons, the gel still separates. */
27
+ largest: number;
28
+ /** Smallest protein, in kilodaltons, the gel still separates. */
29
+ smallest: number;
30
+ }
31
+ /**
32
+ * The four acrylamide concentrations in common use, from the one that resolves the largest proteins
33
+ * to the one that resolves the smallest.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * PROTEIN_GELS.find((g) => g.percent === 12)?.largest; // 100
38
+ * ```
39
+ */
40
+ export declare const PROTEIN_GELS: readonly ProteinGel[];
41
+ /**
42
+ * Look a protein gel up by its {@link ProteinGel.id}.
43
+ *
44
+ * @param id - An id from {@link PROTEIN_GELS}, e.g. `"12"`.
45
+ * @returns The matching gel.
46
+ * @throws {@link ValueError} if no protein gel has that id.
47
+ */
48
+ export declare function proteinGelById(id: string): ProteinGel;
49
+ /** A set of protein marker bands of known mass. */
50
+ export interface ProteinLadder {
51
+ /** Short identifier, e.g. `"broad"`. */
52
+ id: string;
53
+ /** Display name. */
54
+ name: string;
55
+ /** Band masses in kilodaltons, largest first. */
56
+ sizes: readonly number[];
57
+ }
58
+ /**
59
+ * The generic broad-range and low-range protein markers.
60
+ *
61
+ * These are the nominal weights printed on the tube. A prestained marker runs a little off them,
62
+ * which is why a band is read against the marker in the lane beside it rather than off a distance.
63
+ */
64
+ export declare const PROTEIN_LADDERS: readonly ProteinLadder[];
65
+ /**
66
+ * Look a protein marker up by its {@link ProteinLadder.id}.
67
+ *
68
+ * @param id - An id from {@link PROTEIN_LADDERS}, e.g. `"broad"`.
69
+ * @returns The matching marker.
70
+ * @throws {@link ValueError} if no marker has that id.
71
+ */
72
+ export declare function proteinLadderById(id: string): ProteinLadder;
73
+ /**
74
+ * How far down a protein gel a band of a given mass runs, as a fraction of the way from the wells to
75
+ * the front.
76
+ *
77
+ * @param kilodaltons - The protein's mass.
78
+ * @param gel - The gel being run.
79
+ * @returns 0 at the wells, 1 at the front, clamped outside the range the gel separates.
80
+ * @throws {@link ValueError} for a mass that is not a positive finite number.
81
+ * @example
82
+ * ```ts
83
+ * proteinBandPosition(100, proteinGelById("12")); // 0 — at the top of what 12% separates
84
+ * ```
85
+ */
86
+ export declare const proteinBandPosition: (kilodaltons: number, gel: ProteinGel) => number;
87
+ /**
88
+ * The bands a lane of protein would show.
89
+ *
90
+ * @param kilodaltons - The masses in the lane, in any order.
91
+ * @param gel - The gel being run.
92
+ * @param tolerance - Relative difference below which two proteins run as one band.
93
+ * @returns The bands, heaviest first. {@link Band.size} and {@link Band.sizes} are in kilodaltons.
94
+ */
95
+ export declare const proteinBands: (kilodaltons: readonly number[], gel: ProteinGel, tolerance?: number) => Band[];
96
+ /**
97
+ * The bands a protein marker would show, as a lane of single known masses.
98
+ *
99
+ * @param sizes - The marker's band masses, in kilodaltons.
100
+ * @param gel - The gel being run.
101
+ * @returns One band per marker, heaviest first.
102
+ */
103
+ export declare const proteinLadderBands: (sizes: readonly number[], gel: ProteinGel) => Band[];
104
+ //# sourceMappingURL=protein.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protein.d.ts","sourceRoot":"","sources":["../src/protein.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EAAsC,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAE3E,sFAAsF;AACtF,MAAM,WAAW,UAAU;IACzB,qCAAqC;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,sDAAsD;IACtD,OAAO,EAAE,MAAM,CAAC;IAChB,gEAAgE;IAChE,OAAO,EAAE,MAAM,CAAC;IAChB,iEAAiE;IACjE,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,EAAE,SAAS,UAAU,EAK7C,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU,CAIrD;AAED,mDAAmD;AACnD,MAAM,WAAW,aAAa;IAC5B,wCAAwC;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1B;AAED;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAAE,SAAS,aAAa,EAGnD,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,aAAa,CAI3D;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,mBAAmB,GAAI,aAAa,MAAM,EAAE,KAAK,UAAU,KAAG,MAAwC,CAAC;AAEpH;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,GAAI,aAAa,SAAS,MAAM,EAAE,EAAE,KAAK,UAAU,EAAE,YAAY,MAAM,KAAG,IAAI,EACjE,CAAC;AAEvC;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAAI,OAAO,SAAS,MAAM,EAAE,EAAE,KAAK,UAAU,KAAG,IAAI,EAA6B,CAAC"}
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Polyacrylamide gels for protein, and the markers run beside them.
3
+ *
4
+ * A protein gel is read the same way an agarose one is, and for the same reason: a mesh holds large
5
+ * molecules back more than small ones, so over the range a gel resolves the distance run is close to
6
+ * a straight line against the logarithm of size. The one difference is what is being measured.
7
+ * Agarose sorts DNA by length in base pairs; SDS-PAGE sorts protein by mass in kilodaltons, because
8
+ * the detergent coats every chain with much the same charge per unit mass and undoes its shape, so
9
+ * what is left to tell two proteins apart is how big they are. That is why {@link bandPosition} and
10
+ * {@link bandsOf} are the functions used here too: they take a resolving range, not a kind of gel.
11
+ *
12
+ * The percentages and ranges are the conventional working figures printed in supplier guides for
13
+ * SDS-PAGE in Tris-glycine. They say which proteins a gel would *tell apart*, and are not
14
+ * measurements. Two things to keep in mind when reading a real gel against them: a prestained
15
+ * marker's bands are calibrated against unstained standards and run a little off their printed
16
+ * weights, and a protein that is glycosylated, or that has not been fully reduced, runs at a size
17
+ * that is not the mass its sequence comes to.
18
+ */
19
+ import { ValueError } from "@biolibs/core";
20
+ import { bandPosition, bandsOf, ladderBands } from "./bands.js";
21
+ /**
22
+ * The four acrylamide concentrations in common use, from the one that resolves the largest proteins
23
+ * to the one that resolves the smallest.
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * PROTEIN_GELS.find((g) => g.percent === 12)?.largest; // 100
28
+ * ```
29
+ */
30
+ export const PROTEIN_GELS = [
31
+ { id: "7.5", percent: 7.5, largest: 200, smallest: 40 },
32
+ { id: "10", percent: 10, largest: 150, smallest: 20 },
33
+ { id: "12", percent: 12, largest: 100, smallest: 10 },
34
+ { id: "15", percent: 15, largest: 60, smallest: 5 },
35
+ ];
36
+ /**
37
+ * Look a protein gel up by its {@link ProteinGel.id}.
38
+ *
39
+ * @param id - An id from {@link PROTEIN_GELS}, e.g. `"12"`.
40
+ * @returns The matching gel.
41
+ * @throws {@link ValueError} if no protein gel has that id.
42
+ */
43
+ export function proteinGelById(id) {
44
+ const gel = PROTEIN_GELS.find((one) => one.id === id);
45
+ if (!gel)
46
+ throw new ValueError(`unknown protein gel '${id}'; known protein gels are ${PROTEIN_GELS.map((one) => one.id).join(", ")}`);
47
+ return gel;
48
+ }
49
+ /**
50
+ * The generic broad-range and low-range protein markers.
51
+ *
52
+ * These are the nominal weights printed on the tube. A prestained marker runs a little off them,
53
+ * which is why a band is read against the marker in the lane beside it rather than off a distance.
54
+ */
55
+ export const PROTEIN_LADDERS = [
56
+ { id: "broad", name: "Broad-range marker", sizes: [250, 150, 100, 75, 50, 37, 25, 20, 15, 10] },
57
+ { id: "low", name: "Low-range marker", sizes: [100, 75, 50, 37, 25, 20, 15, 10] },
58
+ ];
59
+ /**
60
+ * Look a protein marker up by its {@link ProteinLadder.id}.
61
+ *
62
+ * @param id - An id from {@link PROTEIN_LADDERS}, e.g. `"broad"`.
63
+ * @returns The matching marker.
64
+ * @throws {@link ValueError} if no marker has that id.
65
+ */
66
+ export function proteinLadderById(id) {
67
+ const ladder = PROTEIN_LADDERS.find((one) => one.id === id);
68
+ if (!ladder)
69
+ throw new ValueError(`unknown protein ladder '${id}'; known protein ladders are ${PROTEIN_LADDERS.map((one) => one.id).join(", ")}`);
70
+ return ladder;
71
+ }
72
+ /**
73
+ * How far down a protein gel a band of a given mass runs, as a fraction of the way from the wells to
74
+ * the front.
75
+ *
76
+ * @param kilodaltons - The protein's mass.
77
+ * @param gel - The gel being run.
78
+ * @returns 0 at the wells, 1 at the front, clamped outside the range the gel separates.
79
+ * @throws {@link ValueError} for a mass that is not a positive finite number.
80
+ * @example
81
+ * ```ts
82
+ * proteinBandPosition(100, proteinGelById("12")); // 0 — at the top of what 12% separates
83
+ * ```
84
+ */
85
+ export const proteinBandPosition = (kilodaltons, gel) => bandPosition(kilodaltons, gel);
86
+ /**
87
+ * The bands a lane of protein would show.
88
+ *
89
+ * @param kilodaltons - The masses in the lane, in any order.
90
+ * @param gel - The gel being run.
91
+ * @param tolerance - Relative difference below which two proteins run as one band.
92
+ * @returns The bands, heaviest first. {@link Band.size} and {@link Band.sizes} are in kilodaltons.
93
+ */
94
+ export const proteinBands = (kilodaltons, gel, tolerance) => bandsOf(kilodaltons, gel, tolerance);
95
+ /**
96
+ * The bands a protein marker would show, as a lane of single known masses.
97
+ *
98
+ * @param sizes - The marker's band masses, in kilodaltons.
99
+ * @param gel - The gel being run.
100
+ * @returns One band per marker, heaviest first.
101
+ */
102
+ export const proteinLadderBands = (sizes, gel) => ladderBands(sizes, gel);
103
+ //# sourceMappingURL=protein.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protein.js","sourceRoot":"","sources":["../src/protein.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,EAAa,MAAM,YAAY,CAAC;AAc3E;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,YAAY,GAA0B;IACjD,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAE;IACvD,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAE;IACrD,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAE;IACrD,EAAE,EAAE,EAAE,IAAI,EAA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C,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAClJ,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,WAAmB,EAAE,GAAe,EAAU,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;AAEpH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,WAA8B,EAAE,GAAe,EAAE,SAAkB,EAAU,EAAE,CAC1G,OAAO,CAAC,WAAW,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC;AAEvC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAwB,EAAE,GAAe,EAAU,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC"}
package/package.json CHANGED
@@ -44,5 +44,5 @@
44
44
  },
45
45
  "type": "module",
46
46
  "types": "dist/index.d.ts",
47
- "version": "1.0.0"
47
+ "version": "1.0.1"
48
48
  }
package/src/bands.ts CHANGED
@@ -13,7 +13,7 @@
13
13
  */
14
14
 
15
15
  import { ValueError } from "@biolibs/core";
16
- import type { GelType } from "./gels.js";
16
+ import type { Resolving } from "./gels.js";
17
17
 
18
18
  /** Default band-merging tolerance: fragments within 3% of each other run as one band. */
19
19
  export const DEFAULT_TOLERANCE = 0.03;
@@ -21,10 +21,10 @@ export const DEFAULT_TOLERANCE = 0.03;
21
21
  /**
22
22
  * How far down the gel a fragment of `size` runs, as a fraction of the distance from the wells to the front.
23
23
  *
24
- * @param size - Fragment length in base pairs.
25
- * @param gel - The gel being run.
26
- * @returns 0 at the wells, 1 at the front. Fragments larger than {@link GelType.largest} clamp to 0 and ones
27
- * smaller than {@link GelType.smallest} clamp to 1, since the gel does not separate them.
24
+ * @param size - Fragment length in base pairs, or a protein's mass in kilodaltons.
25
+ * @param gel - The range the gel separates.
26
+ * @returns 0 at the wells, 1 at the front. Fragments larger than {@link Resolving.largest} clamp to 0 and ones
27
+ * smaller than {@link Resolving.smallest} clamp to 1, since the gel does not separate them.
28
28
  * @throws {@link ValueError} for a size that is not a positive finite number.
29
29
  * @example
30
30
  * ```ts
@@ -34,7 +34,7 @@ export const DEFAULT_TOLERANCE = 0.03;
34
34
  * bandPosition(1581, gel); // ~0.5 (the geometric mean of the two ends)
35
35
  * ```
36
36
  */
37
- export function bandPosition(size: number, gel: GelType): number {
37
+ export function bandPosition(size: number, gel: Resolving): number {
38
38
  if (!Number.isFinite(size) || size <= 0) throw new ValueError(`fragment size must be a positive number, got ${size}`);
39
39
  const high = Math.log10(gel.largest);
40
40
  const low = Math.log10(gel.smallest);
@@ -52,19 +52,19 @@ export function bandPosition(size: number, gel: GelType): number {
52
52
  * @param gel - The gel being run.
53
53
  * @returns `true` when `gel.smallest <= size <= gel.largest`.
54
54
  */
55
- export const resolves = (size: number, gel: GelType): boolean => size <= gel.largest && size >= gel.smallest;
55
+ export const resolves = (size: number, gel: Resolving): boolean => size <= gel.largest && size >= gel.smallest;
56
56
 
57
57
  /** One visible band: the fragments that run together at a single place on the gel. */
58
58
  export interface Band {
59
- /** Representative size in base pairs — the largest fragment in the band. */
59
+ /** Representative size — the largest in the band, in whatever the gel sorts by: base pairs for DNA, kilodaltons for protein. */
60
60
  size: number;
61
- /** Every fragment size merged into this band, largest first. */
61
+ /** Every size merged into this band, largest first. */
62
62
  sizes: readonly number[];
63
63
  /** Distance from the wells, 0 to 1, as {@link bandPosition} gives it. */
64
64
  position: number;
65
- /** Total base pairs in the band; a band holding more DNA stains more brightly. */
65
+ /** The sizes in the band added up; a band holding more of what is stained shows more brightly. */
66
66
  totalBases: number;
67
- /** Brightness from 0 to 1, the band's share of the lane's base pairs, scaled so the heaviest band is 1. */
67
+ /** Brightness from 0 to 1, the band's share of the lane's total, scaled so the heaviest band is 1. */
68
68
  intensity: number;
69
69
  /**
70
70
  * True when every fragment in the band is outside the gel's resolving range, so the gel does not separate them:
@@ -88,7 +88,7 @@ export interface Band {
88
88
  * bandsOf([2000, 2010, 500], gel).length; // 2 — 2000 and 2010 run together
89
89
  * ```
90
90
  */
91
- export function bandsOf(sizes: readonly number[], gel: GelType, tolerance = DEFAULT_TOLERANCE): Band[] {
91
+ export function bandsOf(sizes: readonly number[], gel: Resolving, tolerance = DEFAULT_TOLERANCE): Band[] {
92
92
  if (!Number.isFinite(tolerance) || tolerance < 0) throw new ValueError(`tolerance must be zero or more, got ${tolerance}`);
93
93
  for (const size of sizes) {
94
94
  if (!Number.isFinite(size) || size <= 0) throw new ValueError(`fragment size must be a positive number, got ${size}`);
@@ -135,7 +135,7 @@ export function bandsOf(sizes: readonly number[], gel: GelType, tolerance = DEFA
135
135
  * marked `unresolved` but, unlike a sample lane, are never merged: a ladder's bands are known sizes and worth
136
136
  * showing individually even where the gel would not separate them.
137
137
  */
138
- export function ladderBands(ladderSizes: readonly number[], gel: GelType): Band[] {
138
+ export function ladderBands(ladderSizes: readonly number[], gel: Resolving): Band[] {
139
139
  return [...ladderSizes]
140
140
  .sort((a, b) => b - a)
141
141
  .map((size) => ({
package/src/gels.ts CHANGED
@@ -9,6 +9,21 @@
9
9
 
10
10
  import { ValueError } from "@biolibs/core";
11
11
 
12
+ /**
13
+ * The range of sizes a gel separates, whatever is being run on it.
14
+ *
15
+ * It is this and not a kind of gel because the arithmetic of a band's position is the same
16
+ * arithmetic either way: the two ends bracket the range over which the log-linear model in
17
+ * {@link bandPosition} holds, and the unit they are in is whatever the gel sorts by — base pairs for
18
+ * DNA on agarose, kilodaltons for protein on acrylamide.
19
+ */
20
+ export interface Resolving {
21
+ /** The largest the gel still separates. */
22
+ largest: number;
23
+ /** The smallest the gel still separates. */
24
+ smallest: number;
25
+ }
26
+
12
27
  /**
13
28
  * One agarose concentration and the fragment sizes it resolves.
14
29
  *
@@ -16,7 +31,7 @@ import { ValueError } from "@biolibs/core";
16
31
  * it, fragments still migrate but are not separated: above `largest` they stay bunched near the wells, below
17
32
  * `smallest` they run off together at the front.
18
33
  */
19
- export interface GelType {
34
+ export interface GelType extends Resolving {
20
35
  /** Short identifier, e.g. `"1.0"`. */
21
36
  id: string;
22
37
  /** Agarose concentration as a percentage (w/v). */
package/src/index.ts CHANGED
@@ -8,10 +8,11 @@
8
8
  * resolves, described in `bands.ts`. The figures are conventional working values for agarose in TAE, enough to show
9
9
  * which fragments would be distinguishable, not measurements of a particular rig.
10
10
  *
11
- * - `gels.ts`: `GelType`, `GELS`, `gelById` — agarose concentrations and their resolving ranges
11
+ * - `gels.ts`: `Resolving`, `GelType`, `GELS`, `gelById` — agarose concentrations and their resolving ranges
12
12
  * - `ladders.ts`: `Ladder`, `LADDERS`, `ladderById` — size markers
13
13
  * - `bands.ts`: `bandPosition`, `resolves`, `Band`, `bandsOf`, `ladderBands` — fragment sizes to visible bands
14
14
  * - `fragments.ts`: `Topology`, `fragmentSizes` — cut positions to fragment lengths
15
+ * - `protein.ts`: `ProteinGel`, `PROTEIN_GELS`, `PROTEIN_LADDERS`, `proteinBands` — the same, for protein on acrylamide
15
16
  *
16
17
  * @example
17
18
  * ```ts
@@ -29,3 +30,4 @@ export * from "./gels.js";
29
30
  export * from "./ladders.js";
30
31
  export * from "./bands.js";
31
32
  export * from "./fragments.js";
33
+ export * from "./protein.js";
package/src/protein.ts ADDED
@@ -0,0 +1,131 @@
1
+ /**
2
+ * Polyacrylamide gels for protein, and the markers run beside them.
3
+ *
4
+ * A protein gel is read the same way an agarose one is, and for the same reason: a mesh holds large
5
+ * molecules back more than small ones, so over the range a gel resolves the distance run is close to
6
+ * a straight line against the logarithm of size. The one difference is what is being measured.
7
+ * Agarose sorts DNA by length in base pairs; SDS-PAGE sorts protein by mass in kilodaltons, because
8
+ * the detergent coats every chain with much the same charge per unit mass and undoes its shape, so
9
+ * what is left to tell two proteins apart is how big they are. That is why {@link bandPosition} and
10
+ * {@link bandsOf} are the functions used here too: they take a resolving range, not a kind of gel.
11
+ *
12
+ * The percentages and ranges are the conventional working figures printed in supplier guides for
13
+ * SDS-PAGE in Tris-glycine. They say which proteins a gel would *tell apart*, and are not
14
+ * measurements. Two things to keep in mind when reading a real gel against them: a prestained
15
+ * marker's bands are calibrated against unstained standards and run a little off their printed
16
+ * weights, and a protein that is glycosylated, or that has not been fully reduced, runs at a size
17
+ * that is not the mass its sequence comes to.
18
+ */
19
+
20
+ import { ValueError } from "@biolibs/core";
21
+ import { bandPosition, bandsOf, ladderBands, type Band } from "./bands.js";
22
+
23
+ /** One acrylamide concentration and the protein sizes it resolves, in kilodaltons. */
24
+ export interface ProteinGel {
25
+ /** Short identifier, e.g. `"12"`. */
26
+ id: string;
27
+ /** Acrylamide concentration as a percentage (w/v). */
28
+ percent: number;
29
+ /** Largest protein, in kilodaltons, the gel still separates. */
30
+ largest: number;
31
+ /** Smallest protein, in kilodaltons, the gel still separates. */
32
+ smallest: number;
33
+ }
34
+
35
+ /**
36
+ * The four acrylamide concentrations in common use, from the one that resolves the largest proteins
37
+ * to the one that resolves the smallest.
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * PROTEIN_GELS.find((g) => g.percent === 12)?.largest; // 100
42
+ * ```
43
+ */
44
+ export const PROTEIN_GELS: readonly ProteinGel[] = [
45
+ { id: "7.5", percent: 7.5, largest: 200, smallest: 40 },
46
+ { id: "10", percent: 10, largest: 150, smallest: 20 },
47
+ { id: "12", percent: 12, largest: 100, smallest: 10 },
48
+ { id: "15", percent: 15, largest: 60, smallest: 5 },
49
+ ];
50
+
51
+ /**
52
+ * Look a protein gel up by its {@link ProteinGel.id}.
53
+ *
54
+ * @param id - An id from {@link PROTEIN_GELS}, e.g. `"12"`.
55
+ * @returns The matching gel.
56
+ * @throws {@link ValueError} if no protein gel has that id.
57
+ */
58
+ export function proteinGelById(id: string): ProteinGel {
59
+ const gel = PROTEIN_GELS.find((one) => one.id === id);
60
+ if (!gel) throw new ValueError(`unknown protein gel '${id}'; known protein gels are ${PROTEIN_GELS.map((one) => one.id).join(", ")}`);
61
+ return gel;
62
+ }
63
+
64
+ /** A set of protein marker bands of known mass. */
65
+ export interface ProteinLadder {
66
+ /** Short identifier, e.g. `"broad"`. */
67
+ id: string;
68
+ /** Display name. */
69
+ name: string;
70
+ /** Band masses in kilodaltons, largest first. */
71
+ sizes: readonly number[];
72
+ }
73
+
74
+ /**
75
+ * The generic broad-range and low-range protein markers.
76
+ *
77
+ * These are the nominal weights printed on the tube. A prestained marker runs a little off them,
78
+ * which is why a band is read against the marker in the lane beside it rather than off a distance.
79
+ */
80
+ export const PROTEIN_LADDERS: readonly ProteinLadder[] = [
81
+ { id: "broad", name: "Broad-range marker", sizes: [250, 150, 100, 75, 50, 37, 25, 20, 15, 10] },
82
+ { id: "low", name: "Low-range marker", sizes: [100, 75, 50, 37, 25, 20, 15, 10] },
83
+ ];
84
+
85
+ /**
86
+ * Look a protein marker up by its {@link ProteinLadder.id}.
87
+ *
88
+ * @param id - An id from {@link PROTEIN_LADDERS}, e.g. `"broad"`.
89
+ * @returns The matching marker.
90
+ * @throws {@link ValueError} if no marker has that id.
91
+ */
92
+ export function proteinLadderById(id: string): ProteinLadder {
93
+ const ladder = PROTEIN_LADDERS.find((one) => one.id === id);
94
+ if (!ladder) throw new ValueError(`unknown protein ladder '${id}'; known protein ladders are ${PROTEIN_LADDERS.map((one) => one.id).join(", ")}`);
95
+ return ladder;
96
+ }
97
+
98
+ /**
99
+ * How far down a protein gel a band of a given mass runs, as a fraction of the way from the wells to
100
+ * the front.
101
+ *
102
+ * @param kilodaltons - The protein's mass.
103
+ * @param gel - The gel being run.
104
+ * @returns 0 at the wells, 1 at the front, clamped outside the range the gel separates.
105
+ * @throws {@link ValueError} for a mass that is not a positive finite number.
106
+ * @example
107
+ * ```ts
108
+ * proteinBandPosition(100, proteinGelById("12")); // 0 — at the top of what 12% separates
109
+ * ```
110
+ */
111
+ export const proteinBandPosition = (kilodaltons: number, gel: ProteinGel): number => bandPosition(kilodaltons, gel);
112
+
113
+ /**
114
+ * The bands a lane of protein would show.
115
+ *
116
+ * @param kilodaltons - The masses in the lane, in any order.
117
+ * @param gel - The gel being run.
118
+ * @param tolerance - Relative difference below which two proteins run as one band.
119
+ * @returns The bands, heaviest first. {@link Band.size} and {@link Band.sizes} are in kilodaltons.
120
+ */
121
+ export const proteinBands = (kilodaltons: readonly number[], gel: ProteinGel, tolerance?: number): Band[] =>
122
+ bandsOf(kilodaltons, gel, tolerance);
123
+
124
+ /**
125
+ * The bands a protein marker would show, as a lane of single known masses.
126
+ *
127
+ * @param sizes - The marker's band masses, in kilodaltons.
128
+ * @param gel - The gel being run.
129
+ * @returns One band per marker, heaviest first.
130
+ */
131
+ export const proteinLadderBands = (sizes: readonly number[], gel: ProteinGel): Band[] => ladderBands(sizes, gel);