@rcsb/rcsb-saguaro-3d

    1.4.4 • Public • Published

    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.

    CDN JavaScript

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

    Node Module Instalation

    npm install @rcsb/rcsb-saguaro-3d

    Building & Running

    Build app

    npm install
    npm run buildApp
    

    Build examples

    npm run buildExamples
    

    From the root of the project:

    npx http-server -p PORT-NUMBER
    

    and navigate to localhost:PORT-NUMBER/build/examples/

    Library Documentation

    TypeScript full classes 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.

    interface RcsbFv3DAssemblyInterface extends RcsbFv3DAbstractInterface {
       elementId: "htmlElement",
       config: {
            entryId: string;
            title?: string;
            subtitle?: string;
        };
        additionalConfig?: RcsbFvAdditionalConfig;
    }

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

    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 extends RcsbFv3DAbstractInterface {
       elementId: "htmlElement",
        structurePanelConfig: RcsbFvStructureInterface;
        sequencePanelConfig: {
            config: CustomViewInterface;
            title?: string;
            subtitle?: string;
        };
    }

    Alt text

    Structural Panel

    The structural panel configuration structurePanelConfig: RcsbFvStructureInterface 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 RcsbFvStructureInterface {
        loadConfig: LoadMolstarInterface;
        pluginConfig?: Partial<ViewerProps>;
    }

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

    interface LoadMolstarInterface {
        loadMethod: LoadMethod;
        loadParams: LoadParams | Array<LoadParams>;
    }
    • loadMethod: LoadMethod is an enumerated value that indicates the source of the structural models
    enum LoadMethod {
        loadPdbId = "loadPdbId",
        loadPdbIds = "loadPdbIds",
        loadStructureFromUrl = "loadStructureFromUrl"
    }
    • loadParams: LoadParams | Array<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: SaguaroPluginPublicInterface, pfvList: Array<RcsbFv>, selection: RcsbFvSelectorManager) => void;
    }

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

    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: SaguaroPluginPublicInterface, selectorManager: RcsbFvSelectorManager, sequenceRegion: Array<RcsbFvTrackDataElementInterface>) => void;
        sequenceElementClickCallback: (plugin: SaguaroPluginPublicInterface, selectorManager: RcsbFvSelectorManager, d: RcsbFvTrackDataElementInterface) => void;
        sequenceHoverCallback: (plugin: SaguaroPluginPublicInterface, selectorManager: RcsbFvSelectorManager, hoverRegion: Array<RcsbFvTrackDataElementInterface>) => void;
        structureSelectionCallback: (plugin: SaguaroPluginPublicInterface, pfv: RcsbFv, selectorManager: RcsbFvSelectorManager) => void;
        structureHoverCallback: (plugin: SaguaroPluginPublicInterface, 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.

    Install

    npm i @rcsb/rcsb-saguaro-3d

    DownloadsWeekly Downloads

    443

    Version

    1.4.4

    License

    MIT

    Unpacked Size

    10.4 MB

    Total Files

    35

    Last publish

    Collaborators

    • chunxiao.bi
    • ingvord
    • robert.lowe
    • bioinsilico
    • yana.rose
    • sebastian.bittrich