annotate PLIDflow/scripts/cluster_to_vina_cluster.R @ 2:afd5b5ffc38f draft

Uploaded
author bitlab
date Tue, 14 Jan 2020 07:52:48 -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 #cluster_to_vina_clusters.R introduces the x, y,z, coordenates of the cluster/-s identified in the vina file configuration how many cluster/-s identified
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) < 8){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
7 stop("USE: Rscript cluster_to_vina_clusters.R <receptor_name> <ligand_name> <out_PDBQT> <log_file> <eboxsizedata> <session_dir> <receptor_filename> <ligand_filename>")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
8 #stop("USE: Rscript cluster_to_vina_clusters.R <receptor_name> <ligand_name> <out_PDBQT> <log_file> <eboxsizedata> <out_conf_file>")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
9 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
10
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
11 #Arguments definition
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
12 receptor_name <- args[1]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
13 ligand_name <- args[2]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
14 out_PDBQT <- args[3]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
15 log_file <- args[4]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
16 eboxsizedata <- args[5]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
17 session_dir <- args[6]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
18 #out_conf_file <- args[6]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
19 receptor_filename <- args[7]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
20 ligand_filename <- args[8]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
21
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
22 setwd(session_dir)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
23
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
24 #print("before reading table")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
25 clusters_file <- read.table("clusterscoordenates.txt", header = TRUE)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
26 #print("After reading table")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
27
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
28 value <- 0
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
29 el_b_que_me_quedo <- 1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
30 for(v in 1: nrow(clusters_file)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
31 coo_x <- clusters_file[v,2]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
32 coo_y <- clusters_file[v,3]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
33 coo_z <- clusters_file[v,4]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
34
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
35
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
36 #<receptor_PDBQT> <ligand_PDBQT> <out_PDBQT> <log_file> <coo_x > <coo_y> <coo_z> <eboxsizedata> <galaxy out> <v>
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
37 argumentos <- paste(args[1],args[2], args[3], args[4], coo_x, coo_y, coo_z, args[5], v, session_dir, sep = " ")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
38 script_argumentos <- paste("Rscript vinafilemarkerclusters.R", argumentos, sep = " ")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
39
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
40 system (script_argumentos)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
41 system (paste("vina --config ", paste(v, "_vinaconfig", sep = ""), sep =""))
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
42 #system (paste("/home/eugenia/workflowsoftware/autodock_vina_1_1_2_linux_x86/bin/vina --config ", paste(v, "_vinaconfig", sep = ""), sep =""))
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
43 #write(paste("/home/eugenia/workflowsoftware/autodock_vina_1_1_2_linux_x86/bin/vina --config ", paste(v, "_vinaconfig", sep = ""), sep =""), file = "commands", append = TRUE)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
44 #
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
45
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
46 #Save out pdbqt from Vina 30julio2018
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
47 #print("before scanning")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
48 outlog_vina <- scan (paste(v, "_vinaconfig", sep = ""), what = character(), quiet = TRUE)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
49 #print("after scanning")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
50
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
51 pegar_mv_out9 <- paste("mv", outlog_vina[9], sep = " ")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
52 pegar_v_out <- paste(v,"_", receptor_filename, "_", ligand_filename, "_out_vina.pdbqt", sep = "")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
53 pegar_dos_outs <- paste(pegar_mv_out9, pegar_v_out, sep = " ")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
54
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
55
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
56 #print(pegar_dos_outs)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
57 system(pegar_dos_outs)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
58
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
59 #Save log pdbqt from Vina 30julio2018
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
60 pegar_mv_out12 <- paste("mv", outlog_vina[12], sep = " ")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
61 pegar_v_log <- paste(v,"_", receptor_filename, "_", ligand_filename, "_log_vina.log", sep = "")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
62 pegar_dos_logs <- paste(pegar_mv_out12, pegar_v_log, sep = " ")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
63
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
64 system(pegar_dos_logs)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
65
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
66 #
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
67
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
68 #binding_mode1_energy <- scan(args[4], what = character(), quiet = TRUE)[122]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
69 #if(v == 1) value <- binding_mode1_energy
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
70 #if(value > as.numeric(binding_mode1_energy)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
71 # value <- as.numeric(binding_mode1_energy)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
72 # el_b_que_me_quedo <- v
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
73 #}
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
74 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
75
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
76 #copiador <- paste(el_b_que_me_quedo, "_vinaconfig", sep="")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
77 #argumentos <- paste("mv", copiador, out_conf_file, sep=" ")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
78 #print(argumentos)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
79 #system(argumentos)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
80
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
81 #system(paste("zip all-vinas-out.zip", "*_out_vina", sep = " ")) #antes del 31julio
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
82 #system(paste("mv", "all-vinas-out.zip", args[3] , sep = " ")) #antes del 31julio
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
83
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
84 #system(paste("zip all-vinas-log.zip", "*_log_vina", sep = " ")) #antes del 31julio
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
85 #system(paste("mv", "all-vinas-log.zip", args[4] , sep = " ")) #antes del 31julio
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
86
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
87 #31julio2018 ----> creo que hay que cambiar los guiones porque hoy se ha quedado pillado en los zip que no lo ha hecho
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
88 #30agosto2018 -----> voy a hacer el cambio
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
89
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
90 # USE THIS FOR keeping stdout but removing stderr
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
91 # { cmd 2>&1 >&3 3>&- | logger 3>&-; } 3>&1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
92
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
93 system(paste("zip all_vinas_out.zip", "*_out_vina.pdbqt", sep = " ")) #30agosto
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
94 system(paste("mv", "all_vinas_out.zip", args[3] , sep = " ")) #30agosto
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
95
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
96 system(paste("zip all_vinas_log.zip", "*_log_vina.log", sep = " ")) #30agosto
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
97 system(paste("mv", "all_vinas_log.zip", args[4] , sep = " ")) #30agosto
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
98
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
99
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
100