annotate rmsd.R @ 1:057daf00ca31 draft

planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 8e1fece3eaef36823e90f5d10f8bb8b809544c55
author chemteam
date Sun, 13 Jan 2019 03:21:33 -0500
parents e838317708a6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
1 #!/usr/bin/env Rscript
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
2
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
3 options(stringAsfactors = FALSE)
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
4 args <- commandArgs(trailingOnly = TRUE)
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
5
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
6 library(bio3d)
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
7
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
8 dcdfile <- args[1]
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
9 pdbfile <- args[2]
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
10 selection <- args[3]
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
11
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
12 dcd <- read.dcd(dcdfile)
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
13 pdb <- read.pdb(pdbfile)
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
14
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
15
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
16 if (selection == "string") {
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
17 domain <- args[4]
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
18 output <- args[5]
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
19 rmsd_plot <- args[6]
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
20 rmsd_hist <- args[7]
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
21 inds <- atom.select(pdb, string = domain)
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
22 }
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
23 if (selection == "resno") {
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
24 res1 <- args[4]
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
25 res2 <- args[5]
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
26 output <- args[6]
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
27 rmsd_plot <- args[7]
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
28 rmsd_hist <- args[8]
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
29 inds <- atom.select(pdb, resno=res1:res2)
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
30 }
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
31 if (selection == "elety") {
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
32 domain <- args[4]
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
33 output <- args[5]
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
34 rmsd_plot <- args[6]
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
35 rmsd_hist <- args[7]
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
36 inds <- atom.select(pdb, elety = domain)
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
37 }
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
38 if (selection == "resid") {
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
39 domain <- args[4]
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
40 output <- args[5]
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
41 rmsd_plot <- args[6]
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
42 rmsd_hist <- args[7]
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
43 inds <- atom.select(pdb, resid = domain)
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
44 }
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
45 if (selection == "segid") {
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
46 domain <- args[4]
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
47 output <- args[5]
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
48 rmsd_plot <- args[6]
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
49 rmsd_hist <- args[7]
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
50 inds <- atom.select(pdb, segid = domain)
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
51 }
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
52
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
53 xyz <- fit.xyz(fixed=pdb$xyz, mobile=dcd, fixed.inds=inds$xyz, mobile.inds=inds$xyz)
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
54
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
55 rd <- rmsd(xyz[1,inds$xyz], xyz[,inds$xyz])
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
56
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
57 write.table(rd, file = output, row.names = TRUE, col.names = FALSE, quote =FALSE, sep="\t")
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
58
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
59 png(rmsd_plot)
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
60 plot(rd, typ="l", ylab="RMSD (Å)", xlab="Frame No.")
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
61 points(lowess(rd), typ="l", col="red", lty=2, lwd=2)
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
62 dev.off()
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
63
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
64 png(rmsd_hist)
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
65 hist(rd, breaks=40, freq=FALSE, main="RMSD Histogram", xlab="RMSD")
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
66 lines(density(rd), typ="l", col="red", lty=2, lwd=2)
e838317708a6 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff changeset
67 dev.off()