# Needs MUSCLE installed - testing excluded
if(check.utility("muscle")) {
     ## Stucture of PKA:
     a <- read.pdb("1cmk")
     ## Stucture of PKB:
     b <- read.pdb("2jdo")
     ## Align and fit b on to a:
     path = file.path(tempdir(), "struct.aln")
     aln <- struct.aln(a, b, outpath = path, outfile = tempfile())
     
     ## Should be the same as aln$rmsd (when using aln$a.inds and aln$b.inds)
     rmsd(a$xyz, b$xyz, aln$a.inds$xyz, aln$b.inds$xyz, fit=TRUE)
     
     invisible( cat("\nSee the output files:", list.files(path, full.names = TRUE), sep="\n") )
}
## Not run: 
#      ## Align two subunits of GroEL (open and closed states)
#      a <- read.pdb("1sx4")
#      b <- read.pdb("1xck")
# 
#      ## Select chain A only
#      a.inds <- atom.select(a, chain="A")
#      b.inds <- atom.select(b, chain="A")
# 
#      ## Align and fit:
#      aln <- struct.aln(a,b, a.inds, b.inds)
# ## End(Not run)
Run the code above in your browser using DataLab