Mercurial > repos > chemteam > bio3d_dccm
annotate visualize_pc.R @ 2:4f318cb7c680 draft default tip
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 3b99f08f22b9e0c16c0a0adc82f8c16c1a25cedf"
| author | chemteam | 
|---|---|
| date | Mon, 07 Oct 2019 12:31:34 -0400 | 
| parents | 3e1340e01e74 | 
| children | 
| rev | line source | 
|---|---|
| 0 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 1 #!/usr/bin/env Rscript | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 2 | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 3 options(stringAsfactors = FALSE) | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 4 args <- commandArgs(trailingOnly = TRUE) | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 5 | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 6 library(bio3d) | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 7 | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 8 dcdfile <- args[1] | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 9 pdbfile <- args[2] | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 10 | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 11 dcd <- read.dcd(dcdfile) | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 12 pdb <- read.pdb(pdbfile) | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 13 | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 14 method <- args[3] | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 15 selection <- args[4] | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 16 domain <- args[5] | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 17 id <- args[6] | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 18 pcid <- as.integer(id) | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 19 | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 20 pdbout <- args[7] | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 21 | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 22 | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 23 if (selection == "string") { | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 24 inds <- atom.select(pdb, string = domain) | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 25 } | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 26 if (selection == "elety") { | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 27 inds <- atom.select(pdb, elety = domain) | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 28 } | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 29 if (selection == "resid") { | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 30 inds <- atom.select(pdb, resid = domain) | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 31 } | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 32 if (selection == "segid") { | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 33 inds <- atom.select(pdb, segid = domain) | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 34 } | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 35 xyz <- fit.xyz(fixed=pdb$xyz, mobile=dcd, fixed.inds=inds$xyz, mobile.inds=inds$xyz) | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 36 | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 37 if (method == "FALSE") { | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 38 pc <- pca.xyz(xyz[,inds$xyz], use.svd=FALSE) | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 39 } | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 40 if (method == "TRUE") { | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 41 pc <- pca.xyz(xyz[,inds$xyz], use.svd=TRUE) | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 42 } | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 43 | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 44 mktrj.pca(pc, pc=pcid, b=pc$au[,pcid], file=pdbout) | 
| 
3e1340e01e74
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
 chemteam parents: diff
changeset | 45 | 
