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