Mercurial > repos > chemteam > bio3d_pca
annotate rmsd.R @ 0:f56fb2762abb draft
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
author | chemteam |
---|---|
date | Mon, 08 Oct 2018 12:49:36 -0400 |
parents | |
children |
rev | line source |
---|---|
0
f56fb2762abb
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 |
f56fb2762abb
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff
changeset
|
2 |
f56fb2762abb
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) |
f56fb2762abb
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) |
f56fb2762abb
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff
changeset
|
5 |
f56fb2762abb
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff
changeset
|
6 library(bio3d) |
f56fb2762abb
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff
changeset
|
7 |
f56fb2762abb
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] |
f56fb2762abb
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] |
f56fb2762abb
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] |
f56fb2762abb
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff
changeset
|
11 |
f56fb2762abb
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) |
f56fb2762abb
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) |
f56fb2762abb
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff
changeset
|
14 |
f56fb2762abb
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff
changeset
|
15 |
f56fb2762abb
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") { |
f56fb2762abb
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] |
f56fb2762abb
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] |
f56fb2762abb
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] |
f56fb2762abb
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] |
f56fb2762abb
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) |
f56fb2762abb
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff
changeset
|
22 } |
f56fb2762abb
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") { |
f56fb2762abb
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] |
f56fb2762abb
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] |
f56fb2762abb
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] |
f56fb2762abb
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] |
f56fb2762abb
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] |
f56fb2762abb
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) |
f56fb2762abb
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff
changeset
|
30 } |
f56fb2762abb
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") { |
f56fb2762abb
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] |
f56fb2762abb
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] |
f56fb2762abb
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] |
f56fb2762abb
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] |
f56fb2762abb
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) |
f56fb2762abb
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff
changeset
|
37 } |
f56fb2762abb
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") { |
f56fb2762abb
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] |
f56fb2762abb
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] |
f56fb2762abb
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] |
f56fb2762abb
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] |
f56fb2762abb
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) |
f56fb2762abb
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff
changeset
|
44 } |
f56fb2762abb
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") { |
f56fb2762abb
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] |
f56fb2762abb
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] |
f56fb2762abb
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] |
f56fb2762abb
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] |
f56fb2762abb
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) |
f56fb2762abb
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff
changeset
|
51 } |
f56fb2762abb
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff
changeset
|
52 |
f56fb2762abb
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) |
f56fb2762abb
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff
changeset
|
54 |
f56fb2762abb
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]) |
f56fb2762abb
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff
changeset
|
56 |
f56fb2762abb
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") |
f56fb2762abb
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff
changeset
|
58 |
f56fb2762abb
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) |
f56fb2762abb
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.") |
f56fb2762abb
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) |
f56fb2762abb
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff
changeset
|
62 dev.off() |
f56fb2762abb
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff
changeset
|
63 |
f56fb2762abb
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) |
f56fb2762abb
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") |
f56fb2762abb
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) |
f56fb2762abb
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 580d80c3fd856bb3ae18ef7b5458eb3b5e2c7374
chemteam
parents:
diff
changeset
|
67 dev.off() |