Mercurial > repos > chemteam > bio3d_pca
annotate visualize_pc.R @ 2:5892927664be draft
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit cd0830e5e3502721fa355cc8e3fedc331201a6e4
author | chemteam |
---|---|
date | Tue, 26 Feb 2019 08:27:55 -0500 |
parents | |
children |
rev | line source |
---|---|
2
5892927664be
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 |
5892927664be
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit cd0830e5e3502721fa355cc8e3fedc331201a6e4
chemteam
parents:
diff
changeset
|
2 |
5892927664be
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) |
5892927664be
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) |
5892927664be
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit cd0830e5e3502721fa355cc8e3fedc331201a6e4
chemteam
parents:
diff
changeset
|
5 |
5892927664be
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit cd0830e5e3502721fa355cc8e3fedc331201a6e4
chemteam
parents:
diff
changeset
|
6 library(bio3d) |
5892927664be
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit cd0830e5e3502721fa355cc8e3fedc331201a6e4
chemteam
parents:
diff
changeset
|
7 |
5892927664be
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] |
5892927664be
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] |
5892927664be
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit cd0830e5e3502721fa355cc8e3fedc331201a6e4
chemteam
parents:
diff
changeset
|
10 |
5892927664be
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) |
5892927664be
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) |
5892927664be
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit cd0830e5e3502721fa355cc8e3fedc331201a6e4
chemteam
parents:
diff
changeset
|
13 |
5892927664be
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] |
5892927664be
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] |
5892927664be
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] |
5892927664be
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] |
5892927664be
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) |
5892927664be
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit cd0830e5e3502721fa355cc8e3fedc331201a6e4
chemteam
parents:
diff
changeset
|
19 |
5892927664be
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] |
5892927664be
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit cd0830e5e3502721fa355cc8e3fedc331201a6e4
chemteam
parents:
diff
changeset
|
21 |
5892927664be
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit cd0830e5e3502721fa355cc8e3fedc331201a6e4
chemteam
parents:
diff
changeset
|
22 |
5892927664be
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") { |
5892927664be
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) |
5892927664be
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit cd0830e5e3502721fa355cc8e3fedc331201a6e4
chemteam
parents:
diff
changeset
|
25 } |
5892927664be
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") { |
5892927664be
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) |
5892927664be
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit cd0830e5e3502721fa355cc8e3fedc331201a6e4
chemteam
parents:
diff
changeset
|
28 } |
5892927664be
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") { |
5892927664be
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) |
5892927664be
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit cd0830e5e3502721fa355cc8e3fedc331201a6e4
chemteam
parents:
diff
changeset
|
31 } |
5892927664be
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") { |
5892927664be
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) |
5892927664be
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit cd0830e5e3502721fa355cc8e3fedc331201a6e4
chemteam
parents:
diff
changeset
|
34 } |
5892927664be
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) |
5892927664be
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit cd0830e5e3502721fa355cc8e3fedc331201a6e4
chemteam
parents:
diff
changeset
|
36 |
5892927664be
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") { |
5892927664be
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) |
5892927664be
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit cd0830e5e3502721fa355cc8e3fedc331201a6e4
chemteam
parents:
diff
changeset
|
39 } |
5892927664be
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") { |
5892927664be
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) |
5892927664be
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit cd0830e5e3502721fa355cc8e3fedc331201a6e4
chemteam
parents:
diff
changeset
|
42 } |
5892927664be
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit cd0830e5e3502721fa355cc8e3fedc331201a6e4
chemteam
parents:
diff
changeset
|
43 |
5892927664be
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) |
5892927664be
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit cd0830e5e3502721fa355cc8e3fedc331201a6e4
chemteam
parents:
diff
changeset
|
45 |