Generate a quick NGL (webGL based) structure overview of bio3d pdb
class
objects with a number of simple defaults. The returned NGLVieweR object
can be further added to for custom interactive visualizations.
Usage
view.pdb(
pdb,
cols = NULL,
colorScheme = "residueindex",
representation = "cartoon",
ligand = TRUE,
ligand.style = "licorice",
backgroundColor = "white",
highlight = NULL,
highlight.style = "ball+stick",
water.rm = FALSE
)
view.old(
pdb,
ligand = TRUE,
chain.colors = bio3d::vmd_colors(),
backgroundColor = "white",
highlight = NULL,
highlight.style = "ball+stick"
)
Arguments
- pdb
a PDB structure object as obtained from
read.pdb()
.- cols
a vector of colors, typically one entry per chain. If
NULL
thencolorScheme
is used. If numeric then output ofvmd.colors(cols)
is used.- colorScheme
keyword based coloring used only if
cols
input is NULL. Possible values include "residueindex", "modelindex", "sstruc", "bfactor", "chainid", "chainindex", "atomindex", and "occupancy".- representation
the representation style, useful values are "line", "tube", "cartoon", "trace", "backbone", and "ball+stick".
- ligand
logical, if TRUE ligands will be rendered as atom colored
ligand.style
.- ligand.style
the representation style to use for ligands.
- backgroundColor
a single element color vector that set the display area background color.
- highlight
an optional
atom.select()
object for highlighting.- highlight.style
the representation style to use for selected
highlight
atoms.- water.rm
logical, if TRUE water molecules are removed pior to viewing.
- chain.colors
Color vector parameter specific to coloring by chain
Value
an NGLVieweR display object that can be displayed or further added to using NGLVieweR::addRepresentation()
and friends.
Details
The purpose of this function is to quickly view a given PDB structure object without having to write output files for input to molecular graphics programs or write multiple lines of NGLVieweR code.
The extra argument highlight
takes a bio3d atom.select()
object to highlight
atom subsets as a given highlight.style
. Useful highlight.style
options include:
"ball+stick", "spacefill", "licorice", "line", "surface" and
"ribbon".
The full set of supported representation
styles include:
"cartoon",
"ribbon",
"tube",
"trace",
"ball+stick",
"line",
"backbone",
"licorice",
"surface",
"point",
"rope",
"spacefill".
Available colorScheme
options include:
"residueindex",
"resname",
"modelindex",
"sstruc",
"bfactor",
"chainid",
"chainindex",
"chainname",
"atomindex",
"occupancy",
"hydrophobicity",
"random",
"element",
"validation",
Limitations:
Currently the function attempts to map common abbreviations and acronyms of
colorScheme
and representation
values (e.g. "cpk" for "ballandstick",
"sse" for "sstruct", etc.). If a mapping is not available then the default
values of "residueindex" and "ball+stick" are used respectively.
Currently the function does not check for bio3d or NGLVieweR
availability. It also does not work well with trajectory
or pdbs
objects. For the later use view.pdbs()
.
Author
Barry Grant, bjgrant@ucsd.edu
Examples
pdb <- bio3d::read.pdb("1hsg")
#> Note: Accessing on-line PDB file
#> Warning: /var/folders/jd/wjwf0lcj0kd0tch_70sd1l4w0000gn/T//RtmpEoJQ6k/1hsg.pdb exists. Skipping download
view.pdb(pdb)
view.pdb(pdb, ligand=FALSE, cols=c("pink","aquamarine"))
#> Potential ligands found but not displayed, use ligand=T to view
view.pdb(pdb, colorScheme = "sstruc")
#ras <- read.pdb("5p21")
#view.pdb(ras)
sele <- bio3d::atom.select(pdb, resno=c(25, 50))
view.pdb(pdb, highlight = sele,
cols = c("navy","orange"),
backgroundColor = "pink",
highlight.style = "spacefill")