annotate PLIDflow/scripts/gpffilemaker.R @ 4:b9e7ec4e3cde draft

Uploaded
author bitlab
date Mon, 27 Jan 2020 07:12:19 -0500
parents 6fcfa4756040
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1 #gpffilemaker makes the GPF file
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
2
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
3 #!/usr/bin/env Rscript
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
4 args = commandArgs(trailingOnly=TRUE)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
5
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
6 if(length(args) < 1){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
7 stop("USE: Rscript gpffilemaker.R <receptor_name> <session_dir>")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
8 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
9
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
10 #Read file containing PDB geometric center and number of points x, y ,z
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
11 #archivo_center_npts <- scan("/home/galaxy/galaxy/tools/proteindocking/scripts/pdbcenter_npts.txt", what = character(), quiet = TRUE)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
12 archivo_center_npts <- scan("pdbcenter_npts.txt", what = character(), quiet = TRUE)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
13
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
14 #Read file containing receptor atom types
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
15 ver <- scan("receptor_atm_types.txt", what = character(), quiet = TRUE, na.strings = "NULLAJSKAJSFL")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
16
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
17
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
18 #Arguments definition
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
19 receptor_name <- args[1]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
20 session_dir <- args[2]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
21 aux_receptor_name <- basename(args[1])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
22 #aux_receptor_name <- paste("/home/galaxy/galaxy/tools/proteindocking/scripts/", basename(args[1]), sep="")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
23 npts_x <- archivo_center_npts[4]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
24 npts_y <- archivo_center_npts[5]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
25 npts_z <- archivo_center_npts[6]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
26 gridcenter_x <- archivo_center_npts[1]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
27 gridcenter_y <- archivo_center_npts[2]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
28 gridcenter_z <- archivo_center_npts[3]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
29
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
30 #Creation of the GPF file
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
31 #Row 1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
32 fila_1_e1 <- paste("npts", npts_x, sep = " ")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
33 fila_1_e2 <- paste(fila_1_e1, npts_y, sep = " ")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
34 fila_1_e3 <- paste(fila_1_e2, npts_z, sep = " ")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
35 fila_1 <- paste(fila_1_e3, "# num.grid points in xyz", sep = " ")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
36
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
37 #Row 2
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
38 fila_2_e2 <- paste(aux_receptor_name, ".maps.fld", sep = "")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
39 fila_2_e1 <- paste("gridfld", fila_2_e2, sep = " " )
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
40 fila_2 <- paste(fila_2_e1, "# grid_data_file", sep = " ")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
41
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
42 #Row 3
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
43 fila_3 <- paste("spacing 1.0", "# spacing(A)", sep = " ")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
44
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
45 #Row 4
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
46 #fila_4 <- paste("receptor_types A C HD N NA OA S SA", "# receptor atom types", sep = " ")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
47 cabecera_f4 <- ver[1]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
48 vector_f4 <- c()
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
49 for(f4 in 2:length(ver)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
50 cabecera_f4 <- paste(cabecera_f4, ver[f4], sep = " ")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
51 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
52
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
53 fila_4 <- paste("receptor_types", cabecera_f4, "# receptor atom types", sep = " ")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
54 #print(fila_4)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
55
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
56 #Row 5
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
57 fila_5 <- paste("ligand_types C HD OA", "# ligand atom types", sep = " ")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
58
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
59 #Row 6
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
60 fila_6_e2 <- paste(aux_receptor_name, ".pdbqt", sep = "")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
61 fila_6_e1 <- paste("receptor", fila_6_e2, sep = " ")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
62 fila_6 <- paste(fila_6_e1, "# macromolecule", sep = " ")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
63
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
64 #Row 7
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
65 fila_7_e1 <- paste("gridcenter",gridcenter_x, sep = " ")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
66 fila_7_e2 <- paste(fila_7_e1, gridcenter_y, sep = " ")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
67 fila_7_e3 <- paste(fila_7_e2, gridcenter_z, sep = " ")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
68 fila_7 <- paste(fila_7_e3, "# xyz-coordinates or auto", sep = " ")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
69
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
70 #Row 8
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
71 fila_8 <- paste("smooth 0.5", "# store minimum energy w/in rad(A)", sep = " ")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
72
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
73 #Row 9
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
74 fila_9_e2 <- paste(aux_receptor_name, ".C.map", sep = "")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
75 fila_9_e1 <- paste("map", fila_9_e2, sep = " ")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
76 fila_9 <- paste(fila_9_e1, "# atom-specific affinity map", sep = " ")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
77
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
78 #Row 10
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
79 fila_10_e2 <- paste(aux_receptor_name, ".HD.map", sep = "")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
80 fila_10_e1 <- paste("map",fila_10_e2, sep = " ")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
81 fila_10 <- paste(fila_10_e1, "# atom-specific affinity map", sep = " ")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
82
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
83 #Row 11
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
84 fila_11_e2 <- paste(aux_receptor_name, ".OA.map", sep = "")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
85 fila_11_e1 <- paste("map", fila_11_e2, sep = " ")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
86 fila_11 <- paste(fila_11_e1, "# atom-specific affinity map", sep = " ")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
87
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
88 #Row 12
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
89 fila_12_e2 <- paste(aux_receptor_name, ".e.map", sep = "")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
90 fila_12_e1 <- paste("elecmap", fila_12_e2, sep = " ")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
91 fila_12 <- paste(fila_12_e1, "# electrostatic potential map", sep = " ")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
92
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
93 #Row 13
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
94 fila_13_e2 <- paste(aux_receptor_name, ".d.map", sep = "")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
95 fila_13_e1 <- paste("dsolvmap", fila_13_e2, sep = " ")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
96 fila_13 <- paste(fila_13_e1, "# desolvation potential map", sep = " ")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
97
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
98 #Row 14
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
99 fila_14 <- paste("dielectric -0.1465", "# <0, AD4 distance-dep.diel;>0, constant", sep = " ")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
100
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
101 #Paste all rows with a line jump for separation
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
102 filas <- c(fila_1, fila_2, fila_3, fila_4, fila_5, fila_6, fila_7, fila_8, fila_9, fila_10, fila_11, fila_12, fila_13, fila_14)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
103
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
104 datos<- c()
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
105 for(i in 1:14){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
106 datos <- paste(c(datos, filas[i]))
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
107 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
108
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
109 #nombre_final <- paste("/home/galaxy/galaxy/tools/proteindocking/scripts/", basename(args[1]), ".gpf", sep="")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
110 nombre_final <- paste(basename(args[1]), ".gpf", sep="")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
111
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
112 write(datos, file=nombre_final, append = FALSE)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
113
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
114 #write(basename(args[1]), file= paste("/home/galaxy/galaxy/tools/proteindocking/scripts/", basename(args[1]), ".txt", sep="")) #parte añadida 18jun2018
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
115 write(basename(args[1]), file= paste(basename(args[1]), ".txt", sep="")) #parte añadida 18jun2018
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
116