@czi-sds/data-viz 2.2.0 → 2.3.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.
@@ -301,7 +301,7 @@ interface ResidueRef {
301
301
  /**
302
302
  * A chain the viewer found in the structure it loaded, reported through
303
303
  * `onChainsChange` so a consumer can label, color or hide chains by name
304
- * without parsing the PDB itself.
304
+ * without parsing the structure itself.
305
305
  *
306
306
  * `chainId` is the file's own name for the chain, the same one `ResidueRef`
307
307
  * reports, and the key every chain-keyed prop takes. A chain carrying several
@@ -392,8 +392,8 @@ interface StructureStat {
392
392
  label: string;
393
393
  }
394
394
  interface ProteinStructureViewerProps extends Omit<HTMLAttributes<HTMLDivElement>, "onSelect"> {
395
- /** Structure to render, as raw PDB text. */
396
- pdb: string;
395
+ /** Structure to render, as raw PDB or mmCIF (PDBx) text. */
396
+ structure: string;
397
397
  /**
398
398
  * Per-residue pLDDT confidence on a 0-1 scale, ordered by residue. When
399
399
  * supplied the structure is colored by pLDDT unless `residueOverlay` takes
@@ -436,6 +436,10 @@ interface ProteinStructureViewerProps extends Omit<HTMLAttributes<HTMLDivElement
436
436
  * What is selected, or null when nothing is. Controlled: the camera frames
437
437
  * whatever the selection covers, and clearing it zooms back out to the
438
438
  * default view.
439
+ *
440
+ * Residues are drawn in ball-and-stick over the cartoon; whole chains are
441
+ * left as they are and the chains around them dim, the same as hovering a
442
+ * chain's name.
439
443
  */
440
444
  selection?: StructureSelection | null;
441
445
  /**
@@ -458,14 +462,13 @@ interface ProteinStructureViewerProps extends Omit<HTMLAttributes<HTMLDivElement
458
462
  */
459
463
  showChainLegend?: boolean;
460
464
  /**
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.
465
+ * Stop other chains from dimming in the 3D view while a chain's name is
466
+ * pointed at, in the legend or above its grid in the sequence panel.
463
467
  *
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`.
468
+ * The dim is on by default, since on a complex it is how a reader finds out
469
+ * which chain is which. Turn it off where the movement is more distracting
470
+ * than the answer is useful - a grid of viewers a pointer crosses on its way
471
+ * somewhere else, or a page driving its own highlighting through `selection`.
469
472
  * @default false
470
473
  */
471
474
  disableChainHighlightOnHover?: boolean;
@@ -551,6 +554,24 @@ interface ResidueReadout {
551
554
  residueCount: number;
552
555
  }
553
556
  //#endregion
557
+ //#region src/core/ProteinStructureViewer/utils/structureFormat.d.ts
558
+ /**
559
+ * Structure text formats Mol* can parse from the viewer's `structure` prop.
560
+ *
561
+ * `"mmcif"` covers both mmCIF and PDBx; they are the same text format, and
562
+ * that is the name Mol*'s trajectory parser uses. Binary CIF (`.bcif`) is not
563
+ * accepted: the prop is a string.
564
+ */
565
+ type StructureFormat = "pdb" | "mmcif";
566
+ /**
567
+ * Infers whether `text` is PDB or mmCIF (PDBx).
568
+ *
569
+ * mmCIF documents start with a `data_` block and name their coordinates
570
+ * `_atom_site.`. PDB never does either, so either marker is enough. A leading
571
+ * comment (`# ...`) before `data_` is still mmCIF.
572
+ */
573
+ declare function detectStructureFormat(text: string): StructureFormat;
574
+ //#endregion
554
575
  //#region src/core/ProteinStructureViewer/utils/plddt.d.ts
555
576
  /**
556
577
  * AlphaFold's pLDDT confidence bands. Thresholds are on the 0-1 scale that
@@ -569,6 +590,23 @@ declare const PLDDT_COLOR_SCALE: ColorScale;
569
590
  * them its neighbour's score.
570
591
  */
571
592
  declare function injectPlddtIntoPdb(pdbData: string, plddtValues: number[]): string;
593
+ /**
594
+ * Rewrites an mmCIF (PDBx) file's `_atom_site.B_iso_or_equiv` column with
595
+ * pLDDT scores so Mol* can read them off the parsed model, the same way
596
+ * `injectPlddtIntoPdb` rewrites the PDB B-factor column. Scores arrive on a
597
+ * 0-1 scale and are stored on the conventional 0-100 one. Residues past the
598
+ * end of `plddtValues` fall back to a mid-confidence 50.
599
+ *
600
+ * If the file has no B-factor column, one is appended to the atom-site loop
601
+ * rather than leaving the scores behind.
602
+ */
603
+ declare function injectPlddtIntoMmcif(mmcifData: string, plddtValues: number[]): string;
604
+ /**
605
+ * Rewrites a structure file's B-factors with pLDDT scores. Dispatches to
606
+ * `injectPlddtIntoPdb` or `injectPlddtIntoMmcif` from `format`, or from
607
+ * detecting the format of `data` when `format` is omitted.
608
+ */
609
+ declare function injectPlddt(data: string, plddtValues: number[], format?: StructureFormat): string;
572
610
  //#endregion
573
611
  //#region src/core/ProteinStructureViewer/index.d.ts
574
612
  declare const _default$1: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<ProteinStructureViewerProps & import("react").RefAttributes<HTMLDivElement>>>;
@@ -734,4 +772,4 @@ interface StackedBarChartProps extends HTMLAttributes<HTMLDivElement> {
734
772
  //#region src/core/StackedBarChart/index.d.ts
735
773
  declare const StackedBarChart: (props: StackedBarChartProps) => JSX.Element;
736
774
  //#endregion
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 };
775
+ 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, type StructureFormat, StructureSelection, StructureStat, detectStructureFormat, injectPlddt, injectPlddtIntoMmcif, injectPlddtIntoPdb, sampleColorScale, toCssGradient };