@czi-sds/data-viz 2.1.0 → 2.2.0
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/dist/index.cjs.d.ts +200 -16
- package/dist/index.cjs.js +2643 -856
- package/dist/index.esm.d.ts +200 -15
- package/dist/index.esm.js +2645 -859
- package/package.json +2 -2
package/dist/index.esm.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { DatasetComponentOption, ECharts, EChartsOption, ScatterSeriesOption } from "echarts";
|
|
3
3
|
import { HTMLAttributes } from "react";
|
|
4
|
-
import { DiscreteColorGeneratorOptions, TooltipTableContentProps } from "@czi-sds/components";
|
|
4
|
+
import { DiscreteColorGeneratorOptions, TooltipProps, TooltipTableContentProps } from "@czi-sds/components";
|
|
5
|
+
import { PluginUISpec } from "molstar/lib/mol-plugin-ui/spec";
|
|
5
6
|
import { CustomElementProperty } from "molstar/lib/mol-model-props/common/custom-element-property";
|
|
6
7
|
|
|
7
8
|
//#region src/common/colorScales.d.ts
|
|
@@ -251,8 +252,18 @@ interface ResidueValueOverlay {
|
|
|
251
252
|
colorScale?: ColorScale;
|
|
252
253
|
/** Legend caption, e.g. "Feature activation". */
|
|
253
254
|
label?: string;
|
|
254
|
-
/**
|
|
255
|
+
/**
|
|
256
|
+
* Title of the help tooltip on the legend caption. The common case: a
|
|
257
|
+
* string is enough. Use `tooltipProps` when the tooltip needs a subtitle, a
|
|
258
|
+
* custom body, or any other SDS Tooltip prop. Overrides
|
|
259
|
+
* `tooltipProps.title` when both are set.
|
|
260
|
+
*/
|
|
255
261
|
tooltip?: string;
|
|
262
|
+
/**
|
|
263
|
+
* Props forwarded to the SDS Tooltip on the legend caption. The trigger is
|
|
264
|
+
* the caption's help icon, so `children` is omitted.
|
|
265
|
+
*/
|
|
266
|
+
tooltipProps?: Partial<Omit<TooltipProps, "children">>;
|
|
256
267
|
/**
|
|
257
268
|
* Label for the per-residue readout that replaces a stat slot on hover.
|
|
258
269
|
* @default "Value"
|
|
@@ -287,6 +298,94 @@ interface ResidueRef {
|
|
|
287
298
|
/** Insertion code, or `""` when the residue has none. */
|
|
288
299
|
insCode: string;
|
|
289
300
|
}
|
|
301
|
+
/**
|
|
302
|
+
* A chain the viewer found in the structure it loaded, reported through
|
|
303
|
+
* `onChainsChange` so a consumer can label, color or hide chains by name
|
|
304
|
+
* without parsing the PDB itself.
|
|
305
|
+
*
|
|
306
|
+
* `chainId` is the file's own name for the chain, the same one `ResidueRef`
|
|
307
|
+
* reports, and the key every chain-keyed prop takes. A chain carrying several
|
|
308
|
+
* symmetry operators appears once, under the first.
|
|
309
|
+
*
|
|
310
|
+
* Describes the chain's polymer. The ligands and ions sitting on it are drawn
|
|
311
|
+
* and are hidden and selected with it, but are not counted here or spanned by
|
|
312
|
+
* the range below - they are no part of the sequence. A chain holding nothing
|
|
313
|
+
* but heteroatoms is left out altogether, having no sequence to describe.
|
|
314
|
+
*/
|
|
315
|
+
interface ChainRef {
|
|
316
|
+
/** Chain as named in the file (`auth_asym_id`), e.g. `"A"`. */
|
|
317
|
+
chainId: string;
|
|
318
|
+
/** Chain as the sequence panel captions it. */
|
|
319
|
+
label: string;
|
|
320
|
+
/** Lowest 0-based residue index of the chain's polymer. */
|
|
321
|
+
startIndex: number;
|
|
322
|
+
/** Highest 0-based residue index of the chain's polymer. */
|
|
323
|
+
endIndex: number;
|
|
324
|
+
/** Polymer residues the chain holds. */
|
|
325
|
+
residueCount: number;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* What is selected, in the two ways a caller might say it. `null` selects
|
|
329
|
+
* nothing.
|
|
330
|
+
*
|
|
331
|
+
* The two combine: `{ chains: ["A"], residues: [150] }` takes all of chain A
|
|
332
|
+
* plus one residue elsewhere. `chains` is kept as named rather than expanded
|
|
333
|
+
* into indices, so a whole-chain selection survives a round trip through a
|
|
334
|
+
* consumer's state at its original size.
|
|
335
|
+
*/
|
|
336
|
+
interface StructureSelection {
|
|
337
|
+
/**
|
|
338
|
+
* 0-based residue indices, counting residues in file order across the whole
|
|
339
|
+
* structure - the same index `plddt` and `residueOverlay` are keyed by.
|
|
340
|
+
*/
|
|
341
|
+
residues?: number[];
|
|
342
|
+
/** Whole chains by `chainId`, each standing for every residue on it. */
|
|
343
|
+
chains?: string[];
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* How large a downloaded image is, in pixels.
|
|
347
|
+
*
|
|
348
|
+
* Named rather than given as dimensions because the aspect is Mol*'s to
|
|
349
|
+
* choose: each of these is one of its own presets, and a size picked here
|
|
350
|
+
* would have to be reconciled with the canvas the image is rendered from.
|
|
351
|
+
*/
|
|
352
|
+
type DownloadResolution = "low" | "medium" | "high" | "maximum";
|
|
353
|
+
/** Pixel dimensions each resolution produces, for documentation and labels. */
|
|
354
|
+
declare const DOWNLOAD_RESOLUTIONS: Record<DownloadResolution, string>;
|
|
355
|
+
/**
|
|
356
|
+
* Turns on the capture button under the reset-camera control, and says what it
|
|
357
|
+
* should produce. Omit it and no button is drawn.
|
|
358
|
+
*
|
|
359
|
+
* The image is rendered fresh at the size asked for rather than scaled up from
|
|
360
|
+
* the canvas, so a high resolution costs time rather than sharpness - which is
|
|
361
|
+
* why the default sits in the middle rather than at the top.
|
|
362
|
+
*/
|
|
363
|
+
interface StructureDownload {
|
|
364
|
+
/**
|
|
365
|
+
* Size of the image. See `DOWNLOAD_RESOLUTIONS` for the pixel dimensions.
|
|
366
|
+
* @default "medium"
|
|
367
|
+
*/
|
|
368
|
+
resolution?: DownloadResolution;
|
|
369
|
+
/**
|
|
370
|
+
* Background behind the structure, as `#RRGGBB`. Omit for a transparent
|
|
371
|
+
* one, which is what a figure usually wants - the viewer's own canvas color
|
|
372
|
+
* is deliberately not inherited, since a screenshot tends to outlive the
|
|
373
|
+
* theme it was taken under.
|
|
374
|
+
*/
|
|
375
|
+
backgroundColor?: string;
|
|
376
|
+
/**
|
|
377
|
+
* Draw the orientation axes into the image. Independent of `showAxes`, which
|
|
378
|
+
* is about the view rather than the capture: the widget orients a reader who
|
|
379
|
+
* can turn the structure, and earns its place less in a still.
|
|
380
|
+
* @default false
|
|
381
|
+
*/
|
|
382
|
+
showAxes?: boolean;
|
|
383
|
+
/**
|
|
384
|
+
* Name for the downloaded file, without an extension. Defaults to the one
|
|
385
|
+
* Mol* derives from the loaded structure.
|
|
386
|
+
*/
|
|
387
|
+
filename?: string;
|
|
388
|
+
}
|
|
290
389
|
/** A whole-structure statistic shown along the bottom of the viewer. */
|
|
291
390
|
interface StructureStat {
|
|
292
391
|
value: string;
|
|
@@ -316,6 +415,11 @@ interface ProteinStructureViewerProps extends Omit<HTMLAttributes<HTMLDivElement
|
|
|
316
415
|
* @default true
|
|
317
416
|
*/
|
|
318
417
|
showAxes?: boolean;
|
|
418
|
+
/**
|
|
419
|
+
* Adds a capture button beneath the reset-camera control, which downloads a
|
|
420
|
+
* PNG of the structure as it currently stands. Omit for no button.
|
|
421
|
+
*/
|
|
422
|
+
download?: StructureDownload | null;
|
|
319
423
|
/**
|
|
320
424
|
* Show the sequence panel pinned along the bottom of the viewer.
|
|
321
425
|
* @default true
|
|
@@ -329,11 +433,61 @@ interface ProteinStructureViewerProps extends Omit<HTMLAttributes<HTMLDivElement
|
|
|
329
433
|
/** Per-residue values that override pLDDT coloring while set. */
|
|
330
434
|
residueOverlay?: ResidueValueOverlay | null;
|
|
331
435
|
/**
|
|
332
|
-
*
|
|
333
|
-
*
|
|
334
|
-
*
|
|
436
|
+
* What is selected, or null when nothing is. Controlled: the camera frames
|
|
437
|
+
* whatever the selection covers, and clearing it zooms back out to the
|
|
438
|
+
* default view.
|
|
439
|
+
*/
|
|
440
|
+
selection?: StructureSelection | null;
|
|
441
|
+
/**
|
|
442
|
+
* Chains hidden from the 3D view, by `chainId`. Leave undefined to let the
|
|
443
|
+
* viewer own visibility itself, which is what the chain legend's toggles
|
|
444
|
+
* drive; passing it takes that over, and the toggles then only report.
|
|
445
|
+
*/
|
|
446
|
+
hiddenChains?: string[];
|
|
447
|
+
/**
|
|
448
|
+
* Color per chain, by `chainId`, as `#RRGGBB`. Chains left out fall back to
|
|
449
|
+
* the viewer's palette. Only visible while chain coloring is what is on
|
|
450
|
+
* screen, which is when neither `plddt` nor `residueOverlay` is set.
|
|
451
|
+
*/
|
|
452
|
+
chainColors?: Record<string, string>;
|
|
453
|
+
/**
|
|
454
|
+
* Show the chain legend, which lists each chain with its color and a
|
|
455
|
+
* visibility toggle. Ignored on a single-chain structure, where there is
|
|
456
|
+
* nothing to tell apart or hide.
|
|
457
|
+
* @default true
|
|
458
|
+
*/
|
|
459
|
+
showChainLegend?: boolean;
|
|
460
|
+
/**
|
|
461
|
+
* Stop a chain from lighting up in the 3D view while its name is pointed at,
|
|
462
|
+
* in the legend or above its grid in the sequence panel.
|
|
463
|
+
*
|
|
464
|
+
* The highlight is on by default, since on a complex it is how a reader
|
|
465
|
+
* finds out which chain is which. Turn it off where the movement is more
|
|
466
|
+
* distracting than the answer is useful - a grid of viewers a pointer
|
|
467
|
+
* crosses on its way somewhere else, or a page driving its own highlighting
|
|
468
|
+
* through `selection`.
|
|
469
|
+
* @default false
|
|
335
470
|
*/
|
|
336
|
-
|
|
471
|
+
disableChainHighlightOnHover?: boolean;
|
|
472
|
+
/**
|
|
473
|
+
* Mol* plugin spec laid over the viewer's own, which is how the whole of
|
|
474
|
+
* Mol*'s configuration is reachable without a prop here for each setting.
|
|
475
|
+
* Anything named here wins, so `canvas3d.postprocessing`, a `PluginConfig`
|
|
476
|
+
* item, or `layout.initial` can all be set to something other than the
|
|
477
|
+
* default the viewer picked.
|
|
478
|
+
*
|
|
479
|
+
* List-valued keys - `behaviors`, `config`, `actions`, `animations`,
|
|
480
|
+
* `customFormats`, `customParamEditors` - are appended to rather than
|
|
481
|
+
* replaced. For `config` that is what lets an entry override the viewer's,
|
|
482
|
+
* since Mol* reads the list in order. It also means a behavior cannot be
|
|
483
|
+
* taken away: the ones the viewer drops stay dropped, and the ones it keeps
|
|
484
|
+
* cannot be removed from here.
|
|
485
|
+
*
|
|
486
|
+
* Read once, when the plugin is created, except for `canvas3d`, which is
|
|
487
|
+
* re-applied whenever it changes. Creating the plugin throws away the camera,
|
|
488
|
+
* so the rest is deliberately not reactive.
|
|
489
|
+
*/
|
|
490
|
+
molstarSpec?: Partial<PluginUISpec>;
|
|
337
491
|
/**
|
|
338
492
|
* Up to three whole-structure stats shown along the bottom. A null entry
|
|
339
493
|
* reserves its column without rendering anything, so the columns never shift
|
|
@@ -347,23 +501,54 @@ interface ProteinStructureViewerProps extends Omit<HTMLAttributes<HTMLDivElement
|
|
|
347
501
|
* the structure.
|
|
348
502
|
*/
|
|
349
503
|
onResidueHover?: (residue: ResidueRef | null) => void;
|
|
350
|
-
/**
|
|
351
|
-
|
|
504
|
+
/**
|
|
505
|
+
* Called with the new selection whenever the user makes one - clicking a
|
|
506
|
+
* residue, dragging across the sequence, clicking a chain caption - and with
|
|
507
|
+
* `null` when they click empty space to clear it.
|
|
508
|
+
*
|
|
509
|
+
* A whole-chain selection arrives as `{ chains: [id] }` rather than as every
|
|
510
|
+
* index on it, so echoing it straight back into `selection` costs nothing.
|
|
511
|
+
*/
|
|
512
|
+
onSelectionChange?: (selection: StructureSelection | null) => void;
|
|
513
|
+
/**
|
|
514
|
+
* Called with the chains found in the structure, whenever a structure is
|
|
515
|
+
* loaded. Fires with `[]` when the structure holds none.
|
|
516
|
+
*/
|
|
517
|
+
onChainsChange?: (chains: ChainRef[]) => void;
|
|
518
|
+
/**
|
|
519
|
+
* Called with the chains now hidden when a visibility toggle is used. Fires
|
|
520
|
+
* whether or not `hiddenChains` is controlled, so a consumer can follow the
|
|
521
|
+
* viewer's own state without owning it.
|
|
522
|
+
*/
|
|
523
|
+
onChainVisibilityChange?: (hiddenChains: string[]) => void;
|
|
352
524
|
}
|
|
353
525
|
/**
|
|
354
|
-
*
|
|
355
|
-
*
|
|
526
|
+
* Readout that replaces the whole-structure stats while something is hovered
|
|
527
|
+
* or selected. Covers one residue or many: a drag across the sequence and a
|
|
528
|
+
* whole-chain selection report through this too, as a mean over what they
|
|
529
|
+
* cover.
|
|
356
530
|
*/
|
|
357
531
|
interface ResidueReadout {
|
|
358
|
-
/** e.g. "PHE 17" */
|
|
532
|
+
/** e.g. "PHE 17", "Chain A", or "24 residues". */
|
|
359
533
|
label: string;
|
|
360
|
-
/**
|
|
534
|
+
/**
|
|
535
|
+
* pLDDT on a 0-1 scale, or null when unavailable. The mean across the
|
|
536
|
+
* residues covered when there is more than one, ignoring those without a
|
|
537
|
+
* score.
|
|
538
|
+
*/
|
|
361
539
|
plddt: number | null;
|
|
362
540
|
/**
|
|
363
|
-
*
|
|
364
|
-
*
|
|
541
|
+
* Overlay value, or null when the overlay holds none - which is also what a
|
|
542
|
+
* structure paints neutral - or when no overlay is set. The mean across the
|
|
543
|
+
* residues covered when there is more than one, ignoring those the overlay
|
|
544
|
+
* says nothing about.
|
|
365
545
|
*/
|
|
366
546
|
value: number | null;
|
|
547
|
+
/**
|
|
548
|
+
* Residues the readout covers, which is what makes the numbers above means
|
|
549
|
+
* rather than readings. 1 for a single residue.
|
|
550
|
+
*/
|
|
551
|
+
residueCount: number;
|
|
367
552
|
}
|
|
368
553
|
//#endregion
|
|
369
554
|
//#region src/core/ProteinStructureViewer/utils/plddt.d.ts
|
|
@@ -549,4 +734,4 @@ interface StackedBarChartProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
549
734
|
//#region src/core/StackedBarChart/index.d.ts
|
|
550
735
|
declare const StackedBarChart: (props: StackedBarChartProps) => JSX.Element;
|
|
551
736
|
//#endregion
|
|
552
|
-
export { type ColorScale, type ContinuousColorStop, _default as HeatmapChart, HeatmapChartProps, PLASMA_COLOR_SCALE, PLDDT_COLOR_SCALE, _default$1 as ProteinStructureViewer, ProteinStructureViewerProps, ResidueReadout, ResidueRef, ResidueValueOverlay, StackedBarChart, type StackedBarChartDataItem, type StackedBarChartProps, type SteppedColorStop, StructureStat, injectPlddtIntoPdb, sampleColorScale, toCssGradient };
|
|
737
|
+
export { ChainRef, type ColorScale, type ContinuousColorStop, DOWNLOAD_RESOLUTIONS, DownloadResolution, _default as HeatmapChart, HeatmapChartProps, PLASMA_COLOR_SCALE, PLDDT_COLOR_SCALE, _default$1 as ProteinStructureViewer, ProteinStructureViewerProps, ResidueReadout, ResidueRef, ResidueValueOverlay, StackedBarChart, type StackedBarChartDataItem, type StackedBarChartProps, type SteppedColorStop, StructureDownload, StructureSelection, StructureStat, injectPlddtIntoPdb, sampleColorScale, toCssGradient };
|