Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@alexdaiii/rcsb-saguaro-3d

rcsb13MIT0.0.1TypeScript support: included

RCSB Molstar/Saguaro Web App

3D, structure, 1D, viewer, sequence, annotations, gene, protein, PDB, RCSB, UniProt

readme

rcsb-saguaro-3D

RCSB Saguaro Web 3D is an open-source library built on the top of the RCSB Saguaro 1D Feature Viewer and RCSB Molstar designed to display protein features at the RCSB Web Site. The package collects protein annotations from the 1D Coordinate Server and the main RCSB Data API and generates Protein Feature Summaries. The package allows access to RCSB Saguaro and Molstar methods to add or change the displayed data.

When using rcsb-saguaro, please cite:

Joan Segura, Yana Rose, Sebastian Bittrich, Stephen K Burley, Jose M Duarte. RCSB Protein Data Bank 1D3D module: displaying positional features on macromolecular assemblies, Bioinformatics, 2022; https://doi.org/10.1093/bioinformatics/btac317

CDN JavaScript

<script src="https://cdn.jsdelivr.net/npm/@rcsb/rcsb-saguaro-3d@4.0.0/build/app.min.js" type="text/javascript"></script>

Node Module Instalation

npm install @rcsb/rcsb-saguaro-3d

Building & Running

Build app

npm install
npm run buildApp

Testing

Different testing example are available in the src/examples folder

  • npm install
  • npm run devServer

Go to:

  • http://localhost:9000/assembly.html
  • http://localhost:9000/assembly-interface.html
  • http://localhost:9000/uniprot.html ...

Library Documentation

  • TypeScript classes and documentation can be found here

Main Classes and Interfaces

Assembly view

Class RcsbFv3DAssembly (src/RcsbFv3D/RcsbFv3DAssembly.tsx) builds a predefined 1D/3D view for PDB assemblies. This method is used in the RCSB PDB web portal to display 1D positional features of PDB models (ex: 4hhb). Its configuration requires a single PDB Id. In addition, additionalConfig allows to configure the feature viewer as describe in rcsb-saguaro-app API. This parameter exposes the board configuration through the attribute boardConfig (ref). The component will be mounted in the html element with id elementId. If there is no html element in the current document, a new div element will be added, and the component will be displayed in full screen mode.

export interface RcsbFv3DAssemblyInterface {
    elementId?: string;
    config: {
        entryId: string;
        assemblyId?: string;
        title?: string;
        subtitle?: string;
    };
    additionalConfig?: RcsbFv3DAssemblyAdditionalConfig;
    instanceSequenceConfig?: InstanceSequenceConfig;
    molstarProps?: Partial<ViewerProps>;
    cssConfig?: RcsbFv3DCssConfig;
}

Source code example can be found in src/examples/assembly/index.tsx.

Custom view

Class RcsbFv3DCustom file src/RcsbFv3D/RcsbFv3DCustom.tsx builds a customized view between one or more feature viewers and a single Molstar plugin. The configuration interface encodes the parameters for the feature viewers (sequencePanelConfig), the Molstar plugin (structurePanelConfig) and their dynamic interaction.

interface RcsbFv3DCustomInterface  {
    elementId?: string;
    structurePanelConfig: RcsbFvStructureConfigInterface<
        LoadMolstarInterface,
        { viewerProps:Partial<ViewerProps> }
    >;
    sequencePanelConfig: {
        config: CustomViewInterface<LoadMolstarInterface>;
        title?: string;
        subtitle?: string;
    }
    cssConfig?: RcsbFv3DCssConfig;

}

Alt text

Structural Panel

The structural panel configuration structurePanelConfig: RcsbFvStructureConfigInterface<LoadMolstarInterface,{viewerProps:Partial<ViewerProps>}> includes the loading configuration for the 3D structural data and the Molstar plugin. A full description of the structural panel configuration can be found here

interface RcsbFvStructureConfigInterface<R,S> {
    loadConfig: R | Array<R>;
    structureViewerConfig: S;
}

The attribute loadConfig: LoadMolstarInterface encodes the configuration for loading the 3D structural data.

interface LoadMolstarInterface {
    loadMethod: LoadMethod;
    loadParams: LoadParams;
}
  • loadMethod: LoadMethod is an enumerated value that indicates the source of the structural models
    enum LoadMethod {
      loadPdbId = "loadPdbId",
      loadStructureFromUrl = "loadStructureFromUrl"
    }
  • loadParams: LoadParams encode the parameters needed to collect and load the data. If id is provided, it can be used to identify the 3D models in the methods defined by SaguaroPluginPublicInterface
