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