comparison visualize_pc.R @ 0:386b4f4b6a85 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:16:19 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:386b4f4b6a85
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