Mercurial > repos > chemteam > bio3d_pca_visualize
annotate visualize_pc.R @ 3:f61a718993fd 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:44:04 -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 |