changeset 2:afd5b5ffc38f draft

Uploaded
author bitlab
date Tue, 14 Jan 2020 07:52:48 -0500
parents eda62adfc858
children d45ae17b4470
files PLIDflow/autodocktools_lig_plidflow.xml PLIDflow/autodocktools_rec_plidflow.xml PLIDflow/confmaker_multiple_plidflow.xml PLIDflow/eboxsize_plidflow.xml PLIDflow/launch_confmaker_multiple.sh PLIDflow/modeller_plidflow.xml PLIDflow/openbabel_SDF_plidflow.xml PLIDflow/openbabel_SMI_plidflow.xml PLIDflow/pdb2pqr_plidflow.xml PLIDflow/scripts/cluster_to_vina_cluster.R PLIDflow/scripts/clusterfilemaker.R PLIDflow/scripts/clusterfinder_Auto.R PLIDflow/scripts/envelopesmaker.R PLIDflow/scripts/glgfilemaker.R PLIDflow/scripts/gpffilemaker.R PLIDflow/scripts/includeAtom3.sh PLIDflow/scripts/parallel_launch.sh PLIDflow/scripts/pdbcenter_npts_finder.R PLIDflow/scripts/pdbqtcorrector.R PLIDflow/scripts/pdbqtcorrector2step.R PLIDflow/scripts/receptor_atm_types.txt PLIDflow/scripts/requirements.txt PLIDflow/scripts/separateChain.sh PLIDflow/scripts/table PLIDflow/scripts/templateenvelopsizes.txt PLIDflow/scripts/templatefillouts1.txt PLIDflow/scripts/templatefillouts1_1_8.txt PLIDflow/scripts/templatefillouts1_ALLFILLS.txt PLIDflow/scripts/templatefillouts1_OKsoloout1.txt PLIDflow/scripts/vinafilemaker.R PLIDflow/scripts/vinafilemarkerclusters.R PLIDflow/scripts/vinaoutpututility.sh PLIDflow/separate_chain_plidflow.xml PLIDflow/vina_plidflow.xml
diffstat 34 files changed, 3920 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PLIDflow/autodocktools_lig_plidflow.xml	Tue Jan 14 07:52:48 2020 -0500
@@ -0,0 +1,17 @@
+<tool id="autodocktools_ligand_plidflow" name="PLIDflow: AutoDock Ligand">
+  <description>AutoDock is a suite of automated docking tools. It is designed to predict how small molecules, such as substrates or drug candidates, bind to a receptor of known 3D structure.</description>
+  <inputs>
+	  <param name="ligand_pdb" type="data" format="pdb" label="Ligand PDB file" help="The formatted receptor is written in a 'pdbqt' file."/>
+  </inputs>
+  <command><![CDATA[
+
+	  swpath=\$(which prepare_ligand4.py) ; 
+	  cp ${ligand_pdb} ${ligand_pdb}.pdb ; 
+	  (pythonsh \$swpath -l ${ligand_pdb}.pdb -o $ligand_pdbqt) ;
+	  rm ${ligand_pdb}.pdb ;
+
+	 ]]></command>
+  <outputs>
+    <data name="ligand_pdbqt" format="pdbqt" label="Ligand PDBQT file"/>
+  </outputs>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PLIDflow/autodocktools_rec_plidflow.xml	Tue Jan 14 07:52:48 2020 -0500
@@ -0,0 +1,22 @@
+<tool id="autodocktools_receptor_plidflow" name="PLIDflow: AutoDock Receptor">
+  <description>AutoDock is a suite of automated docking tools. It is designed to predict how small molecules, such as substrates or drug candidates, bind to a receptor of known 3D structure</description>
+  <inputs>
+	  <param name="receptor_pdb" type="data" format="pdb" label="Receptor PDB file" help="Preparing the receptor involves adding gasteiger charges and adding hydrogens. The formatted receptor is written in a 'pdbqt' file."/>
+  </inputs>
+  <command><![CDATA[
+	 
+	  swpath=\$(which prepare_receptor4.py) ; 
+	  cp ${receptor_pdb} ${receptor_pdb}.pdb ; 
+	  pythonsh \$swpath -r ${receptor_pdb}.pdb -A hydrogens -o $receptor_pdbqt;
+	  rm ${receptor_pdb}.pdb; 
+	  Rscript ${__tool_directory__}/scripts/pdbqtcorrector2step.R ${receptor_pdbqt} ${receptor_pdbqt_modified2} ${receptor_types};
+
+	]]></command>
+
+  <outputs>
+	  <data name="receptor_pdbqt" format="pdbqt" label="Receptor PDBQT file"/>
+	  <data name="receptor_pdbqt_modified" format="pdbqt" label="Receptor PDBQT file modified"/>
+	  <data name="receptor_pdbqt_modified2" format="pdbqt" label="Receptor PDBQT file modified 2"/>
+	  <data name="receptor_types" format="txt" label="Receptor types molecules"/>
+  </outputs>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PLIDflow/confmaker_multiple_plidflow.xml	Tue Jan 14 07:52:48 2020 -0500
@@ -0,0 +1,33 @@
+<tool id="cluster_to_vina_cluster_plidflow" name="PLIDflow: Vina File Maker Multiple">
+  <description>is a tool to select optimal Vina mode 1 energy.</description>
+  <inputs>
+    <param name="receptor_pdbqt" type="data" format="pdbqt" label="Receptor PDBQT file" help=""/>
+    <param name="receptor_pdbqt_modified" type="data" format="pdbqt" label="Receptor PDBQT file modified" help=""/>
+    <param name="receptor_pdbqt_modified2" type="data" format="pdbqt" label="Receptor PDBQT file modified 2" help=""/>
+    <param name="ligand_pdbqt" type="data" format="pdbqt" label="Ligand PDBQT file" help=""/>
+    <param name="size_x" type="data" format="txt" label="Grid size" help="eboxSize returns a single number that is the optimal edge length of a cubic docking box."/>
+
+    <param name="receptor_pdb" type="data" format="pdb" label="Receptor PDB file" help="Preparing the receptor involves adding gasteiger charges and adding hydrogens. The formatted receptor is written in a 'pdbqt' file."/>
+    <param name="ligand_smi" type="data" format="smi" label="Drug SMI file" help="Open Babel is a chemical toolbox designed to speak the many languages of chemical data. To convert Line notation SMILES (Simplified Molecular Input Line Entry System) to coordinate data and bond matrix information in structure Data Format (SDF) format"/>
+    <param name="receptor_types" type="data" format="txt" label="Receptor types" help="File containing the receptor types" />
+
+  </inputs>
+  <command><![CDATA[
+	  nameX="${receptor_pdb.name}";
+          nameY="${ligand_smi.name}";
+
+	  nameX=\$(echo \${nameX//[^[:alpha:]]/_});
+
+	  nameY=\$(echo \${nameY//[^[:alpha:]]/_});
+
+
+	  ${__tool_directory__}/launch_confmaker_multiple.sh $receptor_pdbqt $receptor_pdbqt_modified $receptor_pdbqt_modified2 $ligand_pdbqt $size_x $out $log \$nameX \$nameY $receptor_pdb $receptor_types ${__tool_directory__} ; 
+  
+	  ]]></command>
+  <outputs>
+	  <data name="out" format="zip" label="Output pdbqt from vina"/>
+	  <data name="log" format="zip" label="Output log from vina"/>
+  </outputs>
+</tool>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PLIDflow/eboxsize_plidflow.xml	Tue Jan 14 07:52:48 2020 -0500
@@ -0,0 +1,15 @@
+<tool id="eboxsize_plidflow" name="PLIDflow: eBoxSize">
+  <description>is a tool to customize the box size for individual query ligands in order to maximize the accuracy of molecular docking.</description>
+  <inputs>
+	  <param name="ligand_pdbqt" type="data" format="pdbqt" label="Ligand PDBQT file" help="eboxSize returns a single number that is the optimal edge length of a cubic docking box."/>
+  </inputs>
+  <command> <![CDATA[
+	  swpath=\$(which eBoxSize-1.1.pl) ;
+	  cp $ligand_pdbqt ${ligand_pdbqt}.pdbqt ;
+	  (perl \$swpath ${ligand_pdbqt}.pdbqt ) > $eboxsizedata ;
+	  rm ${ligand_pdbqt}.pdbqt ;
+  ]]></command>
+  <outputs>
+    <data name="eboxsizedata" format="txt" label="OptimalSizeBox out"/>
+  </outputs>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PLIDflow/launch_confmaker_multiple.sh	Tue Jan 14 07:52:48 2020 -0500
@@ -0,0 +1,76 @@
+receptor_pdbqt=$1
+receptor_pdbqt_modified=$2
+receptor_pdbqt_modified2=$3
+ligand_pdbqt=$4
+size_x=$5
+out=$6
+log=$7
+receptor_name=$8
+ligand_name=$9
+# This one is to extract the protein code and to check whether the fillouts have already been done
+# This is for the parallel version, ignore
+receptor_file=${10}
+receptorTypes=${11}
+toolsDirectory=${12}
+
+# Configuration variables // This is not really necessary anymore
+MYRAND=$(( ( RANDOM % 10000000 )  + 1 ))
+RANDDIR=${MYRAND}
+
+
+
+
+
+mkdir $RANDDIR
+
+
+cp -r ${toolsDirectory}/scripts/* $RANDDIR
+echo "$toolsDirectory"
+
+cp $receptorTypes $RANDDIR
+NOMBRERECEPTOR=$(basename $receptorTypes)
+mv $RANDDIR/$NOMBRERECEPTOR $RANDDIR/receptor_atm_types.txt
+
+MYPWD=$PWD
+
+
+cd $RANDDIR
+
+source ADT_VENV/bin/activate
+
+#echo "[RUNNING] - (Rscript pdbcenter_npts_finder.R $receptor_pdbqt_modified $RANDDIR) &>/dev/null"
+Rscript pdbcenter_npts_finder.R $receptor_pdbqt_modified2 $MYPWD/$RANDDIR
+
+#echo "[RUNNING] - (Rscript gpffilemaker.R $receptor_pdbqt $RANDDIR) "
+Rscript gpffilemaker.R $receptor_pdbqt_modified2 $MYPWD/$RANDDIR
+
+#echo "[RUNNING] - (Rscript glgfilemaker.R $receptor_pdbqt $RANDDIR) "
+Rscript glgfilemaker.R $receptor_pdbqt_modified2 $MYPWD/$RANDDIR
+
+#echo "[RUNNING] - (Rscript envelopesmaker.R $receptor_pdbqt $RANDDIR) "
+#(Rscript envelopesmaker.R $receptor_pdbqt $RANDDIR) &>/dev/null
+pathLigand=$(which AutoLigand.py)
+Rscript envelopesmaker.R $receptor_pdbqt_modified2 $MYPWD/$RANDDIR $pathLigand
+
+#cp ~/proteindb/2E9U_PH7/FILL* .
+
+#echo "[RUNNING] - (Rscript envelopesmaker.R $receptor_pdbqt $RANDDIR) "
+#(Rscript envelopesmaker.R $receptor_pdbqt $RANDDIR) &>/dev/null
+
+
+#echo "[RUNNING] - (Rscript clusterfilemaker.R $RANDDIR) "
+Rscript clusterfilemaker.R $MYPWD/$RANDDIR
+
+
+#echo "[RUNNING] - (Rscript clusterfinder_Auto.R $RANDDIR) "
+Rscript clusterfinder_Auto.R $MYPWD/$RANDDIR
+
+
+#echo "[RUNNING] - (Rscript cluster_to_vina_cluster.R $receptor_pdbqt_modified2 $ligand_pdbqt $out $log $size_x $RANDDIR $receptor_name $ligand_name) "
+Rscript cluster_to_vina_cluster.R $receptor_pdbqt_modified2 $ligand_pdbqt $out $log $size_x $MYPWD/$RANDDIR $receptor_name $ligand_name
+
+
+cd $MYPWD
+
+
+deactivate
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PLIDflow/modeller_plidflow.xml	Tue Jan 14 07:52:48 2020 -0500
@@ -0,0 +1,10 @@
+<tool id="modeller_plidflow" name="PLIDflow: Modeller">
+  <description>Modeller description</description>
+  <inputs>
+	  <param name="pdbFile" type="data" format="txt" label="PDB file" help="Select a valid PDB file"/>
+  </inputs>
+  <command>mod9.19 $pdbFile $mutantPdbFile0 </command>
+  <outputs>
+    <data name="mutantPdbFile0" format="txt" label="mutant.PDB"/>
+  </outputs>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PLIDflow/openbabel_SDF_plidflow.xml	Tue Jan 14 07:52:48 2020 -0500
@@ -0,0 +1,10 @@
+<tool id="openbabelSDF_plidflow" name="PLIDflow: Open Babel SDF">
+  <description>Open Babel converts chemical structures from one file format to another. Use Open Babel to convert SDF files to PDF files</description>
+  <inputs>
+	  <param name="ligand_sdf" type="data" format="sdf" label="Drug SDF file" help="Open Babel is a chemical toolbox designed to speak the many languages of chemical data. To convert SDF file to Protein Data Bank (PDB) format describing the three-dimensional structures of molecules."/>
+  </inputs>
+  <command>(obabel -i sdf $ligand_sdf -o pdb -O $ligand_pdb) &amp;>/dev/null </command>
+  <outputs>
+    <data name="ligand_pdb" format="pdb" label="Drug PDB file"/>
+  </outputs>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PLIDflow/openbabel_SMI_plidflow.xml	Tue Jan 14 07:52:48 2020 -0500
@@ -0,0 +1,10 @@
+<tool id="openbabelSMI_plidflow" name="PLIDflow: Open Babel SMI">
+  <description>Open Babel converts chemical structures from one file format to another. Use Open Babel to convert SMI files to SDF files</description>
+  <inputs>
+	  <param name="ligand_smi" type="data" format="smi" label="Drug SMI file" help="Open Babel is a chemical toolbox designed to speak the many languages of chemical data. To convert Line notation SMILES (Simplified Molecular Input Line Entry System) to coordinate data and bond matrix information in structure Data Format (SDF) format"/>
+  </inputs>
+  <command>(obabel -i smi $ligand_smi -o sdf -O $ligand_sdf --gen3D) &amp;>/dev/null </command>
+  <outputs>
+    <data name="ligand_sdf" format="sdf" label="Drug SDF file"/>
+  </outputs>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PLIDflow/pdb2pqr_plidflow.xml	Tue Jan 14 07:52:48 2020 -0500
@@ -0,0 +1,18 @@
+<tool id="pdb2pqr_plidflow" name="PLIDflow: PDB2PQR">
+  <description>Converts a pdb to pqr</description>
+  <inputs>
+	  <param name="receptor_pdb" type="data" format="pdb" label="Receptor PDB file" help="Preparing the receptor involves adding gasteiger charges and adding hydrogens. First it will be processed by pdb2pqr."/>
+  </inputs>
+  <command><![CDATA[
+	  swpath=\$(which pdb2pqr.py) ;
+	  python2.7 \$swpath --ff=amber --ffout=amber --verbose --chain --ph-calc-method=propka --with-ph=7.0 --drop-water ${receptor_pdb} ${pdb_processed}.pqr ;
+	  
+	  ${__tool_directory__}/scripts/includeAtom3.sh ${__tool_directory__}/scripts/table ${pdb_processed}.pqr > ${pdb_processed}  ;
+	  
+	  rm ${pdb_processed}.pqr 
+  
+	]]></command>
+  <outputs>
+	  <data name="pdb_processed" format="pdb" label="${receptor_pdb.name}_processed"/>
+  </outputs>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PLIDflow/scripts/cluster_to_vina_cluster.R	Tue Jan 14 07:52:48 2020 -0500
@@ -0,0 +1,100 @@
+#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 
+
+#!/usr/bin/env Rscript      
+args = commandArgs(trailingOnly=TRUE)
+
+if(length(args) < 8){
+  stop("USE: Rscript cluster_to_vina_clusters.R <receptor_name> <ligand_name> <out_PDBQT> <log_file> <eboxsizedata> <session_dir> <receptor_filename> <ligand_filename>")
+  #stop("USE: Rscript cluster_to_vina_clusters.R <receptor_name> <ligand_name> <out_PDBQT> <log_file> <eboxsizedata> <out_conf_file>")
+}
+
+#Arguments definition 
+receptor_name <- args[1]
+ligand_name <- args[2]
+out_PDBQT <- args[3]
+log_file <- args[4]
+eboxsizedata <- args[5]
+session_dir <- args[6]
+#out_conf_file <- args[6]
+receptor_filename <- args[7]
+ligand_filename <- args[8]
+
+setwd(session_dir)
+
+#print("before reading table")
+clusters_file <- read.table("clusterscoordenates.txt", header = TRUE)
+#print("After reading table")
+
+value <- 0
+el_b_que_me_quedo <- 1
+for(v in 1: nrow(clusters_file)){
+        coo_x <- clusters_file[v,2]
+        coo_y <- clusters_file[v,3]
+        coo_z <- clusters_file[v,4]
+
+
+        #<receptor_PDBQT> <ligand_PDBQT> <out_PDBQT> <log_file> <coo_x > <coo_y> <coo_z> <eboxsizedata> <galaxy out> <v>
+        argumentos <- paste(args[1],args[2], args[3], args[4], coo_x, coo_y, coo_z, args[5], v, session_dir, sep = " ")
+        script_argumentos <- paste("Rscript vinafilemarkerclusters.R", argumentos, sep = " ")
+
+        system (script_argumentos)
+        system (paste("vina --config ", paste(v, "_vinaconfig", sep = ""), sep =""))
+        #system (paste("/home/eugenia/workflowsoftware/autodock_vina_1_1_2_linux_x86/bin/vina --config ", paste(v, "_vinaconfig", sep = ""), sep =""))
+        #write(paste("/home/eugenia/workflowsoftware/autodock_vina_1_1_2_linux_x86/bin/vina --config ", paste(v, "_vinaconfig", sep = ""), sep =""), file = "commands", append = TRUE)
+        #
+        
+	#Save out pdbqt from Vina 30julio2018
+	#print("before scanning")
+	outlog_vina <- scan (paste(v, "_vinaconfig", sep = ""), what = character(), quiet = TRUE)
+	#print("after scanning")
+
+	pegar_mv_out9 <- paste("mv", outlog_vina[9], sep = " ")
+	pegar_v_out <- paste(v,"_", receptor_filename, "_", ligand_filename, "_out_vina.pdbqt", sep = "")
+	pegar_dos_outs <- paste(pegar_mv_out9, pegar_v_out, sep = " ")
+
+	
+	#print(pegar_dos_outs)
+	system(pegar_dos_outs) 
+
+	#Save log pdbqt from Vina 30julio2018
+	pegar_mv_out12 <- paste("mv", outlog_vina[12], sep = " ")
+	pegar_v_log <- paste(v,"_", receptor_filename, "_", ligand_filename, "_log_vina.log", sep = "")
+	pegar_dos_logs <- paste(pegar_mv_out12, pegar_v_log, sep = " ")
+
+	system(pegar_dos_logs) 
+	
+	#
+
+        #binding_mode1_energy <- scan(args[4], what = character(), quiet = TRUE)[122]
+        #if(v == 1) value <- binding_mode1_energy
+        #if(value > as.numeric(binding_mode1_energy)){
+        #        value <- as.numeric(binding_mode1_energy)
+        #        el_b_que_me_quedo <- v
+        #}
+}
+
+#copiador <- paste(el_b_que_me_quedo, "_vinaconfig", sep="")
+#argumentos <- paste("mv", copiador, out_conf_file, sep=" ")
+#print(argumentos)
+#system(argumentos)
+
+#system(paste("zip all-vinas-out.zip", "*_out_vina", sep = " ")) #antes del 31julio
+#system(paste("mv", "all-vinas-out.zip", args[3] , sep = " ")) #antes del 31julio
+
+#system(paste("zip all-vinas-log.zip", "*_log_vina", sep = " ")) #antes del 31julio
+#system(paste("mv", "all-vinas-log.zip", args[4] , sep = " ")) #antes del 31julio
+
+#31julio2018 ----> creo que hay que cambiar los guiones porque hoy se ha quedado pillado en los zip que no lo ha hecho
+#30agosto2018 -----> voy a hacer el cambio 
+
+# USE THIS FOR keeping stdout but removing stderr
+# { cmd 2>&1 >&3 3>&- | logger 3>&-; } 3>&1
+
+system(paste("zip all_vinas_out.zip", "*_out_vina.pdbqt", sep = " ")) #30agosto
+system(paste("mv", "all_vinas_out.zip", args[3] , sep = " ")) #30agosto
+
+system(paste("zip all_vinas_log.zip", "*_log_vina.log", sep = " ")) #30agosto
+system(paste("mv", "all_vinas_log.zip", args[4] , sep = " ")) #30agosto 
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PLIDflow/scripts/clusterfilemaker.R	Tue Jan 14 07:52:48 2020 -0500
@@ -0,0 +1,101 @@
+#clusterfilemaker.R makes a file containg geometric center coordenates for FILL_Xout1.pdb files. X represents envelopes size from 10 to 100    
+
+#!/usr/bin/env Rscript      
+args = commandArgs(trailingOnly=TRUE) 
+
+if(length(args) < 1){
+  stop("USE: Rscript clusterfilemaker.R <session_id>")
+}
+
+#Select the directory where all files are being stored 
+
+session_id <- args[1]
+
+print(session_id)
+
+setwd(session_id) 
+
+#Scan dataset containig FILL_<point>out1.pdb with point from 10 to 500
+fill_outs_1 <- scan("templatefillouts1.txt", what = character(), quiet = TRUE)
+
+#Write the head for the file later created which contains the middle point from FILL_<point>out1.pdb with point from 10 to 500 
+cabecera_fillfile <- paste("npts", sep = ";")
+cabecera <- c("x","y","z")
+
+for(i in 1:3){
+  cabecera_fillfile <- paste(cabecera_fillfile, cabecera[i], sep=";")
+}
+write(cabecera_fillfile, file="fillouts1file.txt", append= TRUE) 
+
+#Loop to read the files FILL_<point>out1.pdb and calculate the middle point
+num_points <- 0
+start_env <- 10 # to fit the first envelope size. In case to change envelope size, only modify this parameter
+jp <- 10 #jump between envelopes size. In case modify jump between envelopes size, only modify this parameter
+#In case modify start envelope size and jump, only modify start_env and jp parameters in the script nothing in following steps
+
+
+
+
+
+num_points <- (start_env - jp)
+for(f in 1:length(fill_outs_1)){
+#	print(paste("Testing file ", fill_outs_1[f]))
+    if(file_test("-f", fill_outs_1[f])){ 
+      archivo <- scan(fill_outs_1[f], what = character(), quiet = TRUE)
+    }else{
+	    next
+    }
+  
+#Make a table with only x, y, z coordenates for C atoms only
+salto <- 0
+for(i in 1:(length(archivo)-2)){
+ if(archivo[i] == "ATOM" && ( archivo[i+2] == "C" || archivo[i+2] == "O" || archivo[i+2] == "H" )){
+    salto <- salto + 1
+  }
+}
+tablaC <- matrix(1, nrow = salto, ncol = 4)
+
+#Names for columns
+##First column correspond to position for atoms C. This column will be created when the C atom positions will be know
+###Write the name for columns and rows
+colnames(tablaC) <- c("C Position","X", "Y", "z")
+rownames(tablaC) <- 1:salto
+  
+#Calculate the number of C atoms and to write theirs coordenates x,y,z in the tablaC
+salto <- 0
+posicionC <-  c()
+for(i in 1:(length(archivo)-2)){
+ if(archivo[i] == "ATOM" && ( archivo[i+2] == "C" || archivo[i+2] == "O" || archivo[i+2] == "H" )){
+    salto <- salto + 1
+    posicionC <- c(posicionC, archivo[i+1])
+    tablaC[salto,2] <- as.numeric(archivo[i+5])
+    tablaC[salto,3] <- as.numeric(archivo[i+6])
+    tablaC[salto,4] <- as.numeric(archivo[i+7])
+  }
+}
+  
+#Write the C atoms positions in column 1 of the table tablaC
+for(i in 1:salto){
+tablaC[i,1] <- as.numeric(posicionC[i]) 
+}
+  
+#Calculate middle point for the FILL_<point>out1.pdb given
+pto_x_medio <- (max(tablaC[,2]) + min(tablaC[,2]))/2
+pto_y_medio <- (max(tablaC[,3]) + min(tablaC[,3]))/2
+pto_z_medio <- (max(tablaC[,4]) + min(tablaC[,4]))/2
+  
+#Write a plain text called fillouts1file.txt which contain in the first column number of point  
+#for the envelope according to AutoLigand program. Columns 2,3,4 for coordenates x, y ,z 
+#for the middle points for FILL_<point>out1.pdb from 10 to 500 points
+num_points <- num_points + jp
+write(paste(num_points,pto_x_medio, pto_y_medio, pto_z_medio, sep=";"),file="fillouts1file.txt", append= TRUE)
+}
+
+
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PLIDflow/scripts/clusterfinder_Auto.R	Tue Jan 14 07:52:48 2020 -0500
@@ -0,0 +1,170 @@
+# #clusterfinder_Auto.R makes a file containig the coordenates of the identified cluster/-s by Silhouette criterion  
+# 
+#!/usr/bin/env Rscript      
+args = commandArgs(trailingOnly=TRUE) 
+
+if(length(args) < 1){
+  stop("USE: Rscript clusterfinder_Auto.R <session_id>")
+}
+
+#Arguments definition 
+
+session_id <- args[1]
+
+print(session_id)
+
+setwd(session_id)
+
+options(error=traceback)
+options(warn=-1)
+
+#Load required library
+library(cluster)
+
+#Load required libraries
+library(clValid)
+
+#Loading required package: cluster
+library(fpc)
+
+#Install NbClust package
+#install.packages("NbClust",dependencies = TRUE)
+
+#Loading required package: NbClust
+library(NbClust)
+
+
+#Read the dataset
+data_centers <- read.table("fillouts1file.txt", header=TRUE, sep=";", na.strings="") 
+#data_centers <- read.table("fillouts1file.txt", header=TRUE, sep=";", na.strings="") 
+
+
+#Run the XXX for selection of the number of clusters
+
+clustersdata <- NbClust(data_centers, diss=NULL, distance = "euclidean", min.nc=2, max.nc=15, method = "kmeans", index = "all", alphaBeale = 0.1)
+
+#capture.output(clustersdata$Best.nc[1,], file = "bestnumberclusters.txt")
+
+#capture.output(NbClust(data_centers, diss=NULL, distance = "euclidean", min.nc=2, max.nc=15, method = "kmeans", index = "all", alphaBeale = 0.1), file = "proofclusters.txt")
+
+#capture.output(NbClust(data_centers, diss=NULL, distance = "euclidean", min.nc=2, max.nc=15, method = "kmeans", index = "all", alphaBeale = 0.1), file = "numclusters.txt")
+
+#best_num_cluster <- scan("proofclusters.txt", what = character(), quiet = TRUE)
+
+k.max <- as.integer(rownames(table(clustersdata$Best.nc[1,]))[which.max(apply(table(clustersdata$Best.nc[1,]),MARGIN=1,max))])
+
+km.res <- kmeans(as.matrix(data_centers), centers = k.max, nstart = 25)
+
+best_position <- as.integer(rownames(table(clustersdata$Best.nc[1,]))[which.max(apply(table(clustersdata$Best.nc[1,]),MARGIN=1,max))]) 
+
+# Make clustercoordenates table
+#X Coordenate
+start_x <- best_position + 1
+end_x <- start_x + (best_position - 1)
+
+cluster_pos_x <- 1
+x_pos <- c()
+for (c in start_x:end_x){
+	  x_pos[cluster_pos_x] <- km.res$centers[c]
+  cluster_pos_x <- cluster_pos_x + 1
+}
+#print(x_pos)
+
+#Y Coordenate
+start_y <- end_x + 1
+end_y <- start_y + (best_position - 1)
+
+cluster_pos_y <- 1
+y_pos <- c()
+for(cc in start_y:end_y){
+	  y_pos[cluster_pos_y] <- km.res$centers[cc]
+  cluster_pos_y <- cluster_pos_y + 1
+}
+#print(y_pos)
+
+#Z Coordenate
+start_z <- end_y + 1
+end_z <- start_z + (best_position - 1)
+
+cluster_pos_z <- 1
+z_pos <- c()
+for(ccc in start_z:end_z){
+	  z_pos[cluster_pos_z] <- km.res$centers[ccc]
+  cluster_pos_z <- cluster_pos_z + 1
+}
+#print(z_pos)
+
+#Create a file with clusters coordenates. Cluster coordenates are vectors x_pos, y_pos, z_pos
+num_filas <- length(x_pos)
+clusters_tabla <- matrix(1, nrow = num_filas, ncol = 4) #columns are column 1 number of ccluster, column 2 x-coordenates, colum 3 y-coordenates, column 4 z-coordenates
+
+##Add number of cluster located in column 1
+for(i in 1:num_filas){
+  clusters_tabla[i,1] <- i
+}
+
+##Add cluster x,y,z-coordenates in clusters_tabla 
+#x-coordenates
+v_pos_x <- 1
+for(f in 1:num_filas){
+  clusters_tabla[f,2] <- x_pos[v_pos_x]
+  v_pos_x <- v_pos_x + 1
+}
+
+#y-coordenates
+v_pos_y <- 1
+for(ff in 1:num_filas){
+  clusters_tabla[ff,3] <- y_pos[v_pos_y]
+  v_pos_y <- v_pos_y + 1
+}
+
+#z-coordenates
+v_pos_z <- 1
+for(fff in 1:num_filas){
+  clusters_tabla[fff,4] <- z_pos[v_pos_z]
+  v_pos_z <- v_pos_z + 1
+}
+
+#Write the head for the file which contains the number of clusters annd their coordenates  
+cabecera_clusterscoordenates <- paste("cluster", sep = " ")
+cabecera <- c("x","y","z")
+
+for(i in 1:3){
+  cabecera_clusterscoordenates <- paste(cabecera_clusterscoordenates, cabecera[i], sep=" ")
+}
+#write(cabecera_clusterscoordenates, file="/home/galaxy/galaxy/tools/proteindocking/scripts/clusterscoordenates.txt", append= TRUE) 
+write(cabecera_clusterscoordenates, file="clusterscoordenates.txt", append= TRUE) 
+
+#Write rows containing number of cluster and coordenates
+for(i in 1:nrow(clusters_tabla)){
+  fila_completa <- paste(clusters_tabla[i,1], sep = " ")
+  for(j in 2:ncol(clusters_tabla)){
+    fila_completa <- paste(fila_completa, clusters_tabla[i,j], sep=" ")
+  }
+  write(fila_completa, file="clusterscoordenates.txt", append= TRUE)
+  #write(fila_completa, file="/home/galaxy/galaxy/tools/proteindocking/scripts/clusterscoordenates.txt", append= TRUE)
+}
+
+
+#Table to see Binding Sited finded in Galaxy screen
+#BS_screen <- scan("/home/galaxy/galaxy/tools/proteindocking/scripts/clusterscoordenates.txt", what = character(), quiet = TRUE)
+BS_screen <- scan("clusterscoordenates.txt", what = character(), quiet = TRUE)
+
+BS_table <- matrix(1, nrow = nrow(clusters_tabla), ncol = ncol(clusters_tabla))
+
+bs_count <- 5
+for(i in 1:nrow(clusters_tabla)){
+  for(j in 1:ncol(clusters_tabla)){
+    BS_table[i,j] <- BS_screen[bs_count]
+    bs_count <- bs_count +1
+  }
+}
+
+colnames(BS_table) <- c("Binding Site", "X", "Y", "Z")
+print(BS_table)
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PLIDflow/scripts/envelopesmaker.R	Tue Jan 14 07:52:48 2020 -0500
@@ -0,0 +1,57 @@
+#envelopesmaker.R makes FILL_Xout.pdb files  where X represents  values for envelopes from 10 to 100 
+
+#!/usr/bin/env Rscript      
+args = commandArgs(trailingOnly=TRUE) 
+
+if(length(args) < 1){
+  stop("USE: Rscript envelopesmaker.R <receptor_pdbqt> <session_dir> <pathAutoligand>")
+}
+
+#Arguments definition 
+receptor_name <- args[1]
+session_dir <- args[2]
+pathLigand <- args[3]
+
+#recopy <- paste("/home/galaxy/galaxy/tools/proteindocking/scripts/", basename(args[1]), ".txt", sep="")  
+#command <- paste("cp ", args[1], " ", recopy, sep="") #18jun2018
+#system(command) #18jun2018
+
+#
+
+recopy_2  <- scan(paste(basename(args[1]), ".txt", sep=""), what = character(), quiet = TRUE)
+
+
+#print(paste("es lo que va a salir",recopy_2[1]))
+
+#Ejecute from R a python script for Running Autoligand 
+sizes_file <- scan("templateenvelopsizes.txt", what = character(), quiet = TRUE)
+
+path_cajonDesastre <- recopy_2[1]
+
+segment_paste <- paste("python", pathLigand, "-r", path_cajonDesastre, "-p", sep = " ")
+#segment_paste <- paste("python /home/eugenia/workflowsoftware/mgltools_x86_64Linux2_1.5.6/MGLToolsPckgs/AutoDockTools/AutoLigand.py -r", path_cajonDesastre, "-p", sep = " ")
+
+#print(segment_paste)
+
+#print(paste("es lo que va a salir",recopy_2[1]))
+
+for(i in 1:length(sizes_file)){
+size <- sizes_file[i]
+
+##porcentaje <- (i/length(sizes_file))*100
+
+##print(paste(paste(porcentaje, "%", sep = ""),"completed", sep = " "))
+
+
+# HEMOS TACHADO ESTE SYSTEM
+print(paste(segment_paste,size, sep = " ")) 
+
+# ENABLE THIS SYSTEM
+#system(paste(segment_paste,size, sep = " "), intern = TRUE) 
+write(paste(segment_paste,size, sep = " "), file = "commands", append = TRUE) 
+}
+
+system("tac commands > rev_commands")
+system("./parallel_launch.sh rev_commands 2")
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PLIDflow/scripts/glgfilemaker.R	Tue Jan 14 07:52:48 2020 -0500
@@ -0,0 +1,35 @@
+#glgfilemarker.R makes GLG file and map files
+
+#!/usr/bin/env Rscript      
+args = commandArgs(trailingOnly=TRUE) 
+
+if(length(args) < 1){
+  stop("USE: Rscript glgfilemaker.R <receptor_name> <session_dir>") 
+}
+
+#Arguments definition 
+receptor_name <- args[1] 
+session_dir <- args[2]
+
+#Running AutiGrid4
+##autogrid4 -p <file>.gpf -l <file>.glg &
+
+
+recopy <- paste( basename(args[1]),".pdbqt" ,sep="") 
+command <- paste("cp ", args[1], " ", recopy, sep="")
+#print(paste("ESTOY IMPRIMIENDO ", command))
+system(command)
+
+#print(recopy)
+
+receptor_name_gpf <- paste( basename(args[1]), ".gpf", sep="")
+receptor_name_glg <- paste( basename(args[1]), ".glg", sep="")
+#print(receptor_name_gpf)
+elemento_concetenar <- paste( "autogrid4 -p", sep = " ")
+elemento_concetenar <- paste(elemento_concetenar, receptor_name_gpf, sep = " ")
+elemento_concetenar <- paste(elemento_concetenar, "-l ", receptor_name_glg, sep = " ")
+
+#print(elemento_concetenar)
+
+
+system(elemento_concetenar)  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PLIDflow/scripts/gpffilemaker.R	Tue Jan 14 07:52:48 2020 -0500
@@ -0,0 +1,116 @@
+#gpffilemaker makes the GPF file
+
+#!/usr/bin/env Rscript      
+args = commandArgs(trailingOnly=TRUE) 
+
+if(length(args) < 1){
+  stop("USE: Rscript gpffilemaker.R <receptor_name> <session_dir>")
+}
+
+#Read file containing PDB geometric center and number of points x, y ,z  
+#archivo_center_npts <- scan("/home/galaxy/galaxy/tools/proteindocking/scripts/pdbcenter_npts.txt", what = character(), quiet = TRUE)
+archivo_center_npts <- scan("pdbcenter_npts.txt", what = character(), quiet = TRUE)
+
+#Read file containing receptor atom types
+ver <- scan("receptor_atm_types.txt", what = character(), quiet = TRUE, na.strings = "NULLAJSKAJSFL")
+
+
+#Arguments definition 
+receptor_name <- args[1]
+session_dir <- args[2]
+aux_receptor_name <- basename(args[1])
+#aux_receptor_name <- paste("/home/galaxy/galaxy/tools/proteindocking/scripts/", basename(args[1]), sep="")
+npts_x <- archivo_center_npts[4]
+npts_y <- archivo_center_npts[5]
+npts_z <- archivo_center_npts[6] 
+gridcenter_x <- archivo_center_npts[1]
+gridcenter_y <- archivo_center_npts[2]
+gridcenter_z <- archivo_center_npts[3]
+
+#Creation of the GPF file
+#Row 1 
+fila_1_e1 <- paste("npts", npts_x, sep = " ")
+fila_1_e2 <- paste(fila_1_e1, npts_y, sep = " ")
+fila_1_e3 <- paste(fila_1_e2, npts_z, sep = " ")
+fila_1 <- paste(fila_1_e3, "# num.grid points in xyz", sep = " ")
+
+#Row 2 
+fila_2_e2 <- paste(aux_receptor_name, ".maps.fld", sep = "")
+fila_2_e1 <- paste("gridfld", fila_2_e2, sep = " " )
+fila_2 <- paste(fila_2_e1, "# grid_data_file", sep = " ")
+
+#Row 3 
+fila_3 <- paste("spacing 1.0", "# spacing(A)", sep = " ")
+
+#Row 4 
+#fila_4 <- paste("receptor_types A C HD N NA OA S SA", "# receptor atom types", sep = " ")
+cabecera_f4 <-  ver[1]
+vector_f4 <- c()
+for(f4 in 2:length(ver)){
+  cabecera_f4 <- paste(cabecera_f4, ver[f4], sep = " ")
+}
+
+fila_4 <- paste("receptor_types", cabecera_f4, "# receptor atom types", sep = " ")
+#print(fila_4)
+
+#Row 5  
+fila_5 <- paste("ligand_types C HD OA", "# ligand atom types", sep = " ")
+
+#Row 6 
+fila_6_e2 <- paste(aux_receptor_name, ".pdbqt", sep = "")
+fila_6_e1 <- paste("receptor", fila_6_e2, sep = " ")
+fila_6 <- paste(fila_6_e1, "# macromolecule", sep = " ")
+
+#Row 7 
+fila_7_e1 <- paste("gridcenter",gridcenter_x, sep = " ")
+fila_7_e2 <- paste(fila_7_e1, gridcenter_y, sep = " ")
+fila_7_e3 <- paste(fila_7_e2, gridcenter_z, sep = " ")
+fila_7 <- paste(fila_7_e3, "# xyz-coordinates or auto", sep = " ")
+
+#Row 8  
+fila_8 <- paste("smooth 0.5", "# store minimum energy w/in rad(A)", sep = " ")
+
+#Row 9 
+fila_9_e2 <- paste(aux_receptor_name, ".C.map", sep = "")
+fila_9_e1 <- paste("map", fila_9_e2, sep = " ")
+fila_9 <- paste(fila_9_e1, "# atom-specific affinity map", sep = " ")
+
+#Row 10 
+fila_10_e2 <- paste(aux_receptor_name, ".HD.map", sep = "")
+fila_10_e1 <- paste("map",fila_10_e2, sep = " ")
+fila_10 <- paste(fila_10_e1, "# atom-specific affinity map", sep = " ")
+
+#Row 11 
+fila_11_e2 <- paste(aux_receptor_name, ".OA.map", sep = "")
+fila_11_e1 <- paste("map", fila_11_e2, sep = " ")
+fila_11 <- paste(fila_11_e1, "# atom-specific affinity map", sep = " ")
+
+#Row 12 
+fila_12_e2 <- paste(aux_receptor_name, ".e.map", sep = "")
+fila_12_e1 <- paste("elecmap", fila_12_e2, sep = " ")
+fila_12 <- paste(fila_12_e1, "# electrostatic potential map", sep = " ")
+
+#Row 13
+fila_13_e2 <- paste(aux_receptor_name, ".d.map", sep = "")
+fila_13_e1 <- paste("dsolvmap", fila_13_e2, sep = " ")
+fila_13 <- paste(fila_13_e1, "# desolvation potential map", sep = " ")
+
+#Row 14
+fila_14 <- paste("dielectric -0.1465", "# <0, AD4 distance-dep.diel;>0, constant", sep = " ")
+
+#Paste all rows with a line jump for separation 
+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)
+
+datos<- c()
+for(i in 1:14){
+datos <- paste(c(datos, filas[i]))
+}
+
+#nombre_final <- paste("/home/galaxy/galaxy/tools/proteindocking/scripts/", basename(args[1]), ".gpf", sep="")
+nombre_final <- paste(basename(args[1]), ".gpf", sep="")
+
+write(datos, file=nombre_final, append = FALSE)
+
+#write(basename(args[1]), file= paste("/home/galaxy/galaxy/tools/proteindocking/scripts/", basename(args[1]), ".txt", sep="")) #parte añadida 18jun2018 
+write(basename(args[1]), file= paste(basename(args[1]), ".txt", sep="")) #parte añadida 18jun2018 
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PLIDflow/scripts/includeAtom3.sh	Tue Jan 14 07:52:48 2020 -0500
@@ -0,0 +1,139 @@
+
+if [ $# != 2 ]; then
+	echo "***ERROR*** Use: $0 <TABLE> <PQR>"
+	exit -1
+fi
+
+
+PQR=$2
+TABLE=$1
+
+grep -v "REMARK" $PQR > $PQR.temp 
+
+#awk '
+#{
+#	if(length($5 > 1)) print $5 
+#} ' $PQR.temp
+
+
+
+
+awk '
+
+
+FNR==NR{
+	equivalence[$1] = $2
+	next
+}
+
+FNR!=NR{
+	if(substr($3,1,1) == "H"){
+
+		if(length($3) > 1){
+
+
+			print $0, "H"
+		}
+	}else{
+
+		print $0, equivalence[$3];
+
+
+
+	}
+
+}
+' $TABLE $PQR.temp | sed 's/ \+/ /g' > $PQR.temp.bad
+
+awk '
+{
+        x=$10;
+        y=$11;
+	z=$12;
+        $10="";
+	$11="";
+	$12="";
+	if(substr($0,1,3) != "TER" && substr($0,1,3) != "END") 
+		printf("%s %.2f %.2f %s\n", $0, x, y, z)
+	else
+		print $0
+}
+' $PQR.temp.bad > $PQR.temp.format
+
+
+awk '
+
+NR==1{ x1=0; x2=0; x3=0; x4=0; x5=0; x6=0; x7=0; x8=0; x9=0; x10=0; x11=0; x12=0; x13=0; }
+
+FNR==NR{
+	if($1 == "ATOM" || $1 == "HETATM"){
+	if(length($1) > x1) x1 = length($1);
+	if(length($2) > x2) x2 = length($2);
+	if(length($3) > x3) x3 = length($3);
+	if(length($4) > x4) x4 = length($4);
+	if(length($5) > x5) x5 = length($5);
+	if(length($6) > x6) x6 = length($6);
+	if(length($7) > x7) x7 = length($7);
+	if(length($8) > x8) x8 = length($8);
+	if(length($9) > x9) x9 = length($9);
+	if(length($10) > x10) x10 = length($10);
+	if(length($11) > x11) x11 = length($11);
+	if(length($12) > x12) x12 = length($12);
+	}
+
+}
+
+
+FNR!=NR{
+
+
+	#total=length($1)+3+x1+2+x3+1+x4+1+x5+6+x7+1+x8+1+x9+1+x10+1+x11+2+x11;
+	total=0;
+
+	printf("%s", $1); total+=length($1);
+	if($1=="ATOM") for(i=0; i<7-length($2); i++) { printf(" "); total+=1; }
+	if($1=="HETATM") for(i=0; i<5-length($2); i++) { printf(" "); total+=1; }
+	printf("%s", $2); total+=length($2);
+	for(i=0; i<2; i++){ printf(" "); total+=1}
+	printf("%s", $3); total+=length($3);
+	for(i=0; i<4-length($3); i++){ printf(" "); total+=1;}
+	printf("%s", $4); total+=length($4);
+	for(i=0; i<1+x4-length($4); i++){ printf(" ");total+=1;}
+	printf("%s", $5); total+=length($5);
+	for(i=0; i<3-length($5); i++){ printf(" ");total+=1;}
+	printf("%s", $6); total+=length($6);
+	for(i=0; i<(13-length($7)-length($6)); i++){ printf(" "); total+=1;}
+	printf("%s", $7); total+=length($7);
+	for(i=0; i<8-length($8); i++){ printf(" ");total+=1;}
+	printf("%s", $8); total+=length($8);
+	for(i=0; i<8-length($9); i++){ printf(" ");total+=1;}
+	printf("%s", $9); total+=length($9);
+	for(i=0; i<6-length($10); i++){ printf(" ");total+=1;}
+	printf("%s", $10); total+=length($10);
+	for(i=0; i<5-length($11); i++){ printf(" ");total+=1;}
+	printf("%s", $11); total+=length($11);
+	for(i=0; i<79-total; i++) printf(" ");
+	printf("%s", $12); total+=length($12);
+	if(length($12) < x12){
+		for(i=0; i<x12-length($12); i++){
+		       	#printf(" ");
+		}
+	}
+	printf("\n");
+
+
+
+
+}
+
+' $PQR.temp.format $PQR.temp.format
+
+
+
+
+rm $PQR.temp
+rm $PQR.temp.bad
+rm $PQR.temp.format
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PLIDflow/scripts/parallel_launch.sh	Tue Jan 14 07:52:48 2020 -0500
@@ -0,0 +1,108 @@
+#!/bin/bash
+
+# PIDs are not re-used until PID_MAX_DEFAULT is reached.
+
+#requirement for the workflow
+#source /home/galaxy-bitlab/galaxy/tools/proteindocking/scripts/ADT_VENV/bin/activate
+
+
+# Reads a text file with commands to execute
+if [ $# -lt 1 ]; then
+	echo " ==== ERROR ... ====."
+	echo ""
+	echo "	usage:  $0 <execution file> [max cores]"
+	echo ""
+	echo "	MANDATORY	<execution file>: a text file containing one command per line"
+	echo "	OPTIONAL	[max cores]	: number of cores to use. Default is available cores minus one"
+	echo ""
+	exit -1
+fi
+
+input=$1
+cores=$(grep -c ^processor /proc/cpuinfo)
+cores=`expr $cores - 1`
+current_jobs=0
+pidArray=()
+jobsArray=()
+totalJobs=0
+executedJobs=0
+finishedJobs=0
+
+if [ $# -eq 2 ]; then
+	cores=$2
+fi
+
+echo "Using $cores cores"
+
+
+#initialize
+for ((i=0 ; i < $cores ; i++))
+do
+	pidArray[$i]=-1	
+done
+
+# read execution guide and launch jobs
+while IFS= read -r var
+do
+
+	jobsArray[$totalJobs]=$var
+	#echo "${jobsArray[$totalJobs]}"
+	totalJobs=`expr $totalJobs + 1`
+
+done < "$input"
+
+
+# control them and only launch as many as specified
+while [[ $executedJobs -lt $totalJobs || $finishedJobs -lt $totalJobs  ]]; do
+
+	# Execute job
+
+	if [[ $current_jobs -lt $cores ]]; then
+
+		${jobsArray[$executedJobs]} &
+		pid=$!
+		for ((i=0 ; i < $cores ; i++))
+		do
+			
+
+		        if [[ ${pidArray[$i]} -eq -1 && $executedJobs -lt $totalJobs ]]; then
+				pidArray[$i]=$pid
+				current_jobs=`expr $current_jobs + 1`
+				echo "PID: $pid JOBS: $current_jobs LAUNCHING: ${jobsArray[$executedJobs]}"
+				executedJobs=`expr $executedJobs + 1`
+				break
+			fi
+		done
+
+
+	fi
+
+	for ((i=0 ; i < $cores ; i++))
+	do
+		pid=${pidArray[$i]}
+		if [[ $pid -ne -1 ]]; then
+
+			ps -p $pid > /dev/null
+			if [[ $? == 1 ]]; then
+				current_jobs=`expr $current_jobs - 1`
+				finishedJobs=`expr $finishedJobs + 1`
+				echo "PID: $pid finished! Completed: $finishedJobs from total: $totalJobs"
+				pidArray[$i]=-1
+			fi
+
+		fi
+	done
+
+	sleep .01
+
+done
+
+
+#deactivate
+
+
+#for job in `jobs -p`
+#do
+	#echo $job
+#	wait $job
+#done
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PLIDflow/scripts/pdbcenter_npts_finder.R	Tue Jan 14 07:52:48 2020 -0500
@@ -0,0 +1,84 @@
+#pdbcenter_npts_finder.R calculates the geometric center of a PDB file
+
+#!/usr/bin/env Rscript      
+args = commandArgs(trailingOnly=TRUE) 
+
+if(length(args) < 1){
+  stop("USE: Rscript pdbcenter_npts_finder.R <receptor_name> <session_dir>")
+}
+
+#Arguments definition 
+receptor_name <- args[1]
+session_dir <- args[2]
+
+#Read PDB file 
+archivo <- scan(args[1], what = character(), quiet = TRUE)
+
+#Make a table where positions of carbon (C) atoms and their x, y, z coordenates will be placed
+salto <- 0
+for(i in 1:(length(archivo)-2)){
+  if(archivo[i] == "ATOM" && archivo[i+2] == "C"){
+    salto <- salto + 1
+  }
+}
+tablaC <- matrix(1, nrow = salto, ncol = 4)
+
+#Header. Note: first column: C atom position (will be filled in when the number of C will be known)
+#Row labels
+colnames(tablaC) <- c("C Position","X", "Y", "z")
+rownames(tablaC) <- 1:salto
+
+#Fill in tablaC with x, y,z coordenates of the C atoms as numeric
+salto <- 0
+posicionC <-  c()
+for(i in 1:(length(archivo)-2)){
+  if(archivo[i] == "ATOM" && archivo[i+2] == "C"){
+    salto <- salto + 1
+    posicionC <- c(posicionC, archivo[i+1])
+    
+    tablaC[salto,2] <- as.numeric(archivo[i+6])
+    tablaC[salto,3] <- as.numeric(archivo[i+7])
+    tablaC[salto,4] <- as.numeric(archivo[i+8])
+ }
+}
+
+#Add C atom positions in the column 1
+for(i in 1:salto){
+  tablaC[i,1] <- as.numeric(posicionC[i]) 
+}
+
+#Geometric center calculation as grid center x, y, z to be introduced in the GPF file 
+pto_x_medio <- (max(tablaC[,2]) + min(tablaC[,2]))/2
+pto_y_medio <- (max(tablaC[,3]) + min(tablaC[,3]))/2
+pto_z_medio <- (max(tablaC[,4]) + min(tablaC[,4]))/2
+
+pto_x_medio_r <- round(pto_x_medio,digits=3)
+pto_y_medio_r <- round(pto_y_medio,digits=3)
+pto_z_medio_r <- round(pto_z_medio,digits=3)
+
+#print(paste(pto_x_medio_r, pto_y_medio_r, pto_z_medio_r, sep = ";"))
+
+#Calculate distances in each coordenate to have de number of points (npts) x, y, z to be introduced in the GPF file 
+eu_x <- max(tablaC[,2])-min(tablaC[,2])
+eu_y <- max(tablaC[,3])-min(tablaC[,3])
+eu_z <- max(tablaC[,4])-min(tablaC[,4])
+
+eu_x_r <- round(eu_x,digits=0)
+eu_y_r <- round(eu_y,digits=0)
+eu_z_r <- round(eu_z,digits=0)
+
+#print(paste(eu_x, eu_y, eu_z, sep = ";"))
+#print(paste(eu_x_r, eu_y_r, eu_z_r, sep = ";"))
+
+if(eu_x > 126 || eu_y > 126 || eu_x > 126){
+  print("At least one dimension in number of points is out of range (>126) according AutoDock software")
+  break
+}
+
+#Write PDB geometric center and eu_x_r, eu_y_r, eu_z_r in a file
+#write(paste(pto_x_medio_r, pto_y_medio_r, pto_z_medio_r, eu_x_r, eu_y_r, eu_z_r,sep= "\n"), file = "/home/galaxy/galaxy/tools/proteindocking/scripts/pdbcenter_npts.txt")
+write(paste(pto_x_medio_r, pto_y_medio_r, pto_z_medio_r, eu_x_r, eu_y_r, eu_z_r,sep= "\n"), file = "pdbcenter_npts.txt")
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PLIDflow/scripts/pdbqtcorrector.R	Tue Jan 14 07:52:48 2020 -0500
@@ -0,0 +1,128 @@
+#pdbqtcorrector.R corrests the out PDBQT file from AutoDockTools prepare receptor 
+
+#!/usr/bin/env Rscript      
+args = commandArgs(trailingOnly=TRUE) 
+
+if(length(args) < 1){
+  stop("USE: Rscript pdbqtcorrector.R <receptor_name> <receptor_pdbqt_modified>")
+}
+
+#Argument definition
+receptor_name <- args[1]
+
+#Scan file
+original_file <- scan(args[1], what = character(), quiet = TRUE, na.strings = "NULLAJSKAJSFL")
+
+#Calculate first root word and "TER"
+for(e in 1:length(original_file)){
+  if(original_file[e] == "ATOM" || original_file[e] == "HETATM" || original_file[e] == "TER"){
+    k <- e
+    break
+  }
+}
+
+#Calculate the row number for table which conteins aligned x,y,z coordenates 
+counter <- 0
+for(c in e:length(original_file)){
+  if(original_file[c] == "ATOM" || original_file[c] == "HETATM" || original_file[c] == "TER"){
+    counter <- counter + 1
+  }
+}
+
+#Table to be fills in named tabla_ordenados
+tabla_ordenados <- matrix(1, nrow = (counter), ncol = 13)
+
+#Calculate TER times and make a vector
+ele_ter_vector <- 1
+ter_vector <- c()
+k_position <- c()
+for(o in 1:(length(original_file))){
+  if(original_file[o] =="TER"){
+    k_position <- c(k_position, o)
+    for(g in o:(o+4)){
+      ter_vector <- c(ter_vector,original_file[g] )
+    }
+    
+  }
+}
+
+#Fill in the tabla_ordenados with values scaned until counter-1 since last row (ter) has diferent length and this could give you back an error
+for(i in 1:(counter-1)){
+  for(j in 1:13){
+    tabla_ordenados[i,j] <- original_file[k]
+    if(tabla_ordenados[i,13]=="ATOM" || tabla_ordenados[i,13]== "HETATM"|| tabla_ordenados[i,13]=="TER"){
+      corte <- c()
+      for(v in 4:12){
+        corte <- c(corte,tabla_ordenados[i,v])
+      }
+      coo_corte <- 1
+      tabla_ordenados[i,4] <- ""
+      for(m in 5:13){
+        tabla_ordenados[i,m] <- corte[coo_corte]
+        coo_corte <- coo_corte + 1
+      }
+      k <- k-1
+    }
+    k <- k + 1 
+  }
+  if(tabla_ordenados[i,1]=="TER"){
+    k <- k - 8
+  } 
+}
+
+
+#Fill in TER row until last one 
+star_ter <- 2
+mmm <- 1
+for(ii in 1:counter){
+  if(tabla_ordenados[ii,1]=="TER"){
+    k <- k_position[mmm] + 4
+    mmm <- mmm + 1
+    y <- 2
+    for(l in star_ter:(star_ter+3)){
+      if(y%%3==0 && y!=6){
+        tabla_ordenados[ii,y] <- ""
+        y <- y + 1
+        tabla_ordenados[ii,y] <- ter_vector[l]
+      }
+      tabla_ordenados[ii,y] <- ter_vector[l]
+      y <- y +1
+    }
+    star_ter <- star_ter + 5
+    for(b in 7:13){
+      tabla_ordenados[ii,b] <- ""
+    }
+  }
+}
+
+#Fill in last row with TER row values 
+last_ter <- length(ter_vector)-4
+for(jj in 1:6){
+  tabla_ordenados[counter,jj] <- ter_vector[last_ter]
+  if(jj%%3==0 && jj !=6){
+    tabla_ordenados[counter, jj] <- ""
+    last_ter <- last_ter - 1
+  }
+  last_ter <- last_ter + 1
+}
+for(jj in 7:13){
+  tabla_ordenados[counter, jj] <- ""
+}
+
+#View(tabla_ordenados)
+
+#Write oredered table in a PDBQT file
+for(xi in 1:nrow(tabla_ordenados)){
+  cabecera <- tabla_ordenados[xi,1]
+  for(xj in 2:13){
+    cabecera <- paste(cabecera, tabla_ordenados[xi,xj], sep = " ")
+  }
+  write(cabecera, file = args[2], append = TRUE)
+}
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PLIDflow/scripts/pdbqtcorrector2step.R	Tue Jan 14 07:52:48 2020 -0500
@@ -0,0 +1,1127 @@
+#pdbqtcorrector2step.R prepare the out PDBQT file from pdbqtcorrector.R to run Vina 
+
+#!/usr/bin/env Rscript      
+args = commandArgs(trailingOnly=TRUE)
+
+if(length(args) < 2){
+  stop("USE: Rscript pdbqtcorrector.R <receptor_name> <galaxy_file_pdbqt> <receptor_types>")
+}
+
+#Argument definition
+receptor_name <- args[1]
+receptor_types_file_out <- args[3]
+
+#Scan file
+original_file <- scan(args[1], what = character(), quiet = TRUE, na.strings = "NULLAJSKAJSFL")
+
+#13FEB2019
+#In order to avoid col 1 and col 2 fussion, split by characters all words. Then paste characters fron col 1 in a word, and those for col 2, rest columns change by " "
+
+buscador <-  c()
+for(of in 1:length(original_file)){
+  buscador <-  c(buscador,strsplit(original_file[of], ""))
+}
+
+fix_row_1 <- 0
+for(off in 1:length(buscador)){
+  if(buscador[[off]][1] == "A"){
+    if(length(buscador[[off]]) >= 3){
+      if(buscador[[off]][2] == "T"){
+        if(buscador[[off]][3] == "O"){
+          if(buscador[[off]][4] == "M"){
+            fix_row_1 <- fix_row_1 + 1
+            buscador[[off]][1] <- paste(buscador[[off]][1], buscador[[off]][2], buscador[[off]][3], buscador[[off]][4], sep = "")
+            if(length(buscador[[off]]) == 4){
+              for(off1 in 2:length(buscador[[off]])){
+                buscador[[off]][off1] <- ""
+              }
+              for(qu in 1:(length(buscador[[off]])-1)){
+                buscador[[off]] <- buscador[[off]][-length(buscador[[off]])]
+                
+                
+              }
+            }
+            if(length(buscador[[off]]) > 4){
+              var_aux <- c()
+              for(off1 in 5:length(buscador[[off]])){
+                var_aux <- c(var_aux, paste(buscador[[off]][off1]))
+              }
+              termino <- var_aux[1]
+              for(ofu in 2:length(var_aux)){
+                termino <- paste(termino, var_aux[ofu], sep = "") 
+              }
+              
+              buscador[[off]][2] <- termino
+              
+              for(off1 in 3:length(buscador[[off]])){
+                buscador[[off]][off1] <- ""
+              }
+              for(qu in 2:(length(buscador[[off]])-1)){
+                buscador[[off]] <- buscador[[off]][-length(buscador[[off]])]
+                
+                
+              }
+            }
+          }
+        }    
+      }
+    }
+  }
+}
+#print(fix_row_1)
+
+
+fix_row_2 <- 0
+for(off in 1:length(buscador)){
+  if(buscador[[off]][1] == "H"){
+    if(length(buscador[[off]]) >= 3){
+      if(buscador[[off]][2] == "E"){
+        if(buscador[[off]][3] == "T"){
+          if(buscador[[off]][4] == "A"){
+            if(buscador[[off]][5] == "T"){
+              if(buscador[[off]][6] == "M"){
+                fix_row_2 <- fix_row_2 + 1
+                buscador[[off]][1] <- paste(buscador[[off]][1], buscador[[off]][2], buscador[[off]][3], buscador[[off]][4], buscador[[off]][5], buscador[[off]][6], sep = "")
+                if(length(buscador[[off]]) == 6){
+                  for(off1 in 2:length(buscador[[off]])){
+                    buscador[[off]][off1] <- ""
+                  }
+                  for(qu in 1:(length(buscador[[off]])-1)){
+                    buscador[[off]] <- buscador[[off]][-length(buscador[[off]])]
+                    
+                    
+                  }
+                }
+                if(length(buscador[[off]]) > 6){
+                  var_aux <- c()
+                  for(off1 in 7:length(buscador[[off]])){
+                    var_aux <- c(var_aux, paste(buscador[[off]][off1]))
+                  }
+                  termino <- var_aux[1]
+                  for(ofu in 2:length(var_aux)){
+                    termino <- paste(termino, var_aux[ofu], sep = "") 
+                  }
+                  
+                  buscador[[off]][2] <- termino
+                  
+                  for(off1 in 3:length(buscador[[off]])){
+                    buscador[[off]][off1] <- ""
+                  }
+                  
+                  for(qu in 2:(length(buscador[[off]])-1)){
+                    buscador[[off]] <- buscador[[off]][-length(buscador[[off]])]
+                  }
+                }
+              }  
+            }
+          }  
+        }    
+      }
+    }
+  }
+}
+#print(fix_row_2)
+
+fix_row_3 <- 0
+for(off in 1:length(buscador)){
+  if(buscador[[off]][1] == "T"){
+    if(length(buscador[[off]]) >= 3){
+      if(buscador[[off]][2] == "E"){
+        if(buscador[[off]][3] == "R"){
+          fix_row_3 <- fix_row_3 + 1
+        }    
+      }
+    }
+  }
+}
+#print(fix_row_3)
+
+final_row <-  fix_row_1 + fix_row_2 + fix_row_3
+
+#counter <- final_row
+#print(counter)
+
+# At this point roots "ATOM", "HETATM" and "TER" are isolated in case fusion. This step component differrent for those are pasted
+for(off in 1:length(buscador)){
+  if(as.character(buscador[[off]][1]) != "ATOM" && buscador[[off]][1] != "HETATM"){
+    #print(off)
+    pegado <- buscador[[off]][1]
+    for(fus in 2:length(buscador[[off]])){
+      if(length(buscador[[off]]) > 1){
+        pegado <- paste(pegado, buscador[[off]][fus], sep = "")
+        buscador[[off]][1] <- pegado
+      }
+    }
+    if(length(buscador[[off]]) > 1){
+      for(qu in 1:(length(buscador[[off]])-1)){
+        buscador[[off]] <- buscador[[off]][-length(buscador[[off]])]
+      }
+    }
+  }
+}
+
+
+# strsplit applied to the original_file return a list format. In this steps it is for changing list for vector format for buscador varible
+
+total_original_file <- c()
+for(si in 1:length(buscador)){
+  total_original_file <- c(total_original_file, buscador[[si]])
+}
+#13feb2019
+
+original_file <- total_original_file
+
+#Starts pdbqtcorrector
+
+#Calculate first root word and "TER"
+for(e in 1:length(original_file)){
+  if(original_file[e] == "ATOM" || original_file[e] == "HETATM" || original_file[e] == "TER"){
+    k <- e
+    break
+  }
+}
+
+#Calculate the row number for table which conteins aligned x,y,z coordenates 
+counter <- 0
+for(c in e:length(original_file)){
+  if(original_file[c] == "ATOM" || original_file[c] == "HETATM" || original_file[c] == "TER"){
+    counter <- counter + 1
+  }
+}
+
+#Table to be fills in named tabla_ordenados
+tabla_ordenados <- matrix(1, nrow = (counter), ncol = 13)
+
+#Calculate TER times and make a vector
+ele_ter_vector <- 1
+ter_vector <- c()
+k_position <- c()
+#ter_pos <- 0 #21sep2018
+for(o in 1:(length(original_file))){
+  if(original_file[o] =="TER"){
+    k_position <- c(k_position, o)
+    ter_pos <- o #21sep
+    for(g in o:(o+4)){
+      ter_vector <- c(ter_vector,original_file[g] )
+    }
+    
+  }
+}
+
+
+#Fill in the tabla_ordenados with values scaned until counter-1 since last row (ter) has diferent length and this could give you back an error
+for(i in 1:(counter-1)){
+  for(j in 1:13){
+    tabla_ordenados[i,j] <- original_file[k]
+    if(tabla_ordenados[i,13]=="ATOM" || tabla_ordenados[i,13]== "HETATM"|| tabla_ordenados[i,13]=="TER"){
+      corte <- c()
+      for(v in 4:12){
+        corte <- c(corte,tabla_ordenados[i,v])
+      }
+      coo_corte <- 1
+      tabla_ordenados[i,4] <- ""
+      for(m in 5:13){
+        tabla_ordenados[i,m] <- corte[coo_corte]
+        coo_corte <- coo_corte + 1
+      }
+      k <- k-1
+    }
+      # #################02julio2019################################
+    
+      if(tabla_ordenados[i,12]=="ATOM" || tabla_ordenados[i,12]== "HETATM"|| tabla_ordenados[i,12]=="TER"){
+
+
+        #print("ENTERING")
+        #stop()
+
+         corte_2 <- c()
+        for(iv in 5:11){
+           corte_2 <- c(corte_2,tabla_ordenados[i,iv])
+        }
+
+         #print(corte_2)
+
+         first_number <- substr(corte_2[5], 1, 4)
+         second_number <- substr(corte_2[5], 5, 1000)
+
+
+
+         coo_corte_2 <- 1
+         tabla_ordenados[i,5] <- ""
+         tabla_ordenados[i,12] <- ""
+         tabla_ordenados[i,13] <- ""
+       for(im in 6:13){
+           tabla_ordenados[i,im] <- corte_2[coo_corte_2]
+           coo_corte_2 <- coo_corte_2 + 1
+         }
+         k <- k-2
+
+         tabla_ordenados[i,12] <- corte_2[6]
+         tabla_ordenados[i,10] <- first_number
+         tabla_ordenados[i,11] <- second_number
+
+
+
+
+       }
+      
+    
+    
+    #################02julio2019################################
+      
+    
+    k <- k + 1 
+  }
+  if(tabla_ordenados[i,1]=="TER"){
+    k <- k - 8
+  } 
+}
+
+#Fill in TER row until last one 
+star_ter <- 2
+mmm <- 1
+for(ii in 1:counter){
+  if(tabla_ordenados[ii,1]=="TER"){
+    k <- k_position[mmm] + 4
+    mmm <- mmm + 1
+    y <- 2
+    for(l in star_ter:(star_ter+3)){
+      if(y%%3==0 && y!=6){
+        tabla_ordenados[ii,y] <- ""
+        y <- y + 1
+        tabla_ordenados[ii,y] <- ter_vector[l]
+      }
+      tabla_ordenados[ii,y] <- ter_vector[l]
+      y <- y +1
+    }
+    star_ter <- star_ter + 5
+    for(b in 7:13){
+      tabla_ordenados[ii,b] <- ""
+    }
+  }
+}
+
+##Fill if last row is not TER root
+if(ter_pos < (length(original_file)-14)){ 
+  tpnt <- 0
+  ntn <- length(original_file) - 12
+  for(jnt in 1:13){
+    tabla_ordenados[nrow(tabla_ordenados),jnt] <- original_file[ntn]
+    
+    ntn <- ntn + 1
+  }
+}
+
+##Fill in last row with TER row values ##
+#ajustcel4 <-0
+if(ter_pos > (length(original_file)-14)){
+  for(rtv in 1:length(ter_vector)){
+    ajustcel4 <- rtv #14nov2018
+    if(is.na(ter_vector[rtv])){
+      ajustcel4 <- rtv - 1
+    }
+  }
+  
+  ter_vector_numeric <- strsplit(ter_vector[ajustcel4], "")
+  
+  last_ter <- length(ter_vector)-4
+  if(length(ter_vector_numeric[[1]]) != 1){
+    if(length(ter_vector) < 5){
+      
+      for(jj in 1:6){
+        tabla_ordenados[counter,jj] <- ter_vector[last_ter]
+        
+        if(jj%%3==0 && jj !=6 || jj == 4){    #he incluido el jj == 4
+          tabla_ordenados[counter, jj] <- ""
+          last_ter <- last_ter - 1
+        }
+        last_ter <- last_ter + 1
+      }
+      for(jj in 7:13){
+        tabla_ordenados[counter, jj] <- ""
+      }
+    }
+    
+    if(length(ter_vector) >= 5){
+      for(jj in 1:7){
+        tabla_ordenados[counter,jj] <- ter_vector[last_ter]
+        if(jj%%3==0 && jj !=6){    #he incluido el jj == 4
+          tabla_ordenados[counter, jj] <- ""
+          last_ter <- last_ter -1 
+        }
+        last_ter <- last_ter + 1
+      }
+      for(jj in 8:13){
+        tabla_ordenados[counter, jj] <- ""
+      }
+    }
+  }
+  
+  if(length(ter_vector_numeric[[1]]) == 1){
+    if(length(ter_vector) <= 5){
+      
+      for(jj in 1:6){
+        tabla_ordenados[counter,jj] <- ter_vector[last_ter]
+        
+        if(jj%%3==0 && jj !=6 ){    #he incluido el jj == 4
+          tabla_ordenados[counter, jj] <- ""
+          last_ter <- last_ter - 1
+        }
+        last_ter <- last_ter + 1
+      }
+      for(jj in 7:13){
+        tabla_ordenados[counter, jj] <- ""
+      }
+    }
+    
+    if(length(ter_vector) > 5){
+      for(jj in 1:7){
+        tabla_ordenados[counter,jj] <- ter_vector[last_ter]
+        if(jj%%3==0 && jj !=6){    #he incluido el jj == 4
+          tabla_ordenados[counter, jj] <- ""
+          last_ter <- last_ter -1 
+        }
+        last_ter <- last_ter + 1
+      }
+      for(jj in 8:13){
+        tabla_ordenados[counter, jj] <- ""
+      }
+    }
+  }
+  
+}
+
+
+#View(tabla_ordenados)
+
+#19octubre2018
+
+#listacol11 <- matrix(0, nrow = nrow(tabla_ordenados), ncol = 1)
+twopoint <- c()
+for(dc11 in  1:nrow(tabla_ordenados)){
+  listacol11 <-strsplit(tabla_ordenados[dc11,11], "")
+  
+  if(length(listacol11[[1]]) != 0){
+    num_poin <- 0
+    for(findpoint in 1:length(listacol11[[1]])){
+      if(listacol11[[1]][findpoint] == "."){
+        num_poin <- num_poin + 1
+      }
+    }
+    if(num_poin == 2){
+      twopoint <- c(twopoint, dc11)
+      unopto0 <- listacol11[[1]][1] 
+      dospto0 <- listacol11[[1]][5] 
+      for(div1pto in 2:4){
+        unopto0 <- paste(unopto0, listacol11[[1]][div1pto], sep = "")
+      }
+      for(div2pto in 6:length(listacol11[[1]])){
+        dospto0 <- paste(dospto0, listacol11[[1]][div2pto], sep = "")
+      }
+      #19oct2018 Voy a guardar cada fila en un vector para luego pegarlo
+      vec_guarfilas <- c()
+      for(vgf in 1:10){
+        
+        if(tabla_ordenados[dc11,vgf] != ""){
+          vec_guarfilas <- c(vec_guarfilas, tabla_ordenados[dc11,vgf])
+        }
+      }
+      vec_guarfilas[10] <- unopto0
+      vec_guarfilas[11] <- dospto0
+      vec_guarfilas[12] <- tabla_ordenados[dc11,12]
+      vec_guarfilas[13] <- tabla_ordenados[dc11,13]
+      
+      #print(vec_guarfilas)
+      for(mvc in 1:13){
+        tabla_ordenados[dc11,mvc] <- vec_guarfilas[mvc]
+      }
+      
+    }
+  }
+}
+
+#View(tabla_ordenados)
+#acaba 19octubre2018
+
+
+
+#Make a table containing for each cell the number of characters for each for the tabla_ordenados
+tabla_ordenados_numcarac <- matrix(1, nrow = nrow(tabla_ordenados), ncol = ncol(tabla_ordenados))
+
+for(i in 1:nrow(tabla_ordenados)){
+  for(j in 1:ncol(tabla_ordenados)){
+    caracteres <- strsplit(tabla_ordenados[i,j], "")
+    num_carac <- 0
+    # if(tabla_ordenados[i,j] == ""){
+    #   num_carac <- ""
+    # }
+    #if(tabla_ordenados[i,j] != ""){ 
+    for(k in 1:length(caracteres[[1]])){
+      num_carac <- num_carac + 1
+    }
+    tabla_ordenados_numcarac[i,j] <- num_carac
+    #} 
+  }
+}
+#View(tabla_ordenados_numcarac) #27mar2019
+
+#################03julio2019###################3     ##
+
+for(i in 1:nrow(tabla_ordenados)){
+  
+    if(tabla_ordenados_numcarac[i,4] == 2 && tabla_ordenados_numcarac[i,5] == 3){
+      cambio_posicion5 <- tabla_ordenados[i,5]
+      tabla_ordenados[i,5] <- ""
+      tabla_ordenados_numcarac[i,5] <- 2
+      tabla_ordenados[i,4] <- cambio_posicion5
+      tabla_ordenados_numcarac[i,4] <- 3 
+    }
+  }
+
+for(i in 1:nrow(tabla_ordenados)){
+  if(tabla_ordenados_numcarac[i,5] == 2 && tabla_ordenados_numcarac[i,6] == 5){
+    Aaposicion5 <- substr(tabla_ordenados[i,6], 1, 1)
+    cambio_posicion5 <- substr(tabla_ordenados[i,6], 2, 5)
+    tabla_ordenados[i,5] <- Aaposicion5
+    tabla_ordenados_numcarac[i,5] <- 1
+    tabla_ordenados[i,6] <- cambio_posicion5
+    tabla_ordenados_numcarac[i,6] <- 4
+  }
+}
+
+for(i in 1:nrow(tabla_ordenados)){
+  if(tabla_ordenados[i, 3] < 6 && tabla_ordenados[i, 4] == ""){
+  tabla_ordenados[i, 4] <- "XX"
+  }
+}
+
+#################03julio2019###################3     ##
+
+# &&&&& 03sep2019 &&&&&&&&&&&&
+if(tabla_ordenados_numcarac[counter,5] >= 5){
+  ter_5_col <- substr(tabla_ordenados[counter, 5], 1, 1)
+  ter_6_col <- substr(tabla_ordenados[counter, 5], 2, 1000)
+  
+  
+  tabla_ordenados[counter, 5] <- ter_5_col
+  tabla_ordenados[counter, 6] <- ter_6_col
+}
+
+# &&&&& 03sep2019 &&&&&&&&&&&&
+
+
+####····̣# &&&&& 30oct2019 &&&&&&&&&&&&
+for(ac3 in 1:counter){
+  if(tabla_ordenados_numcarac[ac3,3] >= 7){
+  ter_3_col <- substr(tabla_ordenados[ac3, 3], 1, 4)
+  ter_4_col <- substr(tabla_ordenados[ac3, 3], 5, 1000)
+  
+  
+  tabla_ordenados[ac3, 3] <- ter_3_col
+  tabla_ordenados[ac3, 4] <- ter_4_col
+  tabla_ordenados_numcarac[ac3, 3] <- 4
+  tabla_ordenados_numcarac[ac3, 4] <- 3
+}
+
+}
+
+####····̣# &&&&& 30oct2019 &&&&&&&&&&&&
+
+
+
+
+
+#:;:;:;:;:;:;:;:;________09septiembre2019. Remove line with "Na" in column 13 in tabla_ordenados and tabla_ordenados_numcarac 
+
+# quitar_fila <- 0
+# for(ena in 1:counter){
+#   if(tabla_ordenados[ena,13] == "Na"){
+#     print(ena)
+#     tabla_ordenados_numcarac <- tabla_ordenados_numcarac[-ena,]
+#     ena <- ena - 1
+#     quitar_fila <- quitar_fila + 1
+#     counter <- counter - quitar_fila
+#     
+#   }
+# }
+# 
+# tabla_ordenados <- subset(tabla_ordenados, tabla_ordenados[,13] != "Na")
+
+#:;:;:;:;:;:;:;:;________09septiembre2019
+
+#View(tabla_ordenados)
+#View(tabla_ordenados_numcarac) 
+
+
+
+
+#Fit spaces for write()
+#Fit spaces for write() 
+#Pairwise 1col-2col con 1col == "ATOM"
+
+for(i in 1:nrow(tabla_ordenados)){
+  linea <- c()
+  if(tabla_ordenados_numcarac[i,1] == 4){
+    num_espacios <- 6
+    ajuste <- 0
+    for(a in 1:(tabla_ordenados_numcarac[i,2])){
+      if(a != tabla_ordenados_numcarac[i,2]){
+        ajuste <- ajuste + 1
+      }
+      if(a == tabla_ordenados_numcarac[i,2]){
+        espacios <- rep(" ", num_espacios-ajuste)
+        linea <- c(espacios, tabla_ordenados[i,2])
+        break
+      }
+    }
+  }
+  
+  #1col == HETATM INI
+  if(tabla_ordenados_numcarac[i,1] == 6){
+    num_espacios <- 4
+    ajuste <- 0
+    for(a in 1:(tabla_ordenados_numcarac[i,2])){
+      if(a != tabla_ordenados_numcarac[i,2]){
+        ajuste <- ajuste + 1
+      }
+      if(a == tabla_ordenados_numcarac[i,2]){
+        espacios <- rep(" ", num_espacios-ajuste)
+        linea <- c(espacios, tabla_ordenados[i,2])
+        
+        ###21feb2019
+        if(tabla_ordenados_numcarac[i,2] == 5){
+          espacios <- rep(" ", (num_espacios-ajuste) + 1)
+          linea <- c(espacios, tabla_ordenados[i,2])
+        }
+        ###21feb2019
+        
+        break
+      }
+    }
+  }
+  #1col == HETATM FIN
+  
+  ##1col == TER INICIO
+  if(tabla_ordenados_numcarac[i,1] == 3){
+    num_espacios <- 7
+    ajuste <- 0
+    for(a in 1:(tabla_ordenados_numcarac[i,2])){
+      if(a != tabla_ordenados_numcarac[i,2]){
+        ajuste <- ajuste + 1
+        espacios <- rep(" ", num_espacios-ajuste)
+      }
+      if(a == tabla_ordenados_numcarac[i,2]){
+        espacios <- rep(" ", num_espacios-ajuste)
+        linea <- c(espacios, tabla_ordenados[i,2])
+        break
+      }
+    }
+  }
+  ##1col == TER FIN
+  
+  ##Pairwise 2col-3col 
+  linea2 <- c()
+  for(b in 1:(tabla_ordenados_numcarac[i,3])){
+    if(b < 4){
+      espacios2 <- rep(" ", 2)
+    }
+    if(b >= 4){
+      if(tabla_ordenados[i,4] == ""){
+        espacios2 <- rep(" ", 2)
+      }
+      
+      if(tabla_ordenados[i,4]!= ""){
+        espacios2 <- rep(" ", 1) 
+      }
+    }
+  }
+  
+  if(tabla_ordenados_numcarac[i,3] >= 8){
+    e_espacios2 <- length(espacios2)-1
+    espacios2 <- rep(" ",e_espacios2)
+    
+    
+  }
+  
+  linea2 <- c(linea, espacios2, tabla_ordenados[i,3])
+  
+  ###21feb2019
+  if(tabla_ordenados_numcarac[i,1] == 6 && tabla_ordenados_numcarac[i,2] == 5){
+    espacios2 <- espacios2[-length(espacios2)]
+    linea2 <- c(linea, espacios2, tabla_ordenados[i,3])
+  }
+  ###21feb2019
+  
+  ###Pairwise 3col-4col 
+  linea3 <- c()
+  
+  for(c in 1:(tabla_ordenados_numcarac[i,4])){
+    
+    #28nov
+    if(c == 2){
+      if(tabla_ordenados_numcarac[i,1] == 6 && tabla_ordenados_numcarac[i,3] == 1){
+        espacios3 <- rep(" ", 2)
+      }
+      if(tabla_ordenados_numcarac[i,1] == 6 && tabla_ordenados_numcarac[i,3] == 2){
+        espacios3 <- rep(" ", 1)
+      }
+      if(tabla_ordenados_numcarac[i,1] == 6 && tabla_ordenados_numcarac[i,3] == 2 && tabla_ordenados_numcarac[i,5] == 1){
+        espacios3 <- rep(" ", 3)
+      }
+      
+      #########21junio2019
+      
+      if(tabla_ordenados_numcarac[i,1] == 4 &&  tabla_ordenados_numcarac[i,3] == 1 && tabla_ordenados_numcarac[i,6] == 5){
+        espacios3 <- rep(" ", 2) 
+      }
+      if(tabla_ordenados_numcarac[i,1] == 4 &&  tabla_ordenados_numcarac[i,3] == 2 && tabla_ordenados_numcarac[i,6] == 5){
+        espacios3 <- rep(" ", 1) 
+      }
+      
+      ########21junio2019
+      
+      
+      
+      
+    }
+    #28nov. Hace falta corregir para el resto de HETATM
+    
+    
+    if(c == 3){
+      if(b == 1){
+        espacios3 <- rep(" ", 3)
+      }
+      if(b == 2){
+        espacios3 <- rep(" ", 2)
+      }
+      if(b >= 3){
+        espacios3 <- rep(" ", 1)
+      }
+    }
+    if(c == 4){
+      if(b == 1){
+        espacios3 <- rep(" ", 2)
+      }
+      if(b >= 2){
+        espacios3 <- rep(" ", 1)
+      }
+    }
+    #27mar2019 ######################################
+    if(c == 5){
+      if(b >= 2){
+        espacios3 <- rep("", 1)
+      }
+    }
+    #27mar2019 ######################################
+  }
+    
+  linea3 <- c(linea2, espacios3, tabla_ordenados[i,4])
+                                                      ####03julio2019####################### #####################
+# if(tabla_ordenados_numcarac[i,3] == 3 && tabla_ordenados_numcarac[i,4] == 3 && tabla_ordenados_numcarac[i,5] == 2 && tabla_ordenados_numcarac[i,6] == 5){
+#   linea3 <- c(linea2, " ", tabla_ordenados[i,4])
+# }
+  ####03julio2019####################### #####################
+  
+  #TER
+  if(tabla_ordenados_numcarac[i,1] == 3){
+    num_espacios4 <- 8  
+    ajuste_t1 <- 0
+    for(l in 1:tabla_ordenados_numcarac[i,4]){
+      if(l != tabla_ordenados_numcarac[i,4]){
+        ajuste_t1 <-ajuste_t1 + 1
+        num_espacios4 <- 8 - ajuste_t1
+      }
+      if(l == tabla_ordenados_numcarac[i,4]){
+        num_espacios4 <- 8 - ajuste_t1
+      }
+    }
+    linea3 <- c(linea, rep(" ", num_espacios4), tabla_ordenados[i,4])
+    
+  }
+  
+  ####Pairwise 4col-5col 
+  linea4 <- c()
+  if(tabla_ordenados_numcarac[i,1] != 3){
+    if(tabla_ordenados_numcarac[i,3] >= 7){
+      linea4 <- c(linea3, tabla_ordenados[i,5])
+    }
+    if(tabla_ordenados_numcarac[i,3] < 7){
+      linea4 <- c(linea3, " ", tabla_ordenados[i,5])
+      ###18oct2018
+      if(tabla_ordenados_numcarac[i,3] >= 3 && tabla_ordenados[i,4] == ""){
+        linea4 <- c(linea2, " ", tabla_ordenados[i,5])
+      }
+      ###18oct2018
+    }
+    #------------29julio2019--------------------#
+    
+    if(isTRUE(tabla_ordenados[i,3] == "NA") && tabla_ordenados[i,4] == ""){
+      linea4 <- c(linea2, rep(" ", 6), tabla_ordenados[i,5])
+    }
+    
+    
+    #------------29julio2019--------------------#
+  }
+  
+  
+  
+  
+  if(tabla_ordenados_numcarac[i,1] == 3){
+    
+    linea4 <- c(linea3, " ", tabla_ordenados[i,5])
+    ##
+    if(tabla_ordenados[i,4] == ""){
+      linea4 <- c(linea2,rep(" ", 4),tabla_ordenados[i,5])
+    }
+    
+    ##
+    
+    
+  }
+  
+  #####Pairwise 5col-6col. NO espacios4
+  if(tabla_ordenados_numcarac[i,1] != 3){
+    linea5 <-c()
+    for(d in 1:(tabla_ordenados_numcarac[i,6])){
+      if(d == 1){
+        espacios5 <- rep(" ", 3)  
+      }
+      if(d == 2){
+        espacios5 <- rep(" ", 2)  
+      }
+      if(d >= 3){
+        espacios5 <- rep(" ", 1)  
+      }
+      
+      ##################21junio2109#############
+      
+      if(tabla_ordenados_numcarac[i,3] == 2 && tabla_ordenados_numcarac[i,5] == 2 && tabla_ordenados_numcarac[i,6] == 5){
+        espacios5 <- rep(" ", 2)
+      }
+      
+      ##################21junio2109#############
+                                                    ###########03julio################                 ############
+      # if(tabla_ordenados_numcarac[i,3] == 1 && tabla_ordenados_numcarac[i,4] == 3 && tabla_ordenados_numcarac[i,5] == 2 && tabla_ordenados_numcarac[i,6] == 5){
+      #   
+      #   espacios5 <- ""
+      # }
+      
+      ###########03julio################                 ############
+      
+      
+    }
+    linea5 <- c(linea4, espacios5, tabla_ordenados[i,6])
+    
+    
+  }
+  if(tabla_ordenados_numcarac[i,1] == 3){
+    for(dd in 1:(tabla_ordenados_numcarac[i,6])){
+      if(dd == 1){
+        espacios55 <- rep(" ", 3) 
+      }
+      
+      #14nov
+      if(dd == 1 && tabla_ordenados_numcarac[i,5] == 3){
+        espacios55 <- rep(" ", 1)
+      }
+      #14nov
+      
+      if(dd == 2){
+        espacios55 <- rep(" ", 2)
+      }
+      if(dd >= 3){
+        espacios55 <- rep(" ", 1)
+      }
+      
+      
+    }
+    linea5 <- c(linea4, espacios55, tabla_ordenados[i,6])
+    
+    #------------------05sep2019------------#
+    
+    if(tabla_ordenados_numcarac[i,6] == 1 && tabla_ordenados_numcarac[i,5] >= 5){
+      espacios55 <- rep(" ", 1)
+      linea5 <- c(linea4, espacios55, tabla_ordenados[i,6])
+    }
+    
+    #------------------05sep2019------------#
+    
+  }
+  
+  
+  
+  
+  ######Pairwise 6col-7col  
+  linea6 <- c()
+  if(tabla_ordenados_numcarac[i,7] == 5){
+    espacios6 <- rep(" ", 7)
+    linea6 <-c(linea5, espacios6, tabla_ordenados[i,7]) 
+    
+    ###################21junio2109#################
+    if(tabla_ordenados_numcarac[i,3] == 4 && tabla_ordenados_numcarac[i,6] == 5){
+      espacios6 <- rep(" ", 6)
+      linea6 <-c(linea5, espacios6, tabla_ordenados[i,7])
+    }
+    
+    ###################21junio2109#################
+    
+    ##    03julio2019   #########
+    
+    if(tabla_ordenados_numcarac[i,6] == 4 && tabla_ordenados_numcarac[i,6] == 4){
+      espacios6 <- rep(" ", 6)
+      linea6 <-c(linea5, espacios6, tabla_ordenados[i,7]) 
+    }
+    
+    ##    03julio2019   #########
+    
+    
+  }
+  
+  if(tabla_ordenados_numcarac[i,7] > 5){
+    out_spaces <- tabla_ordenados_numcarac[i,7] - 5
+    espacios6 <- rep(" ", (7-out_spaces))
+    linea6 <-c(linea5, espacios6, tabla_ordenados[i,7]) 
+    
+    ###################21junio2109#################
+    if(tabla_ordenados_numcarac[i,3] == 4 && tabla_ordenados_numcarac[i,6] == 5){
+      out_spaces <- tabla_ordenados_numcarac[i,7] - 4
+      espacios6 <- rep(" ", (7-out_spaces))
+      linea6 <-c(linea5, espacios6, tabla_ordenados[i,7]) 
+    }
+    
+    ###################21junio2109#################
+    ##    03julio2019   #########
+    
+    if(tabla_ordenados_numcarac[i,6] == 4 && tabla_ordenados_numcarac[i,6] == 4){
+      out_spaces_2 <- tabla_ordenados_numcarac[i,7] - 4
+      espacios6 <- rep(" ", (7-out_spaces_2))
+      linea6 <-c(linea5, espacios6, tabla_ordenados[i,7]) 
+    }
+    
+    ##    03julio2019   #########
+    
+    
+  }
+  
+  ######################################27mar2019
+  # 
+  # if(tabla_ordenados_numcarac[i,4] == 5){
+  #   espacios6 <- rep(" ",5)
+  #   linea6 <-c(linea5, espacios6, tabla_ordenados[i,7]) 
+  # }
+  # 
+  # if(tabla_ordenados_numcarac[i,4] > 5){
+  #   espacios6 <- rep(" ",4)
+  #   linea6 <-c(linea5, espacios6, tabla_ordenados[i,7]) 
+  # }
+ 
+  ######################################27mar2019
+  
+  
+  #######Pairwise 7col-8col 
+  linea7 <- c()
+  ajuste3 <- 0
+  if(tabla_ordenados_numcarac[i,8] == 5){
+    espacios7 <- rep(" ", 3)
+    linea7 <-c(linea6, espacios7, tabla_ordenados[i,8]) 
+  }
+  if(tabla_ordenados_numcarac[i,8] == 6){
+    espacios7 <- rep(" ", 2)
+    linea7 <-c(linea6, espacios7, tabla_ordenados[i,8]) 
+  }
+  if(tabla_ordenados_numcarac[i,8] > 6){
+    espacios7 <- rep(" ", 1)
+    linea7 <-c(linea6, espacios7, tabla_ordenados[i,8]) 
+  }
+  
+  ########Pairwise 8col-9col
+  linea8 <- c()
+  ajuste4 <- 0
+  if(tabla_ordenados_numcarac[i,9] == 5){
+    espacios8 <- rep(" ", 3)
+    linea8 <-c(linea7, espacios8, tabla_ordenados[i,9]) 
+  }
+  if(tabla_ordenados_numcarac[i,9] == 6){
+    espacios8 <- rep(" ", 2)
+    linea8 <-c(linea7, espacios8, tabla_ordenados[i,9]) 
+  }
+  if(tabla_ordenados_numcarac[i,9] > 6){
+    espacios8 <- rep(" ", 1)
+    linea8 <-c(linea7, espacios8, tabla_ordenados[i,9]) 
+  }
+  
+  #########Pairwise 9col-10col
+  linea9 <- c()
+  if(tabla_ordenados_numcarac[i,10] == 4){
+    espacios9 <- rep(" ", 2)
+    linea9 <- c(linea8, espacios9, tabla_ordenados[i,10])
+  }
+  if(tabla_ordenados_numcarac[i,10] > 4){
+    espacios9 <- rep(" ", 1)
+    linea9 <- c(linea8, espacios9, tabla_ordenados[i,10])
+  }
+  
+  ##########Pairwise 10col-11col
+  # linea10 <- c()
+  # if(tabla_ordenados_numcarac[i,11] == 4){
+  #   espacios10 <- rep(" ", 2)
+  #   linea10 <- c(linea9, espacios10, tabla_ordenados[i,11])
+  # }
+  # if(tabla_ordenados_numcarac[i,11] > 4){
+  #   espacios10 <- rep(" ", 1)
+  #   linea10 <- c(linea9, espacios10, tabla_ordenados[i,11])
+  # }
+  #22oct2018
+  ##########Pairwise 10col-11col
+  linea10 <- c()
+  if(tabla_ordenados_numcarac[i,11] == 4){
+    espacios10 <- rep(" ", 3)
+    linea10 <- c(linea9, espacios10, tabla_ordenados[i,11])
+  }
+  if(tabla_ordenados_numcarac[i,11] == 5){
+    espacios10 <- rep(" ", 2)
+    linea10 <- c(linea9, espacios10, tabla_ordenados[i,11])
+  }
+  
+  if(tabla_ordenados_numcarac[i,11] > 5){
+    espacios10 <- rep(" ", 1)
+    linea10 <- c(linea9, espacios10, tabla_ordenados[i,11])
+  }
+  #22oct2018
+  
+  
+  ###########Pairwise 11col-12col
+  linea11 <- c()
+  if(tabla_ordenados_numcarac[i,12] == 5){
+    espacios11 <- rep(" ", 5)
+    linea11 <-c(linea10, espacios11, tabla_ordenados[i,12])
+  } 
+  ajuste5 <- 0
+  for(h in 6:tabla_ordenados_numcarac[i,12]){
+    if(tabla_ordenados_numcarac[i,12] > 5){
+      ajuste5 <- ajuste5 + 1
+      espacios11 <- rep(" ", (5-ajuste5))
+      ##espacios11 <- rep(" ", (5-ajuste5))
+      linea11 <-c(linea10, espacios11, tabla_ordenados[i,12])
+    }  
+  }
+  
+  ############Pairwise 12col-13col
+  linea12 <- c(linea11," ", tabla_ordenados[i,13])
+  
+  #TER
+  if(tabla_ordenados_numcarac[i,1] == 3){
+    cabecera <- tabla_ordenados[i,1]
+    for(w in 1:length(linea5)){
+      cabecera <- paste(cabecera,linea5[w], sep = "")
+    }
+    #write(cabecera, file = "1z95_wo_198andwater_ph7_MOD.pdbqt", append = TRUE)
+    write(cabecera, file = args[2], append = TRUE)
+  }
+  
+  #!= TER
+  if(tabla_ordenados_numcarac[i,1] != 3){
+    cabecera <- tabla_ordenados[i,1]
+    for(w in 1:length(linea12)){
+      cabecera <- paste(cabecera,linea12[w], sep = "")
+    }
+    #write(cabecera, file = "1z95_wo_198andwater_ph7_MOD.pdbqt", append = TRUE)
+    write(cabecera, file = args[2], append = TRUE)
+  }
+}
+
+#21junio2019
+# #### Make file receptor_atm_types.txt to be paste in the GPF file ###
+
+prereceptor_atmtypes <- c()
+for(i in 1:nrow(tabla_ordenados)){
+  if(tabla_ordenados[i,13] != ""){
+    prereceptor_atmtypes <- c(prereceptor_atmtypes, tabla_ordenados[i,13])
+  }
+}
+# 
+ receptor_atmtypes <- unique(prereceptor_atmtypes)
+#
+
+filtered_receptor <- c()
+for(i in 1:length(receptor_atmtypes)){
+
+	#print(receptor_atmtypes[i])
+	#print(is.na(as.numeric(receptor_atmtypes[i])))
+
+	if(suppressWarnings(is.na(as.numeric(receptor_atmtypes[i])))){
+		filtered_receptor <- c(filtered_receptor, receptor_atmtypes[i])
+	}
+
+}
+
+receptor_atmtypes <- filtered_receptor
+
+cabeceratm <- receptor_atmtypes[1]
+for(rat in 2:length(receptor_atmtypes)){
+
+  cabeceratm <- paste(cabeceratm, receptor_atmtypes[rat], sep = " ")
+}
+
+write(cabeceratm, file = receptor_types_file_out, append = FALSE)
+
+
+#21junio2019
+
+
+
+
+# #::::::::06sep2019:::::::::::::::::#
+# 
+# #Make the file receptor_types_file_out.txt removing duplicates and Na 
+# #21junio2019
+# 
+# # 
+# prereceptor_atmtypes <- c()
+# for(i in 1:nrow(tabla_ordenados)){
+#   if(tabla_ordenados[i,13] != ""){
+#     prereceptor_atmtypes <- c(prereceptor_atmtypes, tabla_ordenados[i,13])
+#   }
+# }
+# # 
+# # #print(prereceptor_atmtypes)
+# # 
+# receptor_atmtypes <- unique(prereceptor_atmtypes)
+# #21junio2019
+# 
+# quitar <- 0
+# for(i in 1:length(receptor_atmtypes)){
+#   if(isTRUE(receptor_atmtypes[i] == "Na")){
+#     quitar <- i
+#     break
+#   }
+# }
+# 
+# if(quitar == 0){
+#   cabeceratm <- receptor_atmtypes[1]
+#   for(rat in 2:length(receptor_atmtypes)){
+#     cabeceratm <- paste(cabeceratm, receptor_atmtypes[rat], sep = " ")
+#   }
+#   
+#   write(cabeceratm, file = "receptor_types_file_out.txt", append = FALSE)
+# }
+# 
+# if(quitar != 0){
+#   receptor_atmtypes <- receptor_atmtypes[-quitar]    
+#   cabeceratm_types <- receptor_atmtypes[1]
+#   for(at_t in 2:length(receptor_atmtypes)){
+#    cabeceratm_types <- paste(cabeceratm_types, receptor_atmtypes[at_t], sep = " ")
+#   }
+#   write(cabeceratm_types, file = "receptor_types_file_out.txt", append = FALSE)
+# }
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PLIDflow/scripts/receptor_atm_types.txt	Tue Jan 14 07:52:48 2020 -0500
@@ -0,0 +1,2 @@
+N HD C OA A SA NA
+N HD C OA A SA NA
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PLIDflow/scripts/requirements.txt	Tue Jan 14 07:52:48 2020 -0500
@@ -0,0 +1,77 @@
+amqp==1.4.8
+anyjson==0.3.3
+asn1crypto==0.24.0
+Babel==2.5.1
+bcrypt==3.1.4
+Beaker==1.7.0
+bioblend==0.7.0
+boltons==17.1.0
+boto==2.38.0
+boto3==1.6.21
+botocore==1.9.21
+bx-python==0.7.3
+bz2file==0.98
+certifi==2017.7.27.1
+cffi==1.11.5
+chardet==3.0.4
+Cheetah==2.4.4
+cryptography==2.2.2
+decorator==4.0.2
+dictobj==0.3.1
+docopt==0.6.2
+docutils==0.14
+ecdsa==0.13
+enum34==1.1.6
+Fabric==1.13.2
+futures==3.2.0
+galaxy-sequence-utils==1.0.2
+h5py==2.7.1
+idna==2.6
+ipaddress==1.0.18
+jmespath==0.9.3
+kombu==3.0.30
+Mako==1.0.2
+Markdown==2.6.3
+MarkupSafe==1.0
+mercurial==3.7.3
+nose==1.3.7
+numpy==1.8.0
+packaging==16.8
+paramiko==2.2.1
+Parsley==1.3
+Paste==2.0.2
+PasteDeploy==1.5.2
+PasteScript==2.0.2
+pbr==3.1.1
+pkg-resources==0.0.0
+psutil==4.1.0
+pulsar-galaxy-lib==0.8.0
+pyasn1==0.4.2
+pycparser==2.18
+pycrypto==2.6.1
+pykwalify==1.6.0
+PyNaCl==1.2.1
+pyparsing==2.1.1
+pysam==0.14
+python-dateutil==2.5.3
+python-genomespaceclient==0.1.8
+python-swiftclient==3.5.0
+pytz==2017.3
+PyYAML==3.12
+repoze.lru==0.6
+requests==2.18.4
+requests-toolbelt==0.8.0
+Routes==2.4.1
+s3transfer==0.1.13
+six==1.11.0
+SQLAlchemy==1.0.15
+sqlalchemy-migrate==0.11.0
+SQLAlchemy-Utils==0.32.19
+sqlparse==0.1.16
+svgwrite==1.1.6
+Tempita==0.5.3.dev0
+urllib3==1.22
+uWSGI==2.0.15
+WebHelpers==1.3
+WebOb==1.4.1
+Whoosh==2.7.4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PLIDflow/scripts/separateChain.sh	Tue Jan 14 07:52:48 2020 -0500
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+# Arguments
+# $1 = pdb
+
+grep "ATOM\|HETATM" $1 | awk '{ if(length($5)==1) updateName=$5;   if($1 == "ATOM" || $1 == "HETATM"){ print $0 > "chain"updateName".pdb";  }}' ; 
+for i in chain* ; do echo "TER" >> $i ; echo "END" >> $i ; done
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PLIDflow/scripts/table	Tue Jan 14 07:52:48 2020 -0500
@@ -0,0 +1,74 @@
+H*	H
+HN	H
+HG1	H
+HE	H
+HE1	H
+HZ1	H
+HZ2	H
+HZ3	H
+HH	H
+HD2	H
+HD3	H
+HD13	H
+HB	H
+HA	H
+C	C
+CA	C
+CB	C
+CG	C
+CG1	C
+CG2	C
+CD	C
+CD1	C
+CD2	C
+CE	C
+CE1	C
+CE2	C
+CE3	C
+CZ	C
+CZ2	C
+CZ3	C
+CH2	C
+N	N 
+NH2	N 
+ND1	N 
+ND2	N 
+NE	N 
+NE1	N 
+NE2	N 
+SD	S
+SG	S
+NZ	N1+
+NH1	N1+
+OH      O
+O	O
+OE1	O
+OG	O
+OG1	O
+OD1	O
+OE2	O1-
+OD2	O1-
+OXT     O1-
+NA	NA
+Na	Na
+F	F
+Mg	Mg
+MG	MG
+P	P
+CL	CL
+Cl	Cl
+Ca	Ca
+Mn	Mn
+MN	MN
+Fe	Fe
+FE	FE
+Zn	Zn
+ZN	ZN
+Br	Br
+BR	BR
+I	I
+Z	Z
+G	G
+GA	GA
+J	J
+Q	Q
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PLIDflow/scripts/templateenvelopsizes.txt	Tue Jan 14 07:52:48 2020 -0500
@@ -0,0 +1,63 @@
+10
+20
+30
+40
+50
+60
+70
+80
+90
+100
+110
+120
+130
+140
+150
+160
+170
+180
+190
+200
+210
+220
+230
+240
+250
+260
+270
+280
+290
+300
+310
+320
+330
+340
+350
+360
+370
+380
+390
+400
+410
+420
+430
+440
+450
+460
+470
+480
+490
+500
+510
+520
+530
+540
+550
+560
+570
+580
+590
+600
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PLIDflow/scripts/templatefillouts1.txt	Tue Jan 14 07:52:48 2020 -0500
@@ -0,0 +1,61 @@
+FILL_10out1.pdb
+FILL_20out1.pdb
+FILL_30out1.pdb
+FILL_40out1.pdb
+FILL_50out1.pdb
+FILL_60out1.pdb
+FILL_70out1.pdb
+FILL_80out1.pdb
+FILL_90out1.pdb
+FILL_100out1.pdb
+FILL_110out1.pdb
+FILL_120out1.pdb
+FILL_130out1.pdb
+FILL_140out1.pdb
+FILL_150out1.pdb
+FILL_160out1.pdb
+FILL_170out1.pdb
+FILL_180out1.pdb
+FILL_190out1.pdb
+FILL_200out1.pdb
+FILL_210out1.pdb
+FILL_220out1.pdb
+FILL_230out1.pdb
+FILL_240out1.pdb
+FILL_250out1.pdb
+FILL_260out1.pdb
+FILL_270out1.pdb
+FILL_280out1.pdb
+FILL_290out1.pdb
+FILL_300out1.pdb
+FILL_310out1.pdb
+FILL_320out1.pdb
+FILL_330out1.pdb
+FILL_340out1.pdb
+FILL_350out1.pdb
+FILL_360out1.pdb
+FILL_370out1.pdb
+FILL_380out1.pdb
+FILL_390out1.pdb
+FILL_400out1.pdb
+FILL_410out1.pdb
+FILL_420out1.pdb
+FILL_430out1.pdb
+FILL_440out1.pdb
+FILL_450out1.pdb
+FILL_460out1.pdb
+FILL_470out1.pdb
+FILL_480out1.pdb
+FILL_490out1.pdb
+FILL_500out1.pdb
+FILL_510out1.pdb
+FILL_520out1.pdb
+FILL_530out1.pdb
+FILL_540out1.pdb
+FILL_550out1.pdb
+FILL_560out1.pdb
+FILL_570out1.pdb
+FILL_580out1.pdb
+FILL_590out1.pdb
+FILL_600out1.pdb
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PLIDflow/scripts/templatefillouts1_1_8.txt	Tue Jan 14 07:52:48 2020 -0500
@@ -0,0 +1,480 @@
+FILL_10out1.pdb
+FILL_10out2.pdb
+FILL_10out3.pdb
+FILL_10out4.pdb
+FILL_10out5.pdb
+FILL_10out6.pdb
+FILL_10out7.pdb
+FILL_10out8.pdb
+FILL_20out1.pdb
+FILL_20out2.pdb
+FILL_20out3.pdb
+FILL_20out4.pdb
+FILL_20out5.pdb
+FILL_20out6.pdb
+FILL_20out7.pdb
+FILL_20out8.pdb
+FILL_30out1.pdb
+FILL_30out2.pdb
+FILL_30out3.pdb
+FILL_30out4.pdb
+FILL_30out5.pdb
+FILL_30out6.pdb
+FILL_30out7.pdb
+FILL_30out8.pdb
+FILL_40out1.pdb
+FILL_40out2.pdb
+FILL_40out3.pdb
+FILL_40out4.pdb
+FILL_40out5.pdb
+FILL_40out6.pdb
+FILL_40out7.pdb
+FILL_40out8.pdb
+FILL_50out1.pdb
+FILL_50out2.pdb
+FILL_50out3.pdb
+FILL_50out4.pdb
+FILL_50out5.pdb
+FILL_50out6.pdb
+FILL_50out7.pdb
+FILL_50out8.pdb
+FILL_60out1.pdb
+FILL_60out2.pdb
+FILL_60out3.pdb
+FILL_60out4.pdb
+FILL_60out5.pdb
+FILL_60out6.pdb
+FILL_60out7.pdb
+FILL_60out8.pdb
+FILL_70out1.pdb
+FILL_70out2.pdb
+FILL_70out3.pdb
+FILL_70out4.pdb
+FILL_70out5.pdb
+FILL_70out6.pdb
+FILL_70out7.pdb
+FILL_70out8.pdb
+FILL_80out1.pdb
+FILL_80out2.pdb
+FILL_80out3.pdb
+FILL_80out4.pdb
+FILL_80out5.pdb
+FILL_80out6.pdb
+FILL_80out7.pdb
+FILL_80out8.pdb
+FILL_90out1.pdb
+FILL_90out2.pdb
+FILL_90out3.pdb
+FILL_90out4.pdb
+FILL_90out5.pdb
+FILL_90out6.pdb
+FILL_90out7.pdb
+FILL_90out8.pdb
+FILL_100out1.pdb
+FILL_100out2.pdb
+FILL_100out3.pdb
+FILL_100out4.pdb
+FILL_100out5.pdb
+FILL_100out6.pdb
+FILL_100out7.pdb
+FILL_100out8.pdb
+FILL_110out1.pdb
+FILL_110out2.pdb
+FILL_110out3.pdb
+FILL_110out4.pdb
+FILL_110out5.pdb
+FILL_110out6.pdb
+FILL_110out7.pdb
+FILL_110out8.pdb
+FILL_120out1.pdb
+FILL_120out2.pdb
+FILL_120out3.pdb
+FILL_120out4.pdb
+FILL_120out5.pdb
+FILL_120out6.pdb
+FILL_120out7.pdb
+FILL_120out8.pdb
+FILL_130out1.pdb
+FILL_130out2.pdb
+FILL_130out3.pdb
+FILL_130out4.pdb
+FILL_130out5.pdb
+FILL_130out6.pdb
+FILL_130out7.pdb
+FILL_130out8.pdb
+FILL_140out1.pdb
+FILL_140out2.pdb
+FILL_140out3.pdb
+FILL_140out4.pdb
+FILL_140out5.pdb
+FILL_140out6.pdb
+FILL_140out7.pdb
+FILL_140out8.pdb
+FILL_150out1.pdb
+FILL_150out2.pdb
+FILL_150out3.pdb
+FILL_150out4.pdb
+FILL_150out5.pdb
+FILL_150out6.pdb
+FILL_150out7.pdb
+FILL_150out8.pdb
+FILL_160out1.pdb
+FILL_160out2.pdb
+FILL_160out3.pdb
+FILL_160out4.pdb
+FILL_160out5.pdb
+FILL_160out6.pdb
+FILL_160out7.pdb
+FILL_160out8.pdb
+FILL_170out1.pdb
+FILL_170out2.pdb
+FILL_170out3.pdb
+FILL_170out4.pdb
+FILL_170out5.pdb
+FILL_170out6.pdb
+FILL_170out7.pdb
+FILL_170out8.pdb
+FILL_180out1.pdb
+FILL_180out2.pdb
+FILL_180out3.pdb
+FILL_180out4.pdb
+FILL_180out5.pdb
+FILL_180out6.pdb
+FILL_180out7.pdb
+FILL_180out8.pdb
+FILL_190out1.pdb
+FILL_190out2.pdb
+FILL_190out3.pdb
+FILL_190out4.pdb
+FILL_190out5.pdb
+FILL_190out6.pdb
+FILL_190out7.pdb
+FILL_190out8.pdb
+FILL_200out1.pdb
+FILL_200out2.pdb
+FILL_200out3.pdb
+FILL_200out4.pdb
+FILL_200out5.pdb
+FILL_200out6.pdb
+FILL_200out7.pdb
+FILL_200out8.pdb
+FILL_210out1.pdb
+FILL_210out2.pdb
+FILL_210out3.pdb
+FILL_210out4.pdb
+FILL_210out5.pdb
+FILL_210out6.pdb
+FILL_210out7.pdb
+FILL_210out8.pdb
+FILL_220out1.pdb
+FILL_220out2.pdb
+FILL_220out3.pdb
+FILL_220out4.pdb
+FILL_220out5.pdb
+FILL_220out6.pdb
+FILL_220out7.pdb
+FILL_220out8.pdb
+FILL_230out1.pdb
+FILL_230out2.pdb
+FILL_230out3.pdb
+FILL_230out4.pdb
+FILL_230out5.pdb
+FILL_230out6.pdb
+FILL_230out7.pdb
+FILL_230out8.pdb
+FILL_240out1.pdb
+FILL_240out2.pdb
+FILL_240out3.pdb
+FILL_240out4.pdb
+FILL_240out5.pdb
+FILL_240out6.pdb
+FILL_240out7.pdb
+FILL_240out8.pdb
+FILL_250out1.pdb
+FILL_250out2.pdb
+FILL_250out3.pdb
+FILL_250out4.pdb
+FILL_250out5.pdb
+FILL_250out6.pdb
+FILL_250out7.pdb
+FILL_250out8.pdb
+FILL_260out1.pdb
+FILL_260out2.pdb
+FILL_260out3.pdb
+FILL_260out4.pdb
+FILL_260out5.pdb
+FILL_260out6.pdb
+FILL_260out7.pdb
+FILL_260out8.pdb
+FILL_270out1.pdb
+FILL_270out2.pdb
+FILL_270out3.pdb
+FILL_270out4.pdb
+FILL_270out5.pdb
+FILL_270out6.pdb
+FILL_270out7.pdb
+FILL_270out8.pdb
+FILL_280out1.pdb
+FILL_280out2.pdb
+FILL_280out3.pdb
+FILL_280out4.pdb
+FILL_280out5.pdb
+FILL_280out6.pdb
+FILL_280out7.pdb
+FILL_280out8.pdb
+FILL_290out1.pdb
+FILL_290out2.pdb
+FILL_290out3.pdb
+FILL_290out4.pdb
+FILL_290out5.pdb
+FILL_290out6.pdb
+FILL_290out7.pdb
+FILL_290out8.pdb
+FILL_300out1.pdb
+FILL_300out2.pdb
+FILL_300out3.pdb
+FILL_300out4.pdb
+FILL_300out5.pdb
+FILL_300out6.pdb
+FILL_300out7.pdb
+FILL_300out8.pdb
+FILL_310out1.pdb
+FILL_310out2.pdb
+FILL_310out3.pdb
+FILL_310out4.pdb
+FILL_310out5.pdb
+FILL_310out6.pdb
+FILL_310out7.pdb
+FILL_310out8.pdb
+FILL_320out1.pdb
+FILL_320out2.pdb
+FILL_320out3.pdb
+FILL_320out4.pdb
+FILL_320out5.pdb
+FILL_320out6.pdb
+FILL_320out7.pdb
+FILL_320out8.pdb
+FILL_330out1.pdb
+FILL_330out2.pdb
+FILL_330out3.pdb
+FILL_330out4.pdb
+FILL_330out5.pdb
+FILL_330out6.pdb
+FILL_330out7.pdb
+FILL_330out8.pdb
+FILL_340out1.pdb
+FILL_340out2.pdb
+FILL_340out3.pdb
+FILL_340out4.pdb
+FILL_340out5.pdb
+FILL_340out6.pdb
+FILL_340out7.pdb
+FILL_340out8.pdb
+FILL_350out1.pdb
+FILL_350out2.pdb
+FILL_350out3.pdb
+FILL_350out4.pdb
+FILL_350out5.pdb
+FILL_350out6.pdb
+FILL_350out7.pdb
+FILL_350out8.pdb
+FILL_360out1.pdb
+FILL_360out2.pdb
+FILL_360out3.pdb
+FILL_360out4.pdb
+FILL_360out5.pdb
+FILL_360out6.pdb
+FILL_360out7.pdb
+FILL_360out8.pdb
+FILL_370out1.pdb
+FILL_370out2.pdb
+FILL_370out3.pdb
+FILL_370out4.pdb
+FILL_370out5.pdb
+FILL_370out6.pdb
+FILL_370out7.pdb
+FILL_370out8.pdb
+FILL_380out1.pdb
+FILL_380out2.pdb
+FILL_380out3.pdb
+FILL_380out4.pdb
+FILL_380out5.pdb
+FILL_380out6.pdb
+FILL_380out7.pdb
+FILL_380out8.pdb
+FILL_390out1.pdb
+FILL_390out2.pdb
+FILL_390out3.pdb
+FILL_390out4.pdb
+FILL_390out5.pdb
+FILL_390out6.pdb
+FILL_390out7.pdb
+FILL_390out8.pdb
+FILL_400out1.pdb
+FILL_400out2.pdb
+FILL_400out3.pdb
+FILL_400out4.pdb
+FILL_400out5.pdb
+FILL_400out6.pdb
+FILL_400out7.pdb
+FILL_400out8.pdb
+FILL_410out1.pdb
+FILL_410out2.pdb
+FILL_410out3.pdb
+FILL_410out4.pdb
+FILL_410out5.pdb
+FILL_410out6.pdb
+FILL_410out7.pdb
+FILL_410out8.pdb
+FILL_420out1.pdb
+FILL_420out2.pdb
+FILL_420out3.pdb
+FILL_420out4.pdb
+FILL_420out5.pdb
+FILL_420out6.pdb
+FILL_420out7.pdb
+FILL_420out8.pdb
+FILL_430out1.pdb
+FILL_430out2.pdb
+FILL_430out3.pdb
+FILL_430out4.pdb
+FILL_430out5.pdb
+FILL_430out6.pdb
+FILL_430out7.pdb
+FILL_430out8.pdb
+FILL_440out1.pdb
+FILL_440out2.pdb
+FILL_440out3.pdb
+FILL_440out4.pdb
+FILL_440out5.pdb
+FILL_440out6.pdb
+FILL_440out7.pdb
+FILL_440out8.pdb
+FILL_450out1.pdb
+FILL_450out2.pdb
+FILL_450out3.pdb
+FILL_450out4.pdb
+FILL_450out5.pdb
+FILL_450out6.pdb
+FILL_450out7.pdb
+FILL_450out8.pdb
+FILL_460out1.pdb
+FILL_460out2.pdb
+FILL_460out3.pdb
+FILL_460out4.pdb
+FILL_460out5.pdb
+FILL_460out6.pdb
+FILL_460out7.pdb
+FILL_460out8.pdb
+FILL_470out1.pdb
+FILL_470out2.pdb
+FILL_470out3.pdb
+FILL_470out4.pdb
+FILL_470out5.pdb
+FILL_470out6.pdb
+FILL_470out7.pdb
+FILL_470out8.pdb
+FILL_480out1.pdb
+FILL_480out2.pdb
+FILL_480out3.pdb
+FILL_480out4.pdb
+FILL_480out5.pdb
+FILL_480out6.pdb
+FILL_480out7.pdb
+FILL_480out8.pdb
+FILL_490out1.pdb
+FILL_490out2.pdb
+FILL_490out3.pdb
+FILL_490out4.pdb
+FILL_490out5.pdb
+FILL_490out6.pdb
+FILL_490out7.pdb
+FILL_490out8.pdb
+FILL_500out1.pdb
+FILL_500out2.pdb
+FILL_500out3.pdb
+FILL_500out4.pdb
+FILL_500out5.pdb
+FILL_500out6.pdb
+FILL_500out7.pdb
+FILL_500out8.pdb
+FILL_510out1.pdb
+FILL_510out2.pdb
+FILL_510out3.pdb
+FILL_510out4.pdb
+FILL_510out5.pdb
+FILL_510out6.pdb
+FILL_510out7.pdb
+FILL_510out8.pdb
+FILL_520out1.pdb
+FILL_520out2.pdb
+FILL_520out3.pdb
+FILL_520out4.pdb
+FILL_520out5.pdb
+FILL_520out6.pdb
+FILL_520out7.pdb
+FILL_520out8.pdb
+FILL_530out1.pdb
+FILL_530out2.pdb
+FILL_530out3.pdb
+FILL_530out4.pdb
+FILL_530out5.pdb
+FILL_530out6.pdb
+FILL_530out7.pdb
+FILL_530out8.pdb
+FILL_540out1.pdb
+FILL_540out2.pdb
+FILL_540out3.pdb
+FILL_540out4.pdb
+FILL_540out5.pdb
+FILL_540out6.pdb
+FILL_540out7.pdb
+FILL_540out8.pdb
+FILL_550out1.pdb
+FILL_550out2.pdb
+FILL_550out3.pdb
+FILL_550out4.pdb
+FILL_550out5.pdb
+FILL_550out6.pdb
+FILL_550out7.pdb
+FILL_550out8.pdb
+FILL_560out1.pdb
+FILL_560out2.pdb
+FILL_560out3.pdb
+FILL_560out4.pdb
+FILL_560out5.pdb
+FILL_560out6.pdb
+FILL_560out7.pdb
+FILL_560out8.pdb
+FILL_570out1.pdb
+FILL_570out2.pdb
+FILL_570out3.pdb
+FILL_570out4.pdb
+FILL_570out5.pdb
+FILL_570out6.pdb
+FILL_570out7.pdb
+FILL_570out8.pdb
+FILL_580out1.pdb
+FILL_580out2.pdb
+FILL_580out3.pdb
+FILL_580out4.pdb
+FILL_580out5.pdb
+FILL_580out6.pdb
+FILL_580out7.pdb
+FILL_580out8.pdb
+FILL_590out1.pdb
+FILL_590out2.pdb
+FILL_590out3.pdb
+FILL_590out4.pdb
+FILL_590out5.pdb
+FILL_590out6.pdb
+FILL_590out7.pdb
+FILL_590out8.pdb
+FILL_600out1.pdb
+FILL_600out2.pdb
+FILL_600out3.pdb
+FILL_600out4.pdb
+FILL_600out5.pdb
+FILL_600out6.pdb
+FILL_600out7.pdb
+FILL_600out8.pdb
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PLIDflow/scripts/templatefillouts1_ALLFILLS.txt	Tue Jan 14 07:52:48 2020 -0500
@@ -0,0 +1,600 @@
+FILL_10out1.pdb
+FILL_10out2.pdb
+FILL_10out3.pdb
+FILL_10out4.pdb
+FILL_10out5.pdb
+FILL_10out6.pdb
+FILL_10out7.pdb
+FILL_10out8.pdb
+FILL_10out9.pdb
+FILL_10out10.pdb
+FILL_20out1.pdb
+FILL_20out2.pdb
+FILL_20out3.pdb
+FILL_20out4.pdb
+FILL_20out5.pdb
+FILL_20out6.pdb
+FILL_20out7.pdb
+FILL_20out8.pdb
+FILL_20out9.pdb
+FILL_20out10.pdb
+FILL_30out1.pdb
+FILL_30out2.pdb
+FILL_30out3.pdb
+FILL_30out4.pdb
+FILL_30out5.pdb
+FILL_30out6.pdb
+FILL_30out7.pdb
+FILL_30out8.pdb
+FILL_30out9.pdb
+FILL_30out10.pdb
+FILL_40out1.pdb
+FILL_40out2.pdb
+FILL_40out3.pdb
+FILL_40out4.pdb
+FILL_40out5.pdb
+FILL_40out6.pdb
+FILL_40out7.pdb
+FILL_40out8.pdb
+FILL_40out9.pdb
+FILL_40out10.pdb
+FILL_50out1.pdb
+FILL_50out2.pdb
+FILL_50out3.pdb
+FILL_50out4.pdb
+FILL_50out5.pdb
+FILL_50out6.pdb
+FILL_50out7.pdb
+FILL_50out8.pdb
+FILL_50out9.pdb
+FILL_50out10.pdb
+FILL_60out1.pdb
+FILL_60out2.pdb
+FILL_60out3.pdb
+FILL_60out4.pdb
+FILL_60out5.pdb
+FILL_60out6.pdb
+FILL_60out7.pdb
+FILL_60out8.pdb
+FILL_60out9.pdb
+FILL_60out10.pdb
+FILL_70out1.pdb
+FILL_70out2.pdb
+FILL_70out3.pdb
+FILL_70out4.pdb
+FILL_70out5.pdb
+FILL_70out6.pdb
+FILL_70out7.pdb
+FILL_70out8.pdb
+FILL_70out9.pdb
+FILL_70out10.pdb
+FILL_80out1.pdb
+FILL_80out2.pdb
+FILL_80out3.pdb
+FILL_80out4.pdb
+FILL_80out5.pdb
+FILL_80out6.pdb
+FILL_80out7.pdb
+FILL_80out8.pdb
+FILL_80out9.pdb
+FILL_80out10.pdb
+FILL_90out1.pdb
+FILL_90out2.pdb
+FILL_90out3.pdb
+FILL_90out4.pdb
+FILL_90out5.pdb
+FILL_90out6.pdb
+FILL_90out7.pdb
+FILL_90out8.pdb
+FILL_90out9.pdb
+FILL_90out10.pdb
+FILL_100out1.pdb
+FILL_100out2.pdb
+FILL_100out3.pdb
+FILL_100out4.pdb
+FILL_100out5.pdb
+FILL_100out6.pdb
+FILL_100out7.pdb
+FILL_100out8.pdb
+FILL_100out9.pdb
+FILL_100out10.pdb
+FILL_110out1.pdb
+FILL_110out2.pdb
+FILL_110out3.pdb
+FILL_110out4.pdb
+FILL_110out5.pdb
+FILL_110out6.pdb
+FILL_110out7.pdb
+FILL_110out8.pdb
+FILL_110out9.pdb
+FILL_110out10.pdb
+FILL_120out1.pdb
+FILL_120out2.pdb
+FILL_120out3.pdb
+FILL_120out4.pdb
+FILL_120out5.pdb
+FILL_120out6.pdb
+FILL_120out7.pdb
+FILL_120out8.pdb
+FILL_120out9.pdb
+FILL_120out10.pdb
+FILL_130out1.pdb
+FILL_130out2.pdb
+FILL_130out3.pdb
+FILL_130out4.pdb
+FILL_130out5.pdb
+FILL_130out6.pdb
+FILL_130out7.pdb
+FILL_130out8.pdb
+FILL_130out9.pdb
+FILL_130out10.pdb
+FILL_140out1.pdb
+FILL_140out2.pdb
+FILL_140out3.pdb
+FILL_140out4.pdb
+FILL_140out5.pdb
+FILL_140out6.pdb
+FILL_140out7.pdb
+FILL_140out8.pdb
+FILL_140out9.pdb
+FILL_140out10.pdb
+FILL_150out1.pdb
+FILL_150out2.pdb
+FILL_150out3.pdb
+FILL_150out4.pdb
+FILL_150out5.pdb
+FILL_150out6.pdb
+FILL_150out7.pdb
+FILL_150out8.pdb
+FILL_150out9.pdb
+FILL_150out10.pdb
+FILL_160out1.pdb
+FILL_160out2.pdb
+FILL_160out3.pdb
+FILL_160out4.pdb
+FILL_160out5.pdb
+FILL_160out6.pdb
+FILL_160out7.pdb
+FILL_160out8.pdb
+FILL_160out9.pdb
+FILL_160out10.pdb
+FILL_170out1.pdb
+FILL_170out2.pdb
+FILL_170out3.pdb
+FILL_170out4.pdb
+FILL_170out5.pdb
+FILL_170out6.pdb
+FILL_170out7.pdb
+FILL_170out8.pdb
+FILL_170out9.pdb
+FILL_170out10.pdb
+FILL_180out1.pdb
+FILL_180out2.pdb
+FILL_180out3.pdb
+FILL_180out4.pdb
+FILL_180out5.pdb
+FILL_180out6.pdb
+FILL_180out7.pdb
+FILL_180out8.pdb
+FILL_180out9.pdb
+FILL_180out10.pdb
+FILL_190out1.pdb
+FILL_190out2.pdb
+FILL_190out3.pdb
+FILL_190out4.pdb
+FILL_190out5.pdb
+FILL_190out6.pdb
+FILL_190out7.pdb
+FILL_190out8.pdb
+FILL_190out9.pdb
+FILL_190out10.pdb
+FILL_200out1.pdb
+FILL_200out2.pdb
+FILL_200out3.pdb
+FILL_200out4.pdb
+FILL_200out5.pdb
+FILL_200out6.pdb
+FILL_200out7.pdb
+FILL_200out8.pdb
+FILL_200out9.pdb
+FILL_200out10.pdb
+FILL_210out1.pdb
+FILL_210out2.pdb
+FILL_210out3.pdb
+FILL_210out4.pdb
+FILL_210out5.pdb
+FILL_210out6.pdb
+FILL_210out7.pdb
+FILL_210out8.pdb
+FILL_210out9.pdb
+FILL_210out10.pdb
+FILL_220out1.pdb
+FILL_220out2.pdb
+FILL_220out3.pdb
+FILL_220out4.pdb
+FILL_220out5.pdb
+FILL_220out6.pdb
+FILL_220out7.pdb
+FILL_220out8.pdb
+FILL_220out9.pdb
+FILL_220out10.pdb
+FILL_230out1.pdb
+FILL_230out2.pdb
+FILL_230out3.pdb
+FILL_230out4.pdb
+FILL_230out5.pdb
+FILL_230out6.pdb
+FILL_230out7.pdb
+FILL_230out8.pdb
+FILL_230out9.pdb
+FILL_230out10.pdb
+FILL_240out1.pdb
+FILL_240out2.pdb
+FILL_240out3.pdb
+FILL_240out4.pdb
+FILL_240out5.pdb
+FILL_240out6.pdb
+FILL_240out7.pdb
+FILL_240out8.pdb
+FILL_240out9.pdb
+FILL_240out10.pdb
+FILL_250out1.pdb
+FILL_250out2.pdb
+FILL_250out3.pdb
+FILL_250out4.pdb
+FILL_250out5.pdb
+FILL_250out6.pdb
+FILL_250out7.pdb
+FILL_250out8.pdb
+FILL_250out9.pdb
+FILL_250out10.pdb
+FILL_260out1.pdb
+FILL_260out2.pdb
+FILL_260out3.pdb
+FILL_260out4.pdb
+FILL_260out5.pdb
+FILL_260out6.pdb
+FILL_260out7.pdb
+FILL_260out8.pdb
+FILL_260out9.pdb
+FILL_260out10.pdb
+FILL_270out1.pdb
+FILL_270out2.pdb
+FILL_270out3.pdb
+FILL_270out4.pdb
+FILL_270out5.pdb
+FILL_270out6.pdb
+FILL_270out7.pdb
+FILL_270out8.pdb
+FILL_270out9.pdb
+FILL_270out10.pdb
+FILL_280out1.pdb
+FILL_280out2.pdb
+FILL_280out3.pdb
+FILL_280out4.pdb
+FILL_280out5.pdb
+FILL_280out6.pdb
+FILL_280out7.pdb
+FILL_280out8.pdb
+FILL_280out9.pdb
+FILL_280out10.pdb
+FILL_290out1.pdb
+FILL_290out2.pdb
+FILL_290out3.pdb
+FILL_290out4.pdb
+FILL_290out5.pdb
+FILL_290out6.pdb
+FILL_290out7.pdb
+FILL_290out8.pdb
+FILL_290out9.pdb
+FILL_290out10.pdb
+FILL_300out1.pdb
+FILL_300out2.pdb
+FILL_300out3.pdb
+FILL_300out4.pdb
+FILL_300out5.pdb
+FILL_300out6.pdb
+FILL_300out7.pdb
+FILL_300out8.pdb
+FILL_300out9.pdb
+FILL_300out10.pdb
+FILL_310out1.pdb
+FILL_310out2.pdb
+FILL_310out3.pdb
+FILL_310out4.pdb
+FILL_310out5.pdb
+FILL_310out6.pdb
+FILL_310out7.pdb
+FILL_310out8.pdb
+FILL_310out9.pdb
+FILL_310out10.pdb
+FILL_320out1.pdb
+FILL_320out2.pdb
+FILL_320out3.pdb
+FILL_320out4.pdb
+FILL_320out5.pdb
+FILL_320out6.pdb
+FILL_320out7.pdb
+FILL_320out8.pdb
+FILL_320out9.pdb
+FILL_320out10.pdb
+FILL_330out1.pdb
+FILL_330out2.pdb
+FILL_330out3.pdb
+FILL_330out4.pdb
+FILL_330out5.pdb
+FILL_330out6.pdb
+FILL_330out7.pdb
+FILL_330out8.pdb
+FILL_330out9.pdb
+FILL_330out10.pdb
+FILL_340out1.pdb
+FILL_340out2.pdb
+FILL_340out3.pdb
+FILL_340out4.pdb
+FILL_340out5.pdb
+FILL_340out6.pdb
+FILL_340out7.pdb
+FILL_340out8.pdb
+FILL_340out9.pdb
+FILL_340out10.pdb
+FILL_350out1.pdb
+FILL_350out2.pdb
+FILL_350out3.pdb
+FILL_350out4.pdb
+FILL_350out5.pdb
+FILL_350out6.pdb
+FILL_350out7.pdb
+FILL_350out8.pdb
+FILL_350out9.pdb
+FILL_350out10.pdb
+FILL_360out1.pdb
+FILL_360out2.pdb
+FILL_360out3.pdb
+FILL_360out4.pdb
+FILL_360out5.pdb
+FILL_360out6.pdb
+FILL_360out7.pdb
+FILL_360out8.pdb
+FILL_360out9.pdb
+FILL_360out10.pdb
+FILL_370out1.pdb
+FILL_370out2.pdb
+FILL_370out3.pdb
+FILL_370out4.pdb
+FILL_370out5.pdb
+FILL_370out6.pdb
+FILL_370out7.pdb
+FILL_370out8.pdb
+FILL_370out9.pdb
+FILL_370out10.pdb
+FILL_380out1.pdb
+FILL_380out2.pdb
+FILL_380out3.pdb
+FILL_380out4.pdb
+FILL_380out5.pdb
+FILL_380out6.pdb
+FILL_380out7.pdb
+FILL_380out8.pdb
+FILL_380out9.pdb
+FILL_380out10.pdb
+FILL_390out1.pdb
+FILL_390out2.pdb
+FILL_390out3.pdb
+FILL_390out4.pdb
+FILL_390out5.pdb
+FILL_390out6.pdb
+FILL_390out7.pdb
+FILL_390out8.pdb
+FILL_390out9.pdb
+FILL_390out10.pdb
+FILL_400out1.pdb
+FILL_400out2.pdb
+FILL_400out3.pdb
+FILL_400out4.pdb
+FILL_400out5.pdb
+FILL_400out6.pdb
+FILL_400out7.pdb
+FILL_400out8.pdb
+FILL_400out9.pdb
+FILL_400out10.pdb
+FILL_410out1.pdb
+FILL_410out2.pdb
+FILL_410out3.pdb
+FILL_410out4.pdb
+FILL_410out5.pdb
+FILL_410out6.pdb
+FILL_410out7.pdb
+FILL_410out8.pdb
+FILL_410out9.pdb
+FILL_410out10.pdb
+FILL_420out1.pdb
+FILL_420out2.pdb
+FILL_420out3.pdb
+FILL_420out4.pdb
+FILL_420out5.pdb
+FILL_420out6.pdb
+FILL_420out7.pdb
+FILL_420out8.pdb
+FILL_420out9.pdb
+FILL_420out10.pdb
+FILL_430out1.pdb
+FILL_430out2.pdb
+FILL_430out3.pdb
+FILL_430out4.pdb
+FILL_430out5.pdb
+FILL_430out6.pdb
+FILL_430out7.pdb
+FILL_430out8.pdb
+FILL_430out9.pdb
+FILL_430out10.pdb
+FILL_440out1.pdb
+FILL_440out2.pdb
+FILL_440out3.pdb
+FILL_440out4.pdb
+FILL_440out5.pdb
+FILL_440out6.pdb
+FILL_440out7.pdb
+FILL_440out8.pdb
+FILL_440out9.pdb
+FILL_440out10.pdb
+FILL_450out1.pdb
+FILL_450out2.pdb
+FILL_450out3.pdb
+FILL_450out4.pdb
+FILL_450out5.pdb
+FILL_450out6.pdb
+FILL_450out7.pdb
+FILL_450out8.pdb
+FILL_450out9.pdb
+FILL_450out10.pdb
+FILL_460out1.pdb
+FILL_460out2.pdb
+FILL_460out3.pdb
+FILL_460out4.pdb
+FILL_460out5.pdb
+FILL_460out6.pdb
+FILL_460out7.pdb
+FILL_460out8.pdb
+FILL_460out9.pdb
+FILL_460out10.pdb
+FILL_470out1.pdb
+FILL_470out2.pdb
+FILL_470out3.pdb
+FILL_470out4.pdb
+FILL_470out5.pdb
+FILL_470out6.pdb
+FILL_470out7.pdb
+FILL_470out8.pdb
+FILL_470out9.pdb
+FILL_470out10.pdb
+FILL_480out1.pdb
+FILL_480out2.pdb
+FILL_480out3.pdb
+FILL_480out4.pdb
+FILL_480out5.pdb
+FILL_480out6.pdb
+FILL_480out7.pdb
+FILL_480out8.pdb
+FILL_480out9.pdb
+FILL_480out10.pdb
+FILL_490out1.pdb
+FILL_490out2.pdb
+FILL_490out3.pdb
+FILL_490out4.pdb
+FILL_490out5.pdb
+FILL_490out6.pdb
+FILL_490out7.pdb
+FILL_490out8.pdb
+FILL_490out9.pdb
+FILL_490out10.pdb
+FILL_500out1.pdb
+FILL_500out2.pdb
+FILL_500out3.pdb
+FILL_500out4.pdb
+FILL_500out5.pdb
+FILL_500out6.pdb
+FILL_500out7.pdb
+FILL_500out8.pdb
+FILL_500out9.pdb
+FILL_500out10.pdb
+FILL_510out1.pdb
+FILL_510out2.pdb
+FILL_510out3.pdb
+FILL_510out4.pdb
+FILL_510out5.pdb
+FILL_510out6.pdb
+FILL_510out7.pdb
+FILL_510out8.pdb
+FILL_510out9.pdb
+FILL_510out10.pdb
+FILL_520out1.pdb
+FILL_520out2.pdb
+FILL_520out3.pdb
+FILL_520out4.pdb
+FILL_520out5.pdb
+FILL_520out6.pdb
+FILL_520out7.pdb
+FILL_520out8.pdb
+FILL_520out9.pdb
+FILL_520out10.pdb
+FILL_530out1.pdb
+FILL_530out2.pdb
+FILL_530out3.pdb
+FILL_530out4.pdb
+FILL_530out5.pdb
+FILL_530out6.pdb
+FILL_530out7.pdb
+FILL_530out8.pdb
+FILL_530out9.pdb
+FILL_530out10.pdb
+FILL_540out1.pdb
+FILL_540out2.pdb
+FILL_540out3.pdb
+FILL_540out4.pdb
+FILL_540out5.pdb
+FILL_540out6.pdb
+FILL_540out7.pdb
+FILL_540out8.pdb
+FILL_540out9.pdb
+FILL_540out10.pdb
+FILL_550out1.pdb
+FILL_550out2.pdb
+FILL_550out3.pdb
+FILL_550out4.pdb
+FILL_550out5.pdb
+FILL_550out6.pdb
+FILL_550out7.pdb
+FILL_550out8.pdb
+FILL_550out9.pdb
+FILL_550out10.pdb
+FILL_560out1.pdb
+FILL_560out2.pdb
+FILL_560out3.pdb
+FILL_560out4.pdb
+FILL_560out5.pdb
+FILL_560out6.pdb
+FILL_560out7.pdb
+FILL_560out8.pdb
+FILL_560out9.pdb
+FILL_560out10.pdb
+FILL_570out1.pdb
+FILL_570out2.pdb
+FILL_570out3.pdb
+FILL_570out4.pdb
+FILL_570out5.pdb
+FILL_570out6.pdb
+FILL_570out7.pdb
+FILL_570out8.pdb
+FILL_570out9.pdb
+FILL_570out10.pdb
+FILL_580out1.pdb
+FILL_580out2.pdb
+FILL_580out3.pdb
+FILL_580out4.pdb
+FILL_580out5.pdb
+FILL_580out6.pdb
+FILL_580out7.pdb
+FILL_580out8.pdb
+FILL_580out9.pdb
+FILL_580out10.pdb
+FILL_590out1.pdb
+FILL_590out2.pdb
+FILL_590out3.pdb
+FILL_590out4.pdb
+FILL_590out5.pdb
+FILL_590out6.pdb
+FILL_590out7.pdb
+FILL_590out8.pdb
+FILL_590out9.pdb
+FILL_590out10.pdb
+FILL_600out1.pdb
+FILL_600out2.pdb
+FILL_600out3.pdb
+FILL_600out4.pdb
+FILL_600out5.pdb
+FILL_600out6.pdb
+FILL_600out7.pdb
+FILL_600out8.pdb
+FILL_600out9.pdb
+FILL_600out10.pdb
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PLIDflow/scripts/templatefillouts1_OKsoloout1.txt	Tue Jan 14 07:52:48 2020 -0500
@@ -0,0 +1,61 @@
+FILL_10out1.pdb
+FILL_20out1.pdb
+FILL_30out1.pdb
+FILL_40out1.pdb
+FILL_50out1.pdb
+FILL_60out1.pdb
+FILL_70out1.pdb
+FILL_80out1.pdb
+FILL_90out1.pdb
+FILL_100out1.pdb
+FILL_110out1.pdb
+FILL_120out1.pdb
+FILL_130out1.pdb
+FILL_140out1.pdb
+FILL_150out1.pdb
+FILL_160out1.pdb
+FILL_170out1.pdb
+FILL_180out1.pdb
+FILL_190out1.pdb
+FILL_200out1.pdb
+FILL_210out1.pdb
+FILL_220out1.pdb
+FILL_230out1.pdb
+FILL_240out1.pdb
+FILL_250out1.pdb
+FILL_260out1.pdb
+FILL_270out1.pdb
+FILL_280out1.pdb
+FILL_290out1.pdb
+FILL_300out1.pdb
+FILL_310out1.pdb
+FILL_320out1.pdb
+FILL_330out1.pdb
+FILL_340out1.pdb
+FILL_350out1.pdb
+FILL_360out1.pdb
+FILL_370out1.pdb
+FILL_380out1.pdb
+FILL_390out1.pdb
+FILL_400out1.pdb
+FILL_410out1.pdb
+FILL_420out1.pdb
+FILL_430out1.pdb
+FILL_440out1.pdb
+FILL_450out1.pdb
+FILL_460out1.pdb
+FILL_470out1.pdb
+FILL_480out1.pdb
+FILL_490out1.pdb
+FILL_500out1.pdb
+FILL_510out1.pdb
+FILL_520out1.pdb
+FILL_530out1.pdb
+FILL_540out1.pdb
+FILL_550out1.pdb
+FILL_560out1.pdb
+FILL_570out1.pdb
+FILL_580out1.pdb
+FILL_590out1.pdb
+FILL_600out1.pdb
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PLIDflow/scripts/vinafilemaker.R	Tue Jan 14 07:52:48 2020 -0500
@@ -0,0 +1,38 @@
+
+#!/usr/bin/env Rscript      # siempre va comentado, la consola lo interpreta asi. 
+args = commandArgs(trailingOnly=TRUE) # siempre es asi, no cambia.
+
+if(length(args) < 9){
+   stop("USE: Rscript.exe walker.R <receptor_PDBQT> <ligand_PDBQT> <out_PDBQT> <log_file> <coo_x > <coo_y> <coo_z> <eboxsizedata> <galaxy_output>")
+ }
+
+receptor_PDBQT <- args[1]
+ligand_PDBQT <- args[2]
+out_PDBQT <- args[3]
+log_file <- args[4]
+coo_x <- args[5]
+coo_y <- args[6]
+coo_z <- args[7]
+eboxsizedata <- args[8]
+
+receptor_data <- paste("receptor =", args[1], sep = " ")
+ligando_data <- paste("ligand =" , args[2], sep = " ")
+out_data <- paste("out =" , args[3], sep = " ")
+log_file <- paste("log =", args[4], sep = " ")
+center_x_data <- paste("center_x =", args[5], sep = " ")
+center_y_data <- paste("center_y =", args[6], sep = " ")
+center_z_data <- paste("center_z =", args[7], sep = " ")
+aux <- as.numeric(scan(args[8], what="character", quiet=TRUE), quiet = TRUE)
+size_x_data <- paste("size_x =", aux, sep = " ")
+size_y_data <- paste("size_y =", aux, sep = " ")
+size_z_data <- paste("size_z =", aux, sep = " ")
+
+campos <- c(receptor_data,ligando_data, out_data, log_file, center_x_data, center_y_data, center_z_data, size_x_data, size_y_data, size_z_data)
+
+datos <- c()
+for(i in 1:length(campos)){
+  datos <-paste(c(datos, campos[i], sep="\n"))
+}
+
+write(datos, file=args[9], append=FALSE)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PLIDflow/scripts/vinafilemarkerclusters.R	Tue Jan 14 07:52:48 2020 -0500
@@ -0,0 +1,40 @@
+#!/usr/bin/env Rscript      # siempre va comentado, la consola lo interpreta asi. 
+args = commandArgs(trailingOnly=TRUE) # siempre es asi, no cambia.
+
+if(length(args) < 10){
+  # stop("USE: Rscript.exe vinafilemarkerclusters.R <receptor_PDBQT> <ligand_PDBQT> <out_PDBQT> <log_file> <coo_x > <coo_y> <coo_z> <eboxsizedata> <galaxy_output> <v>")
+   stop("USE: Rscript vinafilemarkerclusters.R <receptor_PDBQT> <ligand_PDBQT> <out_PDBQT> <log_file> <coo_x > <coo_y> <coo_z> <eboxsizedata> <v> <session_dir>")
+ }
+
+
+receptor_PDBQT <- args[1]
+ligand_PDBQT <- args[2]
+out_PDBQT <- args[3]
+log_file <- args[4]
+eboxsizedata <- args[8]
+v <- args[9]
+session_dir <- args[10]
+
+setwd(session_dir)
+
+receptor_data <- paste("receptor =", args[1], sep = " ")
+ligando_data <- paste("ligand =" , args[2], sep = " ")
+out_data <- paste("out =" , args[3], sep = " ")
+log_file <- paste("log =", args[4], sep = " ")
+center_x_data <- paste("center_x =", args[5], sep =" ")
+center_y_data <- paste("center_y =", args[6], sep =" ")
+center_z_data <- paste("center_z =", args[7], sep =" ")
+aux <- as.numeric(scan(args[8], what="character", quiet=TRUE), quiet=TRUE)
+size_x_data <- paste("size_x =", aux, sep = " ")
+size_y_data <- paste("size_y =", aux, sep = " ")
+size_z_data <- paste("size_z =", aux, sep = " ")
+
+campos <- c(receptor_data,ligando_data, out_data, log_file, center_x_data, center_y_data, center_z_data, size_x_data, size_y_data, size_z_data)
+
+datos <- c()
+for(i in 1:length(campos)){
+  datos <-paste(c(datos, campos[i], sep="\n"))
+}
+
+write(datos, file=paste(v, "_vinaconfig", sep = ""), append=FALSE)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PLIDflow/scripts/vinaoutpututility.sh	Tue Jan 14 07:52:48 2020 -0500
@@ -0,0 +1,12 @@
+#!/bin/bash
+OUT=$1
+LOG=$2
+FILE=$3
+
+
+sed -i "s|out = NULL|out = ${OUT}|g" $FILE
+
+sed -i "s|log = NULL|log = ${LOG}|g" $FILE
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PLIDflow/separate_chain_plidflow.xml	Tue Jan 14 07:52:48 2020 -0500
@@ -0,0 +1,18 @@
+<tool id="separate_chain_plidflow" name="PLIDflow: Separate Chains">
+  <description>Separates chains from a PDB into multiple files</description>
+  <inputs>
+	  <param name="pdb" type="data" format="pdb" label="PDB file" help="PDB file to be separated into chains"/>
+  </inputs>
+  <command><![CDATA[
+	  
+	  ${__tool_directory__}/scripts/separateChain.sh ${pdb};
+	  
+  
+	]]></command>
+  <outputs>
+	  <data name="Chains" format="pdb">
+		       <discover_datasets pattern="(?P&lt;designation&gt;.+)\.pdb" format="pdb" directory="." visible="true" />
+		  <!-- <discover_datasets pattern="(chain)([a-zA-Z0-9]+)[.](pdb)" format="pdb" directory="." visible="true" /> -->
+          </data>
+  </outputs>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PLIDflow/vina_plidflow.xml	Tue Jan 14 07:52:48 2020 -0500
@@ -0,0 +1,11 @@
+<tool id="vina_plidflow" name="PLIDflow: Vina">
+  <description>is an open-source program for doing molecular docking.</description>
+  <inputs>
+	  <param name="configvina" type="data" format="csv" label="Config Vina File" help="Vina uses the same PDBQT molecular structure file format used by AutoDock for binding mode predictions."/>
+  </inputs>
+  <command>${__tool_directory__}/scripts/vinaoutpututility.sh $outfile $outlog $configvina ; vina --config $configvina</command>
+  <outputs>
+    <data name="outfile" format="csv" label="PDB out"/>
+    <data name="outlog" format="csv" label="OUt log"/>
+  </outputs>
+</tool>