interface LoadParams {
    id?: string;
    pdbId?: string;
    url?: string,
    isBinary?: boolean
}
Sequence panel

The sequence panel organizes information in different blocks where each block encodes the configuration (blockConfig) to display one or more feature viewers. Only a single block can be displayed at a time. The optional parameter blockSelectorElement defines a React component that renders the html element used to change the displayed block. The class BlockSelectorManager is used to select which block is displayed are those that are hidden. For example, blockSelectorManager.setActiveBlock("myBlock") will display the feature viewers defined in the block with blockId "myBlock" (see FeatureBlockInterface) and hide the others. Additionally, blockChangeCallback defines a function that will be executed when the displayed block changes.

interface CustomViewInterface {
    blockConfig: FeatureBlockInterface | Array<FeatureBlockInterface>;
    blockSelectorElement?: (blockSelector: BlockSelectorManager) => JSX.Element;
    blockChangeCallback?: (plugin: StructureViewerPublicInterface, pfvList: Array<RcsbFv>, selection: RcsbFvSelectorManager) => void;
}

Source code example can be found in src/examples/multiple-chain/index.tsx.

Each block must contain a unique block identifier (blockId) and the configuration for all the feature viewers that will be rendered when the block is activated (featureViewConfig).

interface FeatureBlockInterface {
    blockId:string;
    featureViewConfig: Array<FeatureViewInterface> | FeatureViewInterface;
}

The interface for each feature viewer defines its dynamic interaction with the Molstar plugin through different event callbacks functions

  • sequenceSelectionChangeCallback defines how the Molstar plugin reacts when the feature viewer selection changes
  • sequenceElementClickCallback defines how the Molstar plugin reacts when a feature viewer element (positional annotation) is clicked
  • sequenceHoverCallback defines how the Molstar plugin reacts when the mouse hovers the feature viewer or any of its elements
  • structureSelectionCallback defines how the protein feature viewer reacts when the Molstar plugin selection changes
  • structureHoverCallback defines how the protein feature viewer reacts when displayed models on the Molstar plugin are hovered
export interface FeatureViewInterface {
    boardId?:string;
    boardConfig: RcsbFvBoardConfigInterface;
    rowConfig: Array<RcsbFvRowConfigInterface>;
    sequenceSelectionChangeCallback: (plugin: StructureViewerPublicInterface, selectorManager: RcsbFvSelectorManager, sequenceRegion: Array<RcsbFvTrackDataElementInterface>) => void;
    sequenceElementClickCallback: (plugin: StructureViewerPublicInterface, selectorManager: RcsbFvSelectorManager, d: RcsbFvTrackDataElementInterface) => void;
    sequenceHoverCallback: (plugin: StructureViewerPublicInterface, selectorManager: RcsbFvSelectorManager, hoverRegion: Array<RcsbFvTrackDataElementInterface>) => void;
    structureSelectionCallback: (plugin: StructureViewerPublicInterface, pfv: RcsbFv, selectorManager: RcsbFvSelectorManager) => void;
    structureHoverCallback: (plugin: StructureViewerPublicInterface, pfv: RcsbFv, selectorManager: RcsbFvSelectorManager) => void;
}

plugin: SaguaroPluginPublicInterface exposes the interface to interact with the Molstar plugin and change model representations (ref). It provides multiple methods such as hide, display or select to modify how structural data is displayed. The parameter pfv: RcsbFv allows to access the feature viewer API (ref). It exposes methods to modify selections, change board configuration, zoom or adding new tracks.

Source code example can be found in src/examples/single-chain/index.tsx

Contributing

All contributions are welcome. Please, make a pull request or open an issue.

License

The MIT License

Copyright (c) 2021 - now, RCSB PDB and contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

changelog

RCSB Saguaro 3D Changelog

Semantic Versioning

[4.0.11] - 2024-03-08

Improvement

  • 1D3D checkboxes can use molstar info to display component availability. This is useful for non PDB entries

[4.0.10] - 2024-03-06

Improvement

  • div delimiter increased width && transparent

Dependency update

  • rcsb-saguaro-app v6.0.13
  • rcsb-saguaro v3.0.7
  • Multiple dependencies have been updated

[4.0.9] - 2024-01-10

