comparison visualize_pc.R @ 0:65bfd1b90b96 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:29:24 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:65bfd1b90b96
1 #!/usr/bin/env Rscript
2
3 options(stringAsfactors = FALSE)
4 args <- commandArgs(trailingOnly = TRUE)
5
6 library(bio3d)
7
8 dcdfile <- args[1]
9 pdbfile <- args[2]
10
11 dcd <- read.dcd(dcdfile)
12 pdb <- read.pdb(pdbfile)
13
14 method <- args[3]
15 selection <- args[4]
16 domain <- args[5]
17 id <- args[6]
18 pcid <- as.integer(id)
19
20 pdbout <- args[7]
21
22
23 if (selection == "string") {
24 inds <- atom.select(pdb, string = domain)
25 }
26 if (selection == "elety") {
27 inds <- atom.select(pdb, elety = domain)
28 }
29 if (selection == "resid") {
30 inds <- atom.select(pdb, resid = domain)
31 }
32 if (selection == "segid") {
33 inds <- atom.select(pdb, segid = domain)
34 }
35 xyz <- fit.xyz(fixed=pdb$xyz, mobile=dcd, fixed.inds=inds$xyz, mobile.inds=inds$xyz)
36
37 if (method == "FALSE") {
38 pc <- pca.xyz(xyz[,inds$xyz], use.svd=FALSE)
39 }
40 if (method == "TRUE") {
41 pc <- pca.xyz(xyz[,inds$xyz], use.svd=TRUE)
42 }
43
44 mktrj.pca(pc, pc=pcid, b=pc$au[,pcid], file=pdbout)
45