annotate PLIDflow/scripts/pdbqtcorrector2step.R @ 6:795e11fac81b draft default tip

Included new tools for standardization
author bitlab
date Wed, 22 Apr 2020 06:12:00 -0400
parents 6fcfa4756040
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1 #pdbqtcorrector2step.R prepare the out PDBQT file from pdbqtcorrector.R to run Vina
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
2
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
3 #!/usr/bin/env Rscript
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
4 args = commandArgs(trailingOnly=TRUE)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
5
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
6 if(length(args) < 2){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
7 stop("USE: Rscript pdbqtcorrector.R <receptor_name> <galaxy_file_pdbqt> <receptor_types>")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
8 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
9
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
10 #Argument definition
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
11 receptor_name <- args[1]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
12 receptor_types_file_out <- args[3]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
13
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
14 #Scan file
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
15 original_file <- scan(args[1], what = character(), quiet = TRUE, na.strings = "NULLAJSKAJSFL")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
16
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
17 #13FEB2019
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
18 #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 " "
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
19
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
20 buscador <- c()
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
21 for(of in 1:length(original_file)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
22 buscador <- c(buscador,strsplit(original_file[of], ""))
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
23 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
24
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
25 fix_row_1 <- 0
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
26 for(off in 1:length(buscador)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
27 if(buscador[[off]][1] == "A"){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
28 if(length(buscador[[off]]) >= 3){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
29 if(buscador[[off]][2] == "T"){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
30 if(buscador[[off]][3] == "O"){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
31 if(buscador[[off]][4] == "M"){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
32 fix_row_1 <- fix_row_1 + 1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
33 buscador[[off]][1] <- paste(buscador[[off]][1], buscador[[off]][2], buscador[[off]][3], buscador[[off]][4], sep = "")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
34 if(length(buscador[[off]]) == 4){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
35 for(off1 in 2:length(buscador[[off]])){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
36 buscador[[off]][off1] <- ""
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
37 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
38 for(qu in 1:(length(buscador[[off]])-1)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
39 buscador[[off]] <- buscador[[off]][-length(buscador[[off]])]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
40
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
41
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
42 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
43 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
44 if(length(buscador[[off]]) > 4){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
45 var_aux <- c()
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
46 for(off1 in 5:length(buscador[[off]])){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
47 var_aux <- c(var_aux, paste(buscador[[off]][off1]))
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
48 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
49 termino <- var_aux[1]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
50 for(ofu in 2:length(var_aux)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
51 termino <- paste(termino, var_aux[ofu], sep = "")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
52 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
53
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
54 buscador[[off]][2] <- termino
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
55
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
56 for(off1 in 3:length(buscador[[off]])){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
57 buscador[[off]][off1] <- ""
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
58 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
59 for(qu in 2:(length(buscador[[off]])-1)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
60 buscador[[off]] <- buscador[[off]][-length(buscador[[off]])]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
61
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
62
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
63 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
64 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
65 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
66 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
67 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
68 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
69 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
70 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
71 #print(fix_row_1)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
72
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
73
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
74 fix_row_2 <- 0
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
75 for(off in 1:length(buscador)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
76 if(buscador[[off]][1] == "H"){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
77 if(length(buscador[[off]]) >= 3){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
78 if(buscador[[off]][2] == "E"){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
79 if(buscador[[off]][3] == "T"){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
80 if(buscador[[off]][4] == "A"){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
81 if(buscador[[off]][5] == "T"){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
82 if(buscador[[off]][6] == "M"){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
83 fix_row_2 <- fix_row_2 + 1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
84 buscador[[off]][1] <- paste(buscador[[off]][1], buscador[[off]][2], buscador[[off]][3], buscador[[off]][4], buscador[[off]][5], buscador[[off]][6], sep = "")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
85 if(length(buscador[[off]]) == 6){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
86 for(off1 in 2:length(buscador[[off]])){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
87 buscador[[off]][off1] <- ""
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
88 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
89 for(qu in 1:(length(buscador[[off]])-1)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
90 buscador[[off]] <- buscador[[off]][-length(buscador[[off]])]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
91
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
92
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
93 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
94 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
95 if(length(buscador[[off]]) > 6){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
96 var_aux <- c()
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
97 for(off1 in 7:length(buscador[[off]])){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
98 var_aux <- c(var_aux, paste(buscador[[off]][off1]))
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
99 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
100 termino <- var_aux[1]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
101 for(ofu in 2:length(var_aux)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
102 termino <- paste(termino, var_aux[ofu], sep = "")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
103 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
104
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
105 buscador[[off]][2] <- termino
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
106
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
107 for(off1 in 3:length(buscador[[off]])){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
108 buscador[[off]][off1] <- ""
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
109 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
110
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
111 for(qu in 2:(length(buscador[[off]])-1)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
112 buscador[[off]] <- buscador[[off]][-length(buscador[[off]])]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
113 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
114 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
115 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
116 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
117 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
118 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
119 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
120 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
121 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
122 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
123 #print(fix_row_2)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
124
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
125 fix_row_3 <- 0
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
126 for(off in 1:length(buscador)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
127 if(buscador[[off]][1] == "T"){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
128 if(length(buscador[[off]]) >= 3){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
129 if(buscador[[off]][2] == "E"){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
130 if(buscador[[off]][3] == "R"){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
131 fix_row_3 <- fix_row_3 + 1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
132 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
133 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
134 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
135 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
136 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
137 #print(fix_row_3)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
138
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
139 final_row <- fix_row_1 + fix_row_2 + fix_row_3
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
140
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
141 #counter <- final_row
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
142 #print(counter)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
143
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
144 # At this point roots "ATOM", "HETATM" and "TER" are isolated in case fusion. This step component differrent for those are pasted
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
145 for(off in 1:length(buscador)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
146 if(as.character(buscador[[off]][1]) != "ATOM" && buscador[[off]][1] != "HETATM"){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
147 #print(off)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
148 pegado <- buscador[[off]][1]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
149 for(fus in 2:length(buscador[[off]])){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
150 if(length(buscador[[off]]) > 1){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
151 pegado <- paste(pegado, buscador[[off]][fus], sep = "")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
152 buscador[[off]][1] <- pegado
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
153 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
154 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
155 if(length(buscador[[off]]) > 1){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
156 for(qu in 1:(length(buscador[[off]])-1)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
157 buscador[[off]] <- buscador[[off]][-length(buscador[[off]])]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
158 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
159 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
160 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
161 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
162
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
163
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
164 # strsplit applied to the original_file return a list format. In this steps it is for changing list for vector format for buscador varible
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
165
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
166 total_original_file <- c()
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
167 for(si in 1:length(buscador)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
168 total_original_file <- c(total_original_file, buscador[[si]])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
169 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
170 #13feb2019
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
171
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
172 original_file <- total_original_file
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
173
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
174 #Starts pdbqtcorrector
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
175
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
176 #Calculate first root word and "TER"
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
177 for(e in 1:length(original_file)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
178 if(original_file[e] == "ATOM" || original_file[e] == "HETATM" || original_file[e] == "TER"){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
179 k <- e
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
180 break
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
181 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
182 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
183
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
184 #Calculate the row number for table which conteins aligned x,y,z coordenates
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
185 counter <- 0
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
186 for(c in e:length(original_file)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
187 if(original_file[c] == "ATOM" || original_file[c] == "HETATM" || original_file[c] == "TER"){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
188 counter <- counter + 1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
189 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
190 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
191
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
192 #Table to be fills in named tabla_ordenados
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
193 tabla_ordenados <- matrix(1, nrow = (counter), ncol = 13)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
194
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
195 #Calculate TER times and make a vector
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
196 ele_ter_vector <- 1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
197 ter_vector <- c()
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
198 k_position <- c()
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
199 #ter_pos <- 0 #21sep2018
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
200 for(o in 1:(length(original_file))){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
201 if(original_file[o] =="TER"){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
202 k_position <- c(k_position, o)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
203 ter_pos <- o #21sep
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
204 for(g in o:(o+4)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
205 ter_vector <- c(ter_vector,original_file[g] )
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
206 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
207
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
208 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
209 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
210
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
211
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
212 #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
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
213 for(i in 1:(counter-1)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
214 for(j in 1:13){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
215 tabla_ordenados[i,j] <- original_file[k]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
216 if(tabla_ordenados[i,13]=="ATOM" || tabla_ordenados[i,13]== "HETATM"|| tabla_ordenados[i,13]=="TER"){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
217 corte <- c()
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
218 for(v in 4:12){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
219 corte <- c(corte,tabla_ordenados[i,v])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
220 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
221 coo_corte <- 1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
222 tabla_ordenados[i,4] <- ""
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
223 for(m in 5:13){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
224 tabla_ordenados[i,m] <- corte[coo_corte]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
225 coo_corte <- coo_corte + 1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
226 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
227 k <- k-1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
228 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
229 # #################02julio2019################################
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
230
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
231 if(tabla_ordenados[i,12]=="ATOM" || tabla_ordenados[i,12]== "HETATM"|| tabla_ordenados[i,12]=="TER"){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
232
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
233
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
234 #print("ENTERING")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
235 #stop()
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
236
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
237 corte_2 <- c()
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
238 for(iv in 5:11){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
239 corte_2 <- c(corte_2,tabla_ordenados[i,iv])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
240 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
241
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
242 #print(corte_2)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
243
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
244 first_number <- substr(corte_2[5], 1, 4)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
245 second_number <- substr(corte_2[5], 5, 1000)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
246
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
247
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
248
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
249 coo_corte_2 <- 1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
250 tabla_ordenados[i,5] <- ""
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
251 tabla_ordenados[i,12] <- ""
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
252 tabla_ordenados[i,13] <- ""
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
253 for(im in 6:13){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
254 tabla_ordenados[i,im] <- corte_2[coo_corte_2]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
255 coo_corte_2 <- coo_corte_2 + 1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
256 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
257 k <- k-2
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
258
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
259 tabla_ordenados[i,12] <- corte_2[6]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
260 tabla_ordenados[i,10] <- first_number
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
261 tabla_ordenados[i,11] <- second_number
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
262
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
263
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
264
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
265
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
266 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
267
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
268
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
269
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
270 #################02julio2019################################
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
271
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
272
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
273 k <- k + 1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
274 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
275 if(tabla_ordenados[i,1]=="TER"){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
276 k <- k - 8
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
277 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
278 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
279
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
280 #Fill in TER row until last one
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
281 star_ter <- 2
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
282 mmm <- 1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
283 for(ii in 1:counter){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
284 if(tabla_ordenados[ii,1]=="TER"){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
285 k <- k_position[mmm] + 4
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
286 mmm <- mmm + 1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
287 y <- 2
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
288 for(l in star_ter:(star_ter+3)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
289 if(y%%3==0 && y!=6){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
290 tabla_ordenados[ii,y] <- ""
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
291 y <- y + 1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
292 tabla_ordenados[ii,y] <- ter_vector[l]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
293 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
294 tabla_ordenados[ii,y] <- ter_vector[l]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
295 y <- y +1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
296 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
297 star_ter <- star_ter + 5
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
298 for(b in 7:13){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
299 tabla_ordenados[ii,b] <- ""
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
300 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
301 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
302 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
303
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
304 ##Fill if last row is not TER root
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
305 if(ter_pos < (length(original_file)-14)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
306 tpnt <- 0
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
307 ntn <- length(original_file) - 12
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
308 for(jnt in 1:13){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
309 tabla_ordenados[nrow(tabla_ordenados),jnt] <- original_file[ntn]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
310
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
311 ntn <- ntn + 1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
312 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
313 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
314
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
315 ##Fill in last row with TER row values ##
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
316 #ajustcel4 <-0
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
317 if(ter_pos > (length(original_file)-14)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
318 for(rtv in 1:length(ter_vector)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
319 ajustcel4 <- rtv #14nov2018
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
320 if(is.na(ter_vector[rtv])){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
321 ajustcel4 <- rtv - 1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
322 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
323 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
324
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
325 ter_vector_numeric <- strsplit(ter_vector[ajustcel4], "")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
326
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
327 last_ter <- length(ter_vector)-4
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
328 if(length(ter_vector_numeric[[1]]) != 1){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
329 if(length(ter_vector) < 5){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
330
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
331 for(jj in 1:6){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
332 tabla_ordenados[counter,jj] <- ter_vector[last_ter]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
333
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
334 if(jj%%3==0 && jj !=6 || jj == 4){ #he incluido el jj == 4
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
335 tabla_ordenados[counter, jj] <- ""
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
336 last_ter <- last_ter - 1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
337 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
338 last_ter <- last_ter + 1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
339 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
340 for(jj in 7:13){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
341 tabla_ordenados[counter, jj] <- ""
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
342 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
343 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
344
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
345 if(length(ter_vector) >= 5){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
346 for(jj in 1:7){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
347 tabla_ordenados[counter,jj] <- ter_vector[last_ter]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
348 if(jj%%3==0 && jj !=6){ #he incluido el jj == 4
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
349 tabla_ordenados[counter, jj] <- ""
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
350 last_ter <- last_ter -1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
351 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
352 last_ter <- last_ter + 1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
353 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
354 for(jj in 8:13){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
355 tabla_ordenados[counter, jj] <- ""
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
356 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
357 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
358 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
359
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
360 if(length(ter_vector_numeric[[1]]) == 1){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
361 if(length(ter_vector) <= 5){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
362
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
363 for(jj in 1:6){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
364 tabla_ordenados[counter,jj] <- ter_vector[last_ter]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
365
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
366 if(jj%%3==0 && jj !=6 ){ #he incluido el jj == 4
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
367 tabla_ordenados[counter, jj] <- ""
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
368 last_ter <- last_ter - 1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
369 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
370 last_ter <- last_ter + 1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
371 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
372 for(jj in 7:13){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
373 tabla_ordenados[counter, jj] <- ""
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
374 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
375 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
376
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
377 if(length(ter_vector) > 5){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
378 for(jj in 1:7){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
379 tabla_ordenados[counter,jj] <- ter_vector[last_ter]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
380 if(jj%%3==0 && jj !=6){ #he incluido el jj == 4
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
381 tabla_ordenados[counter, jj] <- ""
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
382 last_ter <- last_ter -1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
383 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
384 last_ter <- last_ter + 1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
385 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
386 for(jj in 8:13){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
387 tabla_ordenados[counter, jj] <- ""
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
388 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
389 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
390 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
391
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
392 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
393
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
394
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
395 #View(tabla_ordenados)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
396
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
397 #19octubre2018
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
398
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
399 #listacol11 <- matrix(0, nrow = nrow(tabla_ordenados), ncol = 1)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
400 twopoint <- c()
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
401 for(dc11 in 1:nrow(tabla_ordenados)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
402 listacol11 <-strsplit(tabla_ordenados[dc11,11], "")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
403
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
404 if(length(listacol11[[1]]) != 0){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
405 num_poin <- 0
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
406 for(findpoint in 1:length(listacol11[[1]])){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
407 if(listacol11[[1]][findpoint] == "."){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
408 num_poin <- num_poin + 1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
409 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
410 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
411 if(num_poin == 2){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
412 twopoint <- c(twopoint, dc11)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
413 unopto0 <- listacol11[[1]][1]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
414 dospto0 <- listacol11[[1]][5]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
415 for(div1pto in 2:4){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
416 unopto0 <- paste(unopto0, listacol11[[1]][div1pto], sep = "")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
417 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
418 for(div2pto in 6:length(listacol11[[1]])){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
419 dospto0 <- paste(dospto0, listacol11[[1]][div2pto], sep = "")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
420 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
421 #19oct2018 Voy a guardar cada fila en un vector para luego pegarlo
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
422 vec_guarfilas <- c()
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
423 for(vgf in 1:10){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
424
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
425 if(tabla_ordenados[dc11,vgf] != ""){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
426 vec_guarfilas <- c(vec_guarfilas, tabla_ordenados[dc11,vgf])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
427 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
428 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
429 vec_guarfilas[10] <- unopto0
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
430 vec_guarfilas[11] <- dospto0
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
431 vec_guarfilas[12] <- tabla_ordenados[dc11,12]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
432 vec_guarfilas[13] <- tabla_ordenados[dc11,13]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
433
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
434 #print(vec_guarfilas)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
435 for(mvc in 1:13){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
436 tabla_ordenados[dc11,mvc] <- vec_guarfilas[mvc]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
437 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
438
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
439 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
440 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
441 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
442
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
443 #View(tabla_ordenados)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
444 #acaba 19octubre2018
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
445
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
446
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
447
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
448 #Make a table containing for each cell the number of characters for each for the tabla_ordenados
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
449 tabla_ordenados_numcarac <- matrix(1, nrow = nrow(tabla_ordenados), ncol = ncol(tabla_ordenados))
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
450
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
451 for(i in 1:nrow(tabla_ordenados)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
452 for(j in 1:ncol(tabla_ordenados)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
453 caracteres <- strsplit(tabla_ordenados[i,j], "")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
454 num_carac <- 0
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
455 # if(tabla_ordenados[i,j] == ""){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
456 # num_carac <- ""
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
457 # }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
458 #if(tabla_ordenados[i,j] != ""){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
459 for(k in 1:length(caracteres[[1]])){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
460 num_carac <- num_carac + 1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
461 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
462 tabla_ordenados_numcarac[i,j] <- num_carac
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
463 #}
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
464 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
465 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
466 #View(tabla_ordenados_numcarac) #27mar2019
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
467
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
468 #################03julio2019###################3 ##
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
469
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
470 for(i in 1:nrow(tabla_ordenados)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
471
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
472 if(tabla_ordenados_numcarac[i,4] == 2 && tabla_ordenados_numcarac[i,5] == 3){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
473 cambio_posicion5 <- tabla_ordenados[i,5]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
474 tabla_ordenados[i,5] <- ""
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
475 tabla_ordenados_numcarac[i,5] <- 2
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
476 tabla_ordenados[i,4] <- cambio_posicion5
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
477 tabla_ordenados_numcarac[i,4] <- 3
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
478 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
479 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
480
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
481 for(i in 1:nrow(tabla_ordenados)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
482 if(tabla_ordenados_numcarac[i,5] == 2 && tabla_ordenados_numcarac[i,6] == 5){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
483 Aaposicion5 <- substr(tabla_ordenados[i,6], 1, 1)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
484 cambio_posicion5 <- substr(tabla_ordenados[i,6], 2, 5)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
485 tabla_ordenados[i,5] <- Aaposicion5
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
486 tabla_ordenados_numcarac[i,5] <- 1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
487 tabla_ordenados[i,6] <- cambio_posicion5
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
488 tabla_ordenados_numcarac[i,6] <- 4
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
489 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
490 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
491
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
492 for(i in 1:nrow(tabla_ordenados)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
493 if(tabla_ordenados[i, 3] < 6 && tabla_ordenados[i, 4] == ""){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
494 tabla_ordenados[i, 4] <- "XX"
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
495 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
496 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
497
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
498 #################03julio2019###################3 ##
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
499
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
500 # &&&&& 03sep2019 &&&&&&&&&&&&
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
501 if(tabla_ordenados_numcarac[counter,5] >= 5){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
502 ter_5_col <- substr(tabla_ordenados[counter, 5], 1, 1)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
503 ter_6_col <- substr(tabla_ordenados[counter, 5], 2, 1000)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
504
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
505
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
506 tabla_ordenados[counter, 5] <- ter_5_col
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
507 tabla_ordenados[counter, 6] <- ter_6_col
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
508 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
509
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
510 # &&&&& 03sep2019 &&&&&&&&&&&&
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
511
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
512
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
513 ####····̣# &&&&& 30oct2019 &&&&&&&&&&&&
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
514 for(ac3 in 1:counter){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
515 if(tabla_ordenados_numcarac[ac3,3] >= 7){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
516 ter_3_col <- substr(tabla_ordenados[ac3, 3], 1, 4)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
517 ter_4_col <- substr(tabla_ordenados[ac3, 3], 5, 1000)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
518
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
519
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
520 tabla_ordenados[ac3, 3] <- ter_3_col
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
521 tabla_ordenados[ac3, 4] <- ter_4_col
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
522 tabla_ordenados_numcarac[ac3, 3] <- 4
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
523 tabla_ordenados_numcarac[ac3, 4] <- 3
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
524 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
525
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
526 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
527
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
528 ####····̣# &&&&& 30oct2019 &&&&&&&&&&&&
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
529
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
530
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
531
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
532
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
533
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
534 #:;:;:;:;:;:;:;:;________09septiembre2019. Remove line with "Na" in column 13 in tabla_ordenados and tabla_ordenados_numcarac
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
535
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
536 # quitar_fila <- 0
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
537 # for(ena in 1:counter){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
538 # if(tabla_ordenados[ena,13] == "Na"){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
539 # print(ena)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
540 # tabla_ordenados_numcarac <- tabla_ordenados_numcarac[-ena,]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
541 # ena <- ena - 1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
542 # quitar_fila <- quitar_fila + 1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
543 # counter <- counter - quitar_fila
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
544 #
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
545 # }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
546 # }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
547 #
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
548 # tabla_ordenados <- subset(tabla_ordenados, tabla_ordenados[,13] != "Na")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
549
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
550 #:;:;:;:;:;:;:;:;________09septiembre2019
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
551
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
552 #View(tabla_ordenados)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
553 #View(tabla_ordenados_numcarac)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
554
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
555
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
556
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
557
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
558 #Fit spaces for write()
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
559 #Fit spaces for write()
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
560 #Pairwise 1col-2col con 1col == "ATOM"
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
561
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
562 for(i in 1:nrow(tabla_ordenados)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
563 linea <- c()
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
564 if(tabla_ordenados_numcarac[i,1] == 4){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
565 num_espacios <- 6
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
566 ajuste <- 0
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
567 for(a in 1:(tabla_ordenados_numcarac[i,2])){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
568 if(a != tabla_ordenados_numcarac[i,2]){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
569 ajuste <- ajuste + 1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
570 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
571 if(a == tabla_ordenados_numcarac[i,2]){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
572 espacios <- rep(" ", num_espacios-ajuste)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
573 linea <- c(espacios, tabla_ordenados[i,2])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
574 break
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
575 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
576 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
577 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
578
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
579 #1col == HETATM INI
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
580 if(tabla_ordenados_numcarac[i,1] == 6){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
581 num_espacios <- 4
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
582 ajuste <- 0
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
583 for(a in 1:(tabla_ordenados_numcarac[i,2])){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
584 if(a != tabla_ordenados_numcarac[i,2]){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
585 ajuste <- ajuste + 1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
586 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
587 if(a == tabla_ordenados_numcarac[i,2]){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
588 espacios <- rep(" ", num_espacios-ajuste)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
589 linea <- c(espacios, tabla_ordenados[i,2])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
590
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
591 ###21feb2019
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
592 if(tabla_ordenados_numcarac[i,2] == 5){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
593 espacios <- rep(" ", (num_espacios-ajuste) + 1)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
594 linea <- c(espacios, tabla_ordenados[i,2])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
595 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
596 ###21feb2019
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
597
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
598 break
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
599 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
600 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
601 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
602 #1col == HETATM FIN
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
603
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
604 ##1col == TER INICIO
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
605 if(tabla_ordenados_numcarac[i,1] == 3){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
606 num_espacios <- 7
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
607 ajuste <- 0
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
608 for(a in 1:(tabla_ordenados_numcarac[i,2])){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
609 if(a != tabla_ordenados_numcarac[i,2]){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
610 ajuste <- ajuste + 1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
611 espacios <- rep(" ", num_espacios-ajuste)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
612 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
613 if(a == tabla_ordenados_numcarac[i,2]){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
614 espacios <- rep(" ", num_espacios-ajuste)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
615 linea <- c(espacios, tabla_ordenados[i,2])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
616 break
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
617 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
618 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
619 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
620 ##1col == TER FIN
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
621
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
622 ##Pairwise 2col-3col
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
623 linea2 <- c()
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
624 for(b in 1:(tabla_ordenados_numcarac[i,3])){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
625 if(b < 4){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
626 espacios2 <- rep(" ", 2)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
627 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
628 if(b >= 4){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
629 if(tabla_ordenados[i,4] == ""){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
630 espacios2 <- rep(" ", 2)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
631 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
632
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
633 if(tabla_ordenados[i,4]!= ""){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
634 espacios2 <- rep(" ", 1)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
635 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
636 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
637 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
638
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
639 if(tabla_ordenados_numcarac[i,3] >= 8){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
640 e_espacios2 <- length(espacios2)-1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
641 espacios2 <- rep(" ",e_espacios2)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
642
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
643
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
644 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
645
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
646 linea2 <- c(linea, espacios2, tabla_ordenados[i,3])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
647
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
648 ###21feb2019
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
649 if(tabla_ordenados_numcarac[i,1] == 6 && tabla_ordenados_numcarac[i,2] == 5){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
650 espacios2 <- espacios2[-length(espacios2)]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
651 linea2 <- c(linea, espacios2, tabla_ordenados[i,3])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
652 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
653 ###21feb2019
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
654
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
655 ###Pairwise 3col-4col
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
656 linea3 <- c()
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
657
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
658 for(c in 1:(tabla_ordenados_numcarac[i,4])){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
659
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
660 #28nov
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
661 if(c == 2){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
662 if(tabla_ordenados_numcarac[i,1] == 6 && tabla_ordenados_numcarac[i,3] == 1){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
663 espacios3 <- rep(" ", 2)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
664 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
665 if(tabla_ordenados_numcarac[i,1] == 6 && tabla_ordenados_numcarac[i,3] == 2){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
666 espacios3 <- rep(" ", 1)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
667 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
668 if(tabla_ordenados_numcarac[i,1] == 6 && tabla_ordenados_numcarac[i,3] == 2 && tabla_ordenados_numcarac[i,5] == 1){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
669 espacios3 <- rep(" ", 3)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
670 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
671
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
672 #########21junio2019
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
673
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
674 if(tabla_ordenados_numcarac[i,1] == 4 && tabla_ordenados_numcarac[i,3] == 1 && tabla_ordenados_numcarac[i,6] == 5){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
675 espacios3 <- rep(" ", 2)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
676 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
677 if(tabla_ordenados_numcarac[i,1] == 4 && tabla_ordenados_numcarac[i,3] == 2 && tabla_ordenados_numcarac[i,6] == 5){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
678 espacios3 <- rep(" ", 1)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
679 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
680
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
681 ########21junio2019
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
682
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
683
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
684
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
685
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
686 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
687 #28nov. Hace falta corregir para el resto de HETATM
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
688
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
689
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
690 if(c == 3){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
691 if(b == 1){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
692 espacios3 <- rep(" ", 3)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
693 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
694 if(b == 2){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
695 espacios3 <- rep(" ", 2)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
696 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
697 if(b >= 3){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
698 espacios3 <- rep(" ", 1)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
699 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
700 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
701 if(c == 4){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
702 if(b == 1){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
703 espacios3 <- rep(" ", 2)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
704 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
705 if(b >= 2){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
706 espacios3 <- rep(" ", 1)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
707 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
708 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
709 #27mar2019 ######################################
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
710 if(c == 5){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
711 if(b >= 2){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
712 espacios3 <- rep("", 1)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
713 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
714 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
715 #27mar2019 ######################################
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
716 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
717
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
718 linea3 <- c(linea2, espacios3, tabla_ordenados[i,4])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
719 ####03julio2019####################### #####################
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
720 # 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){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
721 # linea3 <- c(linea2, " ", tabla_ordenados[i,4])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
722 # }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
723 ####03julio2019####################### #####################
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
724
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
725 #TER
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
726 if(tabla_ordenados_numcarac[i,1] == 3){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
727 num_espacios4 <- 8
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
728 ajuste_t1 <- 0
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
729 for(l in 1:tabla_ordenados_numcarac[i,4]){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
730 if(l != tabla_ordenados_numcarac[i,4]){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
731 ajuste_t1 <-ajuste_t1 + 1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
732 num_espacios4 <- 8 - ajuste_t1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
733 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
734 if(l == tabla_ordenados_numcarac[i,4]){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
735 num_espacios4 <- 8 - ajuste_t1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
736 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
737 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
738 linea3 <- c(linea, rep(" ", num_espacios4), tabla_ordenados[i,4])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
739
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
740 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
741
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
742 ####Pairwise 4col-5col
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
743 linea4 <- c()
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
744 if(tabla_ordenados_numcarac[i,1] != 3){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
745 if(tabla_ordenados_numcarac[i,3] >= 7){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
746 linea4 <- c(linea3, tabla_ordenados[i,5])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
747 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
748 if(tabla_ordenados_numcarac[i,3] < 7){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
749 linea4 <- c(linea3, " ", tabla_ordenados[i,5])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
750 ###18oct2018
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
751 if(tabla_ordenados_numcarac[i,3] >= 3 && tabla_ordenados[i,4] == ""){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
752 linea4 <- c(linea2, " ", tabla_ordenados[i,5])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
753 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
754 ###18oct2018
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
755 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
756 #------------29julio2019--------------------#
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
757
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
758 if(isTRUE(tabla_ordenados[i,3] == "NA") && tabla_ordenados[i,4] == ""){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
759 linea4 <- c(linea2, rep(" ", 6), tabla_ordenados[i,5])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
760 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
761
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
762
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
763 #------------29julio2019--------------------#
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
764 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
765
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
766
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
767
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
768
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
769 if(tabla_ordenados_numcarac[i,1] == 3){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
770
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
771 linea4 <- c(linea3, " ", tabla_ordenados[i,5])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
772 ##
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
773 if(tabla_ordenados[i,4] == ""){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
774 linea4 <- c(linea2,rep(" ", 4),tabla_ordenados[i,5])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
775 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
776
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
777 ##
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
778
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
779
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
780 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
781
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
782 #####Pairwise 5col-6col. NO espacios4
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
783 if(tabla_ordenados_numcarac[i,1] != 3){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
784 linea5 <-c()
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
785 for(d in 1:(tabla_ordenados_numcarac[i,6])){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
786 if(d == 1){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
787 espacios5 <- rep(" ", 3)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
788 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
789 if(d == 2){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
790 espacios5 <- rep(" ", 2)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
791 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
792 if(d >= 3){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
793 espacios5 <- rep(" ", 1)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
794 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
795
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
796 ##################21junio2109#############
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
797
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
798 if(tabla_ordenados_numcarac[i,3] == 2 && tabla_ordenados_numcarac[i,5] == 2 && tabla_ordenados_numcarac[i,6] == 5){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
799 espacios5 <- rep(" ", 2)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
800 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
801
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
802 ##################21junio2109#############
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
803 ###########03julio################ ############
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
804 # 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){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
805 #
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
806 # espacios5 <- ""
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
807 # }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
808
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
809 ###########03julio################ ############
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
810
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
811
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
812 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
813 linea5 <- c(linea4, espacios5, tabla_ordenados[i,6])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
814
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
815
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
816 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
817 if(tabla_ordenados_numcarac[i,1] == 3){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
818 for(dd in 1:(tabla_ordenados_numcarac[i,6])){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
819 if(dd == 1){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
820 espacios55 <- rep(" ", 3)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
821 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
822
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
823 #14nov
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
824 if(dd == 1 && tabla_ordenados_numcarac[i,5] == 3){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
825 espacios55 <- rep(" ", 1)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
826 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
827 #14nov
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
828
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
829 if(dd == 2){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
830 espacios55 <- rep(" ", 2)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
831 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
832 if(dd >= 3){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
833 espacios55 <- rep(" ", 1)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
834 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
835
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
836
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
837 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
838 linea5 <- c(linea4, espacios55, tabla_ordenados[i,6])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
839
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
840 #------------------05sep2019------------#
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
841
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
842 if(tabla_ordenados_numcarac[i,6] == 1 && tabla_ordenados_numcarac[i,5] >= 5){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
843 espacios55 <- rep(" ", 1)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
844 linea5 <- c(linea4, espacios55, tabla_ordenados[i,6])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
845 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
846
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
847 #------------------05sep2019------------#
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
848
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
849 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
850
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
851
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
852
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
853
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
854 ######Pairwise 6col-7col
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
855 linea6 <- c()
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
856 if(tabla_ordenados_numcarac[i,7] == 5){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
857 espacios6 <- rep(" ", 7)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
858 linea6 <-c(linea5, espacios6, tabla_ordenados[i,7])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
859
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
860 ###################21junio2109#################
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
861 if(tabla_ordenados_numcarac[i,3] == 4 && tabla_ordenados_numcarac[i,6] == 5){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
862 espacios6 <- rep(" ", 6)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
863 linea6 <-c(linea5, espacios6, tabla_ordenados[i,7])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
864 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
865
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
866 ###################21junio2109#################
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
867
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
868 ## 03julio2019 #########
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
869
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
870 if(tabla_ordenados_numcarac[i,6] == 4 && tabla_ordenados_numcarac[i,6] == 4){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
871 espacios6 <- rep(" ", 6)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
872 linea6 <-c(linea5, espacios6, tabla_ordenados[i,7])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
873 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
874
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
875 ## 03julio2019 #########
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
876
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
877
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
878 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
879
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
880 if(tabla_ordenados_numcarac[i,7] > 5){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
881 out_spaces <- tabla_ordenados_numcarac[i,7] - 5
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
882 espacios6 <- rep(" ", (7-out_spaces))
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
883 linea6 <-c(linea5, espacios6, tabla_ordenados[i,7])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
884
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
885 ###################21junio2109#################
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
886 if(tabla_ordenados_numcarac[i,3] == 4 && tabla_ordenados_numcarac[i,6] == 5){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
887 out_spaces <- tabla_ordenados_numcarac[i,7] - 4
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
888 espacios6 <- rep(" ", (7-out_spaces))
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
889 linea6 <-c(linea5, espacios6, tabla_ordenados[i,7])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
890 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
891
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
892 ###################21junio2109#################
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
893 ## 03julio2019 #########
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
894
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
895 if(tabla_ordenados_numcarac[i,6] == 4 && tabla_ordenados_numcarac[i,6] == 4){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
896 out_spaces_2 <- tabla_ordenados_numcarac[i,7] - 4
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
897 espacios6 <- rep(" ", (7-out_spaces_2))
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
898 linea6 <-c(linea5, espacios6, tabla_ordenados[i,7])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
899 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
900
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
901 ## 03julio2019 #########
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
902
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
903
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
904 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
905
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
906 ######################################27mar2019
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
907 #
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
908 # if(tabla_ordenados_numcarac[i,4] == 5){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
909 # espacios6 <- rep(" ",5)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
910 # linea6 <-c(linea5, espacios6, tabla_ordenados[i,7])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
911 # }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
912 #
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
913 # if(tabla_ordenados_numcarac[i,4] > 5){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
914 # espacios6 <- rep(" ",4)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
915 # linea6 <-c(linea5, espacios6, tabla_ordenados[i,7])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
916 # }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
917
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
918 ######################################27mar2019
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
919
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
920
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
921 #######Pairwise 7col-8col
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
922 linea7 <- c()
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
923 ajuste3 <- 0
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
924 if(tabla_ordenados_numcarac[i,8] == 5){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
925 espacios7 <- rep(" ", 3)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
926 linea7 <-c(linea6, espacios7, tabla_ordenados[i,8])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
927 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
928 if(tabla_ordenados_numcarac[i,8] == 6){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
929 espacios7 <- rep(" ", 2)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
930 linea7 <-c(linea6, espacios7, tabla_ordenados[i,8])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
931 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
932 if(tabla_ordenados_numcarac[i,8] > 6){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
933 espacios7 <- rep(" ", 1)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
934 linea7 <-c(linea6, espacios7, tabla_ordenados[i,8])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
935 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
936
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
937 ########Pairwise 8col-9col
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
938 linea8 <- c()
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
939 ajuste4 <- 0
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
940 if(tabla_ordenados_numcarac[i,9] == 5){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
941 espacios8 <- rep(" ", 3)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
942 linea8 <-c(linea7, espacios8, tabla_ordenados[i,9])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
943 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
944 if(tabla_ordenados_numcarac[i,9] == 6){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
945 espacios8 <- rep(" ", 2)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
946 linea8 <-c(linea7, espacios8, tabla_ordenados[i,9])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
947 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
948 if(tabla_ordenados_numcarac[i,9] > 6){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
949 espacios8 <- rep(" ", 1)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
950 linea8 <-c(linea7, espacios8, tabla_ordenados[i,9])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
951 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
952
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
953 #########Pairwise 9col-10col
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
954 linea9 <- c()
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
955 if(tabla_ordenados_numcarac[i,10] == 4){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
956 espacios9 <- rep(" ", 2)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
957 linea9 <- c(linea8, espacios9, tabla_ordenados[i,10])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
958 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
959 if(tabla_ordenados_numcarac[i,10] > 4){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
960 espacios9 <- rep(" ", 1)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
961 linea9 <- c(linea8, espacios9, tabla_ordenados[i,10])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
962 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
963
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
964 ##########Pairwise 10col-11col
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
965 # linea10 <- c()
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
966 # if(tabla_ordenados_numcarac[i,11] == 4){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
967 # espacios10 <- rep(" ", 2)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
968 # linea10 <- c(linea9, espacios10, tabla_ordenados[i,11])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
969 # }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
970 # if(tabla_ordenados_numcarac[i,11] > 4){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
971 # espacios10 <- rep(" ", 1)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
972 # linea10 <- c(linea9, espacios10, tabla_ordenados[i,11])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
973 # }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
974 #22oct2018
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
975 ##########Pairwise 10col-11col
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
976 linea10 <- c()
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
977 if(tabla_ordenados_numcarac[i,11] == 4){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
978 espacios10 <- rep(" ", 3)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
979 linea10 <- c(linea9, espacios10, tabla_ordenados[i,11])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
980 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
981 if(tabla_ordenados_numcarac[i,11] == 5){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
982 espacios10 <- rep(" ", 2)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
983 linea10 <- c(linea9, espacios10, tabla_ordenados[i,11])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
984 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
985
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
986 if(tabla_ordenados_numcarac[i,11] > 5){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
987 espacios10 <- rep(" ", 1)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
988 linea10 <- c(linea9, espacios10, tabla_ordenados[i,11])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
989 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
990 #22oct2018
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
991
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
992
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
993 ###########Pairwise 11col-12col
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
994 linea11 <- c()
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
995 if(tabla_ordenados_numcarac[i,12] == 5){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
996 espacios11 <- rep(" ", 5)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
997 linea11 <-c(linea10, espacios11, tabla_ordenados[i,12])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
998 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
999 ajuste5 <- 0
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1000 for(h in 6:tabla_ordenados_numcarac[i,12]){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1001 if(tabla_ordenados_numcarac[i,12] > 5){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1002 ajuste5 <- ajuste5 + 1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1003 espacios11 <- rep(" ", (5-ajuste5))
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1004 ##espacios11 <- rep(" ", (5-ajuste5))
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1005 linea11 <-c(linea10, espacios11, tabla_ordenados[i,12])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1006 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1007 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1008
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1009 ############Pairwise 12col-13col
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1010 linea12 <- c(linea11," ", tabla_ordenados[i,13])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1011
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1012 #TER
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1013 if(tabla_ordenados_numcarac[i,1] == 3){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1014 cabecera <- tabla_ordenados[i,1]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1015 for(w in 1:length(linea5)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1016 cabecera <- paste(cabecera,linea5[w], sep = "")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1017 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1018 #write(cabecera, file = "1z95_wo_198andwater_ph7_MOD.pdbqt", append = TRUE)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1019 write(cabecera, file = args[2], append = TRUE)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1020 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1021
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1022 #!= TER
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1023 if(tabla_ordenados_numcarac[i,1] != 3){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1024 cabecera <- tabla_ordenados[i,1]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1025 for(w in 1:length(linea12)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1026 cabecera <- paste(cabecera,linea12[w], sep = "")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1027 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1028 #write(cabecera, file = "1z95_wo_198andwater_ph7_MOD.pdbqt", append = TRUE)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1029 write(cabecera, file = args[2], append = TRUE)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1030 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1031 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1032
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1033 #21junio2019
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1034 # #### Make file receptor_atm_types.txt to be paste in the GPF file ###
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1035
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1036 prereceptor_atmtypes <- c()
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1037 for(i in 1:nrow(tabla_ordenados)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1038 if(tabla_ordenados[i,13] != ""){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1039 prereceptor_atmtypes <- c(prereceptor_atmtypes, tabla_ordenados[i,13])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1040 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1041 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1042 #
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1043 receptor_atmtypes <- unique(prereceptor_atmtypes)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1044 #
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1045
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1046 filtered_receptor <- c()
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1047 for(i in 1:length(receptor_atmtypes)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1048
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1049 #print(receptor_atmtypes[i])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1050 #print(is.na(as.numeric(receptor_atmtypes[i])))
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1051
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1052 if(suppressWarnings(is.na(as.numeric(receptor_atmtypes[i])))){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1053 filtered_receptor <- c(filtered_receptor, receptor_atmtypes[i])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1054 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1055
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1056 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1057
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1058 receptor_atmtypes <- filtered_receptor
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1059
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1060 cabeceratm <- receptor_atmtypes[1]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1061 for(rat in 2:length(receptor_atmtypes)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1062
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1063 cabeceratm <- paste(cabeceratm, receptor_atmtypes[rat], sep = " ")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1064 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1065
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1066 write(cabeceratm, file = receptor_types_file_out, append = FALSE)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1067
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1068
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1069 #21junio2019
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1070
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1071
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1072
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1073
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1074 # #::::::::06sep2019:::::::::::::::::#
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1075 #
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1076 # #Make the file receptor_types_file_out.txt removing duplicates and Na
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1077 # #21junio2019
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1078 #
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1079 # #
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1080 # prereceptor_atmtypes <- c()
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1081 # for(i in 1:nrow(tabla_ordenados)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1082 # if(tabla_ordenados[i,13] != ""){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1083 # prereceptor_atmtypes <- c(prereceptor_atmtypes, tabla_ordenados[i,13])
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1084 # }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1085 # }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1086 # #
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1087 # # #print(prereceptor_atmtypes)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1088 # #
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1089 # receptor_atmtypes <- unique(prereceptor_atmtypes)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1090 # #21junio2019
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1091 #
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1092 # quitar <- 0
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1093 # for(i in 1:length(receptor_atmtypes)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1094 # if(isTRUE(receptor_atmtypes[i] == "Na")){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1095 # quitar <- i
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1096 # break
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1097 # }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1098 # }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1099 #
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1100 # if(quitar == 0){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1101 # cabeceratm <- receptor_atmtypes[1]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1102 # for(rat in 2:length(receptor_atmtypes)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1103 # cabeceratm <- paste(cabeceratm, receptor_atmtypes[rat], sep = " ")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1104 # }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1105 #
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1106 # write(cabeceratm, file = "receptor_types_file_out.txt", append = FALSE)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1107 # }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1108 #
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1109 # if(quitar != 0){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1110 # receptor_atmtypes <- receptor_atmtypes[-quitar]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1111 # cabeceratm_types <- receptor_atmtypes[1]
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1112 # for(at_t in 2:length(receptor_atmtypes)){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1113 # cabeceratm_types <- paste(cabeceratm_types, receptor_atmtypes[at_t], sep = " ")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1114 # }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1115 # write(cabeceratm_types, file = "receptor_types_file_out.txt", append = FALSE)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1116 # }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1117
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1118
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1119
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1120
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1121
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1122
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1123
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1124
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1125
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1126
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1127