Configuration

  • Updated group views help link

[4.0.8] - 2024-01-10

Configuration

  • Updated assembly view help link

Dependency update

  • rcsb-saguaro-app v6.0.9
  • dependencies audit fix

[4.0.7] - 2023-12-07

Dependency update

  • rcsb-saguaro v3.0.7
  • rcsb-saguaro-app v6.0.8

[4.0.6] - 2023-12-07

Dependency update

  • rcsb-saguaro v3.0.6
  • rcsb-saguaro-app v6.0.7

[4.0.5] - 2023-12-04

Improvement

  • FocusResidueColorTheme used in assembly view

[4.0.4] - 2023-11-30

Dependency update

  • rcsb-saguaro v3.0.5
  • rcsb-saguaro-app v6.0.5

[4.0.3] - 2023-11-27

Dependency update

  • rcsb-saguaro v3.0.4
  • rcsb-saguaro-app v6.0.4

[4.0.2] - 2023-11-27

Dependency update

  • rcsb-saguaro-app v6.0.3

[4.0.1] - 2023-11-27

Bug fix

  • MSA polymer checkbox indicator bug fixed

[4.0.0] - 2023-11-22

Breaking changes

  • Types are not anymore exposed from build/src
  • All module classes and types are accessible from lib/
    • Modules format is ESNext
    • lib/commonjs exposes all modules in CommonJS format

Improvement

  • MSA group displays Polymer/Ligand before loading the structure
    • Checkboxes are displayed in grey color

Code refactoring

  • Sass @import changed to @use
  • Styles sheets scss refactoring

Dependency update

  • Multiple dependencies have been updated
  • rcsb-saguaro-app v6.0.0
  • rcsb-saguaro v3.0.0

[3.0.18] - 2023-10-03

Dependency update

  • rcsb-saguaro-app v5.1.5
  • @rcsb/rcsb-molstar v2.8.0,
  • molstar v3.40.1

[3.0.17] - 2023-09-13

Bug fix

  • rcsb-saguaro-app not updated

[3.0.16] - 2023-09-13

Dependency update

  • rcsb-saguaro-app v5.1.4

[3.0.15] - 2023-09-08

Dependency update

  • rcsb-saguaro-app v5.1.1
  • @rcsb/rcsb-molstar v3.7.4
  • Updated multiple dependencies

[3.0.14] - 2023-08-21

Bug fix

  • Models were not superposed correctly in Alignment views

[3.0.13] - 2023-08-16

Improvements

  • Non ball-and-stick representations for ligands will always include an additional ball-and-stick representation

Dependency update

  • @rcsb/rcsb-molstar v3.7.3

[3.0.12] - 2023-08-10

Dependency update

  • @rcsb/rcsb-molstar v3.7.2

[3.0.11] - 2023-08-10

Improvements

  • New focus color theme to match the ribbon color in alignment views

Dependency update

  • molstar v3.38.3

[3.0.10] - 2023-07-11

Bug fix

  • Change sequence chain in Assembly view bug fixed

Dependency update

  • rcsb-api-tools v4.1.13,
  • rcsb-saguaro v2.5.13,
  • rcsb-saguaro-app v5.0.8
  • Updated multiple dependencies

[3.0.9] - 2023-05-19

Bug fix

  • Chain checkbox label bug fixed in assembly view

[3.0.8] - 2023-05-19

Bug fix

  • Chain checkbox display bug fixed in assembly view
  • PFV onchange selection bug fixed in assembly view

[3.0.7] - 2023-05-16

Dependency update

  • rcsb-saguaro-app v5.0.7

[3.0.6] - 2023-05-16

Configuration

  • molstar and rcsb-molstar moved to peerDependencies

Dependency update

  • rcsb-molstar v2.6.1
  • molstar v3.35.0
  • rcsb-saguaro-app v5.0.6

[3.0.5] - 2023-05-09

Dependency update

  • rcsb-saguaro-app v5.0.5

[3.0.4] - 2023-05-03

Dependency update

  • rcsb-saguaro-app v5.0.4

[3.0.3] - 2023-05-02

Dependency update

  • rcsb-saguaro-app v5.0.3

[3.0.2] - 2023-05-02

Dependency update

  • rcsb-saguaro-app v5.0.2

[3.0.1] - 2023-04-26

Style config

  • Structure panel z-index removed and defined as molstar style

[3.0.0] - 2023-04-25

