Skip to contents

Convert a bio3d multi-structure pdbs object to a multi-element character vector that can be used as input for NGLVieweR and r3dmol.

Usage

pdbs2string(pdbs, collapse = TRUE)

Arguments

pdbs

a multi-structure pdbs object as obtained from pdbaln(), read.fasta.pdb(), etc.

collapse

logical, if TRUE a single element vector is returned. If FALSE a multi-element vector with a element per pdb structure is returned. The later is required for setting distinct viewing options per structure - such as user defined colors (e.g. one per structure) etc.

Value

a character vector of structure data.

Author

Barry Grant, bjgrant@ucsd.edu

Examples

  #pth <- "~/Desktop/courses/BIMM143/class10/pdbs/split_chain/"
  #files <- list.files(path=pth, full.names = TRUE)
  #pdbs <- bio3d::pdbaln(files, fit=TRUE, exefile="msa")

 data(transducin, package="bio3d")
 attach(transducin)
#> The following objects are masked from transducin (pos = 7):
#> 
#>     annotation, core, pdbs
#> The following objects are masked from transducin (pos = 8):
#> 
#>     annotation, core, pdbs

 NGLVieweR::NGLVieweR( bio3d::pdbs2pdb(pdbs), format="pdb") |>
    NGLVieweR::addRepresentation("cartoon")
# Or more simpley... view.pdbs(pdbs) #> Warning: Colors will be recycled: input 'n' > 33
# Trace, tube, line, cartoon, ball+stick view.pdbs(pdbs, representation = "trace") #> Warning: Colors will be recycled: input 'n' > 33
view.pdbs(pdbs, cols = c("red","blue") ) #> Warning: Not enough distinct cols for each structure, recycling
view.pdbs(pdbs, colorScheme = "residueindex")