Function to take bio3d structure and use in the r3dmol app.

m_bio3d(pdb)

Arguments

pdb

bio3d object containing coordinates for desired structure

Examples

library(bio3d)
library(r3dmol)

# create bio3d object
pdb <- read.pdb("1bna")
#>   Note: Accessing on-line PDB file

# inspect bio3d object
pdb
#> 
#>  Call:  read.pdb(file = "1bna")
#> 
#>    Total Models#: 1
#>      Total Atoms#: 566,  XYZs#: 1698  Chains#: 2  (values: A B)
#> 
#>      Protein Atoms#: 0  (residues/Calpha atoms#: 0)
#>      Nucleic acid Atoms#: 486  (residues/phosphate atoms#: 24)
#> 
#>      Non-protein/nucleic Atoms#: 80  (residues: 80)
#>      Non-protein/nucleic resid values: [ HOH (80) ]
#> 
#>    Nucleic acid sequence:
#>       CGCGAATTCGCGCGCGAATTCGCG
#> 
#> + attr: atom, xyz, seqres, calpha, remark,
#>         call

# load bio3d object into r3dmol
r3dmol() %>%
  m_add_model(data = m_bio3d(pdb)) %>%
  m_zoom_to()