Improvements

  • New entry method RcsbFv3DDataProviderInterface that ingests and displays external alignments
  • New interface ComponentActionInterface used to define what actions are triggered after a new structure is loaded
  • Interface LoadMolstarInterface<P,L> requires two generics: P load argument type and L load return type
  • Interface ViewerModelMapManagerInterface<R,L> needs a new generic that defines the type returned by the loading method in LoadMolstarInterface.
    • It defines a new method getModelIdFromTrajectory(trajectory: L): string|undefined that is used to map loaded structure ids with user provided ids in LoadParams
  • Custom View has been decoupled from RCSB view
  • No StructureViewer data is passed to RcsbFvSequence all communication between panels is dne through the StateManager
  • New RcsbViewBehaviourInterface interface to extend "1d" behaviour to events
  • RcsbFv3DAbstract.render converted to async method
  • Exposed molstar trajectory preset configuration
  • Removed global state for MSA checkboxes

    Dependency update

  • rcsb-saguaro-app v5.0.0
  • rcsb-saguaro v2.5.9
  • rcsb-api-tools v4.1.3

    Configuration

  • All packages are transpiled and included in the final module

    Breaking Changes

  • rcsb-saguaro-app configuration RcsbFvAdditionalConfig.trackConfigModifier.alignment signature changed

[2.3.10] - 2023-03-03

Dependency update

  • molstar update v3.31.2
  • rcsb-molstar v2.5.11

[2.3.9] - 2023-03-02

Dependency update

  • rcsb-saguaro-app v4.5.12

[2.3.8] - 2023-01-20

Dependency update

  • rcsb-saguaro v2.5.8
  • rcsb-saguaro-app v4.5.9

[2.3.7] - 2022-12-12

Bug fix

  • assemblyId parameter has been removed from AlignmentTrajectoryPresetProvider
    • The provider check the first assembly that includes the entity

[2.3.6] - 2022-12-05

Display change

  • MsaRowTitleCheckboxState are hide unless Mol* component exists

[2.3.5] - 2022-12-05

Improvement

  • MsaPfvManagerFactory generalizes and replaces SequenceIdentityPfvManager and UniprotPfvManager
  • MsaRowTitleCheckboxState is disabled if Mol* component is not generated
  • MsaRowTitleComponent is blocked while structure is loaded

Dependency update

  • rcsb-saguaro-app v4.5.7

[2.3.4] - 2022-11-28

Dependency update

  • rcsb-saguaro-app v4.5.6
  • rcsb-saguaro v2.5.5

[2.3.3] - 2022-11-23

Dependency update

  • rcsb-saguaro-app v4.5.4

[2.3.2] - 2022-11-23

Dependency update

  • rcsb-saguaro-app v4.5.3

[2.3.1] - 2022-11-23

New Features

  • Sorting component MsaUiSortComponent for sequence identity MSA

Dependency update

  • rcsb-saguaro-app v4.5.1
  • rcsb-saguaro v2.5.4

[2.3.0] - 2022-11-08

Breaking Change

  • Param LoadMethod.loadPdbIds has been removed. Multiple entries can be loaded passing a list of LoadMolstarInterface to RcsbFvStructureConfigInterface.loadConfig

Minor bug fixes

  • CDN examples fixed

[2.2.1] - 2022-11-03

Improvement

  • New attribute RcsbViewInterface.additionalContent to define the additionalContent React component

[2.2.0] - 2022-11-03

New Features

  • New UniProt MSA 1D3D view
    • UniprotPfvManagerFactory builds UniProt Group MSA PFV
    • SequenceIdentityPfvManagerFactory builds Sequence Identity MSA PFV
    • MsaCallbackManagerFactory MSA 1D callbacks
    • MsaBehaviourObserver MSA 3D callbacks

[2.1.1] - 2022-10-17

Dependency update

  • rcsb-saguaro-app v4.4.13
  • rcsb-saguaro v2.2.16

Minor display update

  • 1D PFV on-change resets 3D display

[2.1.0] - 2022-09-02

Major refactoring

  • StructureViewerBehaviourObserverInterface factory of structure viewer behaviours
  • StructureViewerBehaviourInterface abstraction of structure viewer callback events

[2.0.1] - 2022-09-01

Dependency update

  • rcsb-saguaro-app v4.4.1
  • rcsb-saguaro v2.2.7

[2.0.0] - 2022-08-31

Dependency update

  • rcsb-saguaro-app v4.4.0
  • rcsb-saguaro v2.2.6
  • rcsb-api-tools v4.1.0
  • rcsb-molstar v2.5.5
  • molstar v3.13.0
  • React v18
  • Updated multiple dependencies

Major refactoring

  • StructureViewerInterface abstraction to 3D structure viewer
    • ViewerCallbackManagerInterface defines 3D viewer callbacks
    • ViewerActionManagerInterface defines 3D viewer API
    • ViewerModelMapManagerInterface manager provides information of the loaded structures
  • Global state interface RcsbFvStateInterface manages selections and loaded data

Breaking change

  • FeatureViewInterface callback methods argument selectorManager: RcsbFvSelectorManager has been refactored to stateManager: RcsbFvStateManager

[1.4.4] - 2022-05-26

Dependency update

  • rcsb-saguaro-app v4.3.6
  • rcsb-api-tools v4.0.5

[1.4.3] - 2022-05-20

Dependency update

  • rcsb-saguaro-app v4.3.5
  • rcsb-api-tools v4.0.4

[1.4.2] - 2022-05-20

Dependency update

  • rcsb-api-tools v4.0.3

[1.4.1] - 2022-05-05

Dependency update

  • rcsb-saguaro-app v4.3.2

[1.4.0] - 2022-04-20

Improvement

  • Extending 1D-3D display to any rcsb-saguaro-app PFV methods
    • PfvFactoryInterface defines how the PFV is created
    • CallbackManagerInterface defines the callbacks between the 1D and 3D panels
    • Current implementations: assembly and uniprot (partial implementation)

[1.3.10] - 2022-04-14

Dependency update

  • rcsb-api-tools v4.0.1
  • rcsb-saguaro-app v4.1.2

[1.3.9] - 2022-04-14

Dependency update

  • rcsb-saguaro v2.0.6
  • rcsb-saguaro-app v4.1.1

[1.3.8] - 2022-04-13

Dependency update

  • rcsb-api-tools v4.0.0
  • rcsb-saguaro v2.0.5
  • rcsb-saguaro-app v4.1.0
  • removed http-server module (3 high severity vulnerabilities)

[1.3.7] - 2022-04-07

Bug fixes

  • assymId empty string bug fixed

[1.3.6] - 2022-04-07

Dependency update

  • rcsb-saguaro update 2.0.4
  • rcsb-saguaro-app update 4.0.7
  • rcsb-api-tools update 3.0.2

[1.3.5] - 2022-03-28

Improvements

  • RcsbFv3DAbstract.updateConfig method accepts partial states (Partial<RcsbFvStructureInterface> and Partial<RcsbFvSequenceInterface>)
  • RcsbFv3DAbstract.unmount method includes an optional callback executed after when the component is unmounted
    • Assembly view Back link action has been refactored using the unmount-callback
  • Minor code refactoring

[1.3.4] - 2022-03-07

Bug fixes

  • NMR model change bug fix. New strategy to find the right modeId filtering the assemblyModelSate

[1.3.3] - 2022-03-07

Error publishing

  • No changes, only examples were build

[1.3.2] - 2022-03-04

Configuration improvement

  • RcsbFv3DAssemblyInterface configuration exposes a new optional parameterassemblyId to select the assembly that is being displayed

[1.3.1] - 2022-02-16

Dependency update

  • Updated multiple dependencies

[1.3.0] - 2022-02-08

Improvements

  • New class AssemblyModelSate to handle the assembly selection state in RcsbFvSequence.SequenceViews.AssemblyView.AssemblyView class
  • New callback operatorChangeCallback function attached to operator dropdown menu changes

[1.2.1] - 2021-12-20

Dependency update

  • Update to rcsb-api-tools 2.2.1

[1.2.0] - 2021-12-07

Improvements

  • Support for assembly instance operators
  • New selection interfaces SaguaroChain, SaguaroPosition, SaguaroRange and SaguaroSet
    • Support for selection involving multiple modelId
  • rcsb-saguaro-app update 3.4.0
  • rcsb-molstar update 2.0.0-dev.10

[1.1.0] - 2021-11-02

Minor configuration

  • Exposed InstanceSequenceConfig for assembly view
  • rcsb-saguaro-app update 3.2.1

[1.0.1] - 2021-11-02

Dependency update

  • rcsb-saguaro-app update 3.1.1

[1.0.0] - 2021-10-27

General

  • Initial release