annotate dccm.R @ 3:06c9fd5db8c7 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:53 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
1 #!/usr/bin/env Rscript
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
2
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
3 options(stringAsfactors = FALSE)
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
4 args <- commandArgs(trailingOnly = TRUE)
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
5
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
6 library(bio3d)
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
7 require(lattice)
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
8
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
9 dcdfile <- args[1]
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
10 pdbfile <- args[2]
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
11
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
12 dcd <- read.dcd(dcdfile)
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
13 pdb <- read.pdb(pdbfile)
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
14
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
15 selection <- args[3]
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
16 domain <- args[4]
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
17
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
18 output <- args[5]
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
19 dccm_plot <- args[6]
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
20
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
21 dcd <- read.dcd(dcdfile)
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
22 pdb <- read.pdb(pdbfile)
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
23
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
24 if (selection == "string") {
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
25 inds <- atom.select(pdb, string = domain)
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
26 }
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
27 if (selection == "elety") {
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
28 inds <- atom.select(pdb, elety = domain)
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
29 }
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
30 if (selection == "resid") {
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
31 inds <- atom.select(pdb, resid = domain)
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
32 }
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
33 if (selection == "segid") {
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
34 inds <- atom.select(pdb, segid = domain)
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
35 }
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
36
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
37 xyz <- fit.xyz(fixed=pdb$xyz, mobile=dcd, fixed.inds=inds$xyz, mobile.inds=inds$xyz)
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
38 cij<-dccm(xyz[,inds$xyz])
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
39
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
40 write.table(cij, file = output, row.names = TRUE, col.names = FALSE, quote =FALSE, sep="\t")
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
41
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
42 png(dccm_plot)
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
43 plot(cij)
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
44 dev.off()
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
45
06c9fd5db8c7 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 125359d8080653f896089c28cce5308450336f93
chemteam
parents:
diff changeset
46