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