Mercurial > repos > chemteam > bio3d_pca_visualize
annotate visualize_pc.R @ 1:0692d9f9edd3 draft
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
author | chemteam |
---|---|
date | Wed, 27 Mar 2019 15:17:42 -0400 |
parents | 65bfd1b90b96 |
children |
rev | line source |
---|---|
0
65bfd1b90b96
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 |
65bfd1b90b96
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit cd0830e5e3502721fa355cc8e3fedc331201a6e4
chemteam
parents:
diff
changeset
|
2 |
65bfd1b90b96
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) |
65bfd1b90b96
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) |
65bfd1b90b96
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit cd0830e5e3502721fa355cc8e3fedc331201a6e4
chemteam
parents:
diff
changeset
|
5 |
65bfd1b90b96
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit cd0830e5e3502721fa355cc8e3fedc331201a6e4
chemteam
parents:
diff
changeset
|
6 library(bio3d) |
65bfd1b90b96
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit cd0830e5e3502721fa355cc8e3fedc331201a6e4
chemteam
parents:
diff
changeset
|
7 |
65bfd1b90b96
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] |
65bfd1b90b96
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] |
65bfd1b90b96
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit cd0830e5e3502721fa355cc8e3fedc331201a6e4
chemteam
parents:
diff
changeset
|
10 |
65bfd1b90b96
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) |
65bfd1b90b96
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) |
65bfd1b90b96
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit cd0830e5e3502721fa355cc8e3fedc331201a6e4
chemteam
parents:
diff
changeset
|
13 |
65bfd1b90b96
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] |
65bfd1b90b96
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] |
65bfd1b90b96
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] |
65bfd1b90b96
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] |
65bfd1b90b96
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) |
65bfd1b90b96
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit cd0830e5e3502721fa355cc8e3fedc331201a6e4
chemteam
parents:
diff
changeset
|
19 |
65bfd1b90b96
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] |
65bfd1b90b96
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit cd0830e5e3502721fa355cc8e3fedc331201a6e4
chemteam
parents:
diff
changeset
|
21 |
65bfd1b90b96
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit cd0830e5e3502721fa355cc8e3fedc331201a6e4
chemteam
parents:
diff
changeset
|
22 |
65bfd1b90b96
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") { |
65bfd1b90b96
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) |
65bfd1b90b96
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit cd0830e5e3502721fa355cc8e3fedc331201a6e4
chemteam
parents:
diff
changeset
|
25 } |
65bfd1b90b96
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") { |
65bfd1b90b96
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) |
65bfd1b90b96
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit cd0830e5e3502721fa355cc8e3fedc331201a6e4
chemteam
parents:
diff
changeset
|
28 } |
65bfd1b90b96
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") { |
65bfd1b90b96
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) |
65bfd1b90b96
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit cd0830e5e3502721fa355cc8e3fedc331201a6e4
chemteam
parents:
diff
changeset
|
31 } |
65bfd1b90b96
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") { |
65bfd1b90b96
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) |
65bfd1b90b96
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit cd0830e5e3502721fa355cc8e3fedc331201a6e4
chemteam
parents:
diff
changeset
|
34 } |
65bfd1b90b96
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) |
65bfd1b90b96
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit cd0830e5e3502721fa355cc8e3fedc331201a6e4
chemteam
parents:
diff
changeset
|
36 |
65bfd1b90b96
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") { |
65bfd1b90b96
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) |
65bfd1b90b96
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit cd0830e5e3502721fa355cc8e3fedc331201a6e4
chemteam
parents:
diff
changeset
|
39 } |
65bfd1b90b96
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") { |
65bfd1b90b96
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) |
65bfd1b90b96
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit cd0830e5e3502721fa355cc8e3fedc331201a6e4
chemteam
parents:
diff
changeset
|
42 } |
65bfd1b90b96
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit cd0830e5e3502721fa355cc8e3fedc331201a6e4
chemteam
parents:
diff
changeset
|
43 |
65bfd1b90b96
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) |
65bfd1b90b96
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit cd0830e5e3502721fa355cc8e3fedc331201a6e4
chemteam
parents:
diff
changeset
|
45 |