1.0.3 • Published 6 years ago

react-pdb-view v1.0.3

Weekly downloads
8
License
MIT
Repository
github
Last release
6 years ago

React PDB Viewer

What is it?

A simple React component for displaying molecular orbital models from Protein Databank (.pdb) files. Uses three-full and the PDBLoader class from the Three.js examples to load and display models in a WebGL context. Take a look at the demo here.

How to use it

If you're in a hurry, the only required prop is url.

is used as such:

` <PDBView

    url="https://files.rcsb.org/download/6C4G.pdb"  

    atomIncrement={0}  

    width="60vw"  

    height="60vh"  

    atomSize={200}  

    cameraDistance={100}  

    autoRotate={false}  

  />`

Props:

PropVariable TypedescriptionDefault Value
urlstringURL of a valid .pdb file.Required
atomIncrementnumber (integer)Number of atoms to skip while loading. If atomIncrement is 3, the viewer will only load and display every 4th atom from the source file. Tweak for speed.0
atomSizenumber (float)Corresponds to the radius of each individual atom1
atomDistancenumber (float)Distance between atoms in the model0.5
widthstringWidth of the PDB Viewer component. Accepts relative or absolute units.400px
heightstringHeight of the PDB Viewer component. Accepts relative or absolute units.400px
antialiasingbooleanEnable/disable antialiasingfalse
cameraDistancenumberThe distance of the camera from the origin point150
autoRotatebooleanShould the camera automatically rotate around the molecule?true
panbooleanAllow panning when right-click dragging?true
loaderJSX elementElement to display while loading, e.g. a CSS spinner.null
fallbackJSX elementElement displayed in case the component fails to load or errors during operationnull

Todos:

  • Add additional shader options
  • Add keyboard controls for rotation/zooming to OrbitControls
  • Accessibility audit (probably add a colorblind mode too)
  • Caching .pdb files
  • Ribbon diagrams (secondary/tertiary structure)
1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago