+ added fasta parser for TAIR7 sequences
[qpalma.git] / tools / data_tools / filterReads.c
1 ////////////////////////////////////////////////////////////
2 // The purpose of this program is to read a gff and a
3 // solexa reads file and create a data set used by QPalma.
4 //
5 //
6 //
7 ////////////////////////////////////////////////////////////
8
9 #include <sys/mman.h>
10 #include <sys/stat.h>
11 #include <stdio.h>
12 #include <stdlib.h>
13 #include <string.h>
14 #include <unistd.h>
15 #include <math.h>
16
17 #include "common.h"
18 #include "datastructures.h"
19
20 int compare_gene_struct(struct gene* a, struct gene* b) {
21 return a->stop - b->start;
22 }
23
24 int parse_gff(char* filename,FILE* fid,struct gene*** allGenes);
25
26 void sort_genes(struct gene*** allGenes, int numGenes);
27
28 void process_reads(FILE* reads_fs,struct gene*** allGenes,int numGenes,FILE* out_fs);
29
30 void combine_info(int exon_stop, int exon_start, void** upstream, int up_size, void** downstream, int down_size, FILE* out_fs,const char* gene_id);
31
32 //int fitting(char* up_prb, char* up_prb_end, char* down_prb, char* down_prb_end);
33 int fitting(char* up_prb, char* down_prb);
34
35 void remove_ambiguities(char * old_seq, int old_seq_size, char* new_seq);
36
37 static char *info = "Usage is:\n./filterReads gff reads output";
38
39 const int read_size = 36;
40
41 int combined_reads = 0;
42 int main(int argc, char* argv[]) {
43
44 if(argc != 4) {
45 printf("%s\n",info);
46 exit(EXIT_FAILURE);
47 }
48
49 int status;
50 int filenameSize = 256;
51 char* gff_filename = malloc(sizeof(char)*filenameSize);
52 char* reads_filename = malloc(sizeof(char)*filenameSize);
53 char* output_filename = malloc(sizeof(char)*filenameSize);
54
55 strncpy(gff_filename,argv[1],filenameSize);
56 strncpy(reads_filename,argv[2],filenameSize);
57 strncpy(output_filename,argv[3],filenameSize);
58
59 FILE *gff_fs = fopen(gff_filename,"r");
60 FILE *reads_fs = fopen(reads_filename,"r");
61 FILE *out_fs = fopen(output_filename,"w");
62
63 if(gff_fs == NULL) {
64 printf("Error: Could not open file: %s",gff_filename);
65 exit(EXIT_FAILURE);
66 }
67
68 if(reads_fs == NULL) {
69 printf("Error: Could not open file: %s",reads_filename);
70 exit(EXIT_FAILURE);
71 }
72
73 if(out_fs == NULL) {
74 printf("Error: Could not open file: %s",output_filename);
75 exit(EXIT_FAILURE);
76 }
77
78 struct gene** allGenes;
79 int numGenes = parse_gff(gff_filename,gff_fs,&allGenes);
80 status = fclose(gff_fs);
81 free(gff_filename);
82 if(status != 0)
83 printf("closing of gff filestream failed!\n");
84
85 printf("Successfully parsed gff file! Found %d genes.\n",numGenes);
86
87 // some entries in the gff files are not in a sorted order
88 //printf("Sorting genes...\n");
89 //sort_genes(&allGenes,numGenes);
90 //qsort(allGenes,numGenes,sizeof(struct gene*),compare_gene_struct);
91 ///printf("Genes were sorted!\n");
92
93 int gidx, eidx;
94 int exon_cov = 0;
95 for(gidx=0;gidx<numGenes;gidx++) {
96 for(eidx=0;eidx<allGenes[gidx]->num_exons;eidx++) {
97 exon_cov += allGenes[gidx]->exon_stops[eidx] - allGenes[gidx]->exon_starts[eidx];
98 }}
99 printf("Exon coverage is %f\n",(double)exon_cov/30432563);
100
101 process_reads(reads_fs,&allGenes,numGenes,out_fs);
102
103 status = fclose(reads_fs);
104 status = fclose(out_fs);
105 if(status != 0)
106 perror("fclose");
107
108 free(reads_filename);
109 free(output_filename);
110 return 0;
111 }
112
113 void process_reads(FILE* reads_fs,struct gene*** allGenes,int numGenes, FILE* out_fs) {
114 int status;
115
116 int buffer_size= 64;
117 int chr = 0;
118 int pos = 0;
119 char* seq = malloc(sizeof(char)*buffer_size);
120 unsigned long id = 0;
121 char strand = ' ';
122 int mismatch = 0;
123 int occurrence = 0;
124 int size = 0;
125 int cut = 0;
126 char* prb = malloc(sizeof(char)*buffer_size);
127 char* cal_prb = malloc(sizeof(char)*buffer_size);
128 char* chastity = malloc(sizeof(char)*buffer_size);
129
130 int reads_fid = fileno(reads_fs);
131 struct stat reads_stat;
132 if ( fstat(reads_fid,&reads_stat) == -1) {
133 perror("fstat");
134 exit(EXIT_FAILURE);
135 }
136 off_t reads_filesize = reads_stat.st_size;
137 printf("Reads file is of size %lu bytes\n",(unsigned long) reads_filesize);
138 int numReads = reads_filesize / 178.0;
139
140 void *reads_area = mmap (NULL,reads_filesize,PROT_READ|PROT_WRITE,MAP_PRIVATE,reads_fid,0);
141 if (reads_area == MAP_FAILED) {
142 perror("mmap");
143 exit(EXIT_FAILURE);
144 }
145 close(reads_fid);
146 printf("Successfully mapped %lu bytes of reads file into memory\n",(unsigned long)reads_filesize);
147
148 void* linePtr = reads_area;
149 char* current_line = malloc(sizeof(char)*256);
150
151 int SIZE = 500;
152 // initialize boundary arrays
153 void** upstream_end = malloc(sizeof(void*)*SIZE);
154 void** upstream_overlap = malloc(sizeof(void*)*SIZE);
155 void** downstream_start = malloc(sizeof(void*)*SIZE);
156 void** downstream_overlap= malloc(sizeof(void*)*SIZE);
157 int ue,uo,ds,dov;
158 ue = uo = ds = dov = 0;
159
160 int skippedLinesCounter = 0;
161
162 int prev_exon_start = -1;
163 int prev_exon_stop = -1;
164 int cur_exon_start = -1;
165
166 current_line = strncpy(current_line,linePtr,256);
167 int gene_idx = 0;
168 int exon_idx = 1;
169 struct gene* currentGene = (*allGenes)[gene_idx];
170 char* gene_id = currentGene->id;
171
172 char* disamb_seq = malloc(sizeof(char)*read_size);
173
174 int skippedReadCtr = 0;
175 int uselessReadCtr = 0;
176 int exonicReadCtr = 0;
177 int endPrevCtr = 0;
178 int prevOverlapCtr = 0;
179 int currentStartCtr = 0;
180 int currentOverlapCtr = 0;
181 int multioccurReadCtr = 0;
182
183 int readCtr = 0;
184 // start of the parsing loop
185 while(1) {
186 if (gene_idx == numGenes || strcmp(current_line,"") == 0)
187 break;
188
189 gene_id = currentGene->id;
190
191 if (readCtr != 0 && readCtr % 1000000 == 0)
192 printf("Processed %d/%d genes and %d/%d reads.\n",gene_idx,numGenes,readCtr,numReads);
193
194 //if (gene_idx >= 1833)
195 // printf("currentGene start/stop: %d/%d. Positions is %d\n",currentGene->start,currentGene->stop,pos);
196
197 status = sscanf(current_line,"%d\t%d\t%s\t%lu\t%c\t%d\t%d\t%d\t%d\t%s\t%s\t%s\n",
198 &chr,&pos,seq,&id,&strand,&mismatch,&occurrence,&size,&cut,prb,cal_prb,chastity);
199 if (status < 12) {
200 skippedLinesCounter++;
201 goto next_read;
202 }
203
204 // if the read is occurring several times elsewhere then get rid of it
205 //if(!(occurrence >= 1 && occurrence <= 25)) {
206 if ( occurrence != 1 ) {
207 multioccurReadCtr++;
208 goto next_read;
209 }
210
211 if (!(currentGene->start <= pos && (pos + read_size-1) <= currentGene->stop)) { // read is not within gene borders
212
213 if ( currentGene->stop < (pos + read_size-1) ) { // go to next gene
214 gene_idx++;
215 exon_idx = 1;
216 currentGene = (*allGenes)[gene_idx];
217 //printf("currentGene->start / currentGene->stop %d/%d pos is %d\n",currentGene->start,currentGene->stop,pos);
218 ue = uo = ds = dov = 0;
219 continue;
220 }
221
222 if ( pos < currentGene->start ) { // go to next read
223 skippedReadCtr++;
224
225 next_read:
226
227 while (*(char*)linePtr != '\n') linePtr++;
228 linePtr++;
229 readCtr += 1;
230 current_line = strncpy(current_line,linePtr,256);
231 continue;
232 }
233
234 } else { // read IS within gene borders
235
236 exon_label:
237
238 if (exon_idx == currentGene->num_exons) {
239 gene_idx++;
240 exon_idx = 1;
241 currentGene = (*allGenes)[gene_idx];
242 continue;
243 }
244
245 prev_exon_start = currentGene->exon_starts[exon_idx-1];
246 prev_exon_stop = currentGene->exon_stops[exon_idx-1];
247 cur_exon_start = currentGene->exon_starts[exon_idx];
248
249 //printf("exon %d %d inton til %d pos %d\n",prev_exon_start,prev_exon_stop,cur_exon_start,pos);
250
251 if (cur_exon_start - prev_exon_stop < 6 || cur_exon_start < pos ) { // go to next exon
252 exon_idx++;
253
254 if (ue != 0 && dov != 0)
255 combine_info(prev_exon_stop,cur_exon_start,upstream_end,ue,downstream_overlap,dov,out_fs,gene_id);
256
257 if (uo != 0 && ds != 0)
258 combine_info(prev_exon_stop,cur_exon_start,upstream_overlap,uo,downstream_start,ds,out_fs,gene_id);
259
260 ue = uo = ds = dov = 0;
261 goto exon_label;
262 }
263
264 if ( prev_exon_start < pos && (pos+read_size) < prev_exon_stop ) { // read is inside previous exon
265 exonicReadCtr++;
266
267 // Removed exonic reads
268
269 //remove_ambiguities(seq,strlen(seq),disamb_seq);
270 //fprintf(out_fs,"%d\t%c\t%s\t%d\t%s\t%s\t%s\n",chr,strand,disamb_seq,read_size,prb,cal_prb,chastity);
271
272 goto next_read;
273 }
274
275 if ( pos + (read_size-1) < prev_exon_stop ) // go to next read
276 goto next_read;
277
278 // if this position is reached the read is somehow overlapping or
279 // exactly on the exon boundary. now determine where exactly:
280 if (pos + (read_size-1) == prev_exon_stop) { // read ends at previous exon end
281 endPrevCtr++;
282 upstream_end[ue] = linePtr;
283 ue++;
284 goto next_read;
285 }
286
287 if ( (prev_exon_stop - pos) >= 6 && (prev_exon_stop - pos) <= 30) { // read overlaps with previous exon boundary
288 prevOverlapCtr++;
289 upstream_overlap[uo] = linePtr;
290 uo++;
291 goto next_read;
292 }
293
294 if ( pos == cur_exon_start ) { // read starts at current exon start
295 currentStartCtr++;
296 downstream_start[ds] = linePtr;
297 ds++;
298 goto next_read;
299 }
300
301 if ( (cur_exon_start - pos) >= 6 && (cur_exon_start - pos) <= 30 ) { // read overlaps with current exon boundary
302 currentOverlapCtr++;
303 downstream_overlap[dov] = linePtr;
304 dov++;
305 goto next_read;
306 }
307
308 uselessReadCtr++;
309 goto next_read; // read was not useful i.e. not overlapping/starting at exon boundaries
310 }
311 }
312
313 combine_info(prev_exon_stop,cur_exon_start,upstream_end,ue,downstream_overlap,dov,out_fs,gene_id);
314 combine_info(prev_exon_stop,cur_exon_start,upstream_overlap,uo,downstream_start,ds,out_fs,gene_id);
315
316 free(upstream_end);
317 free(upstream_overlap);
318 free(downstream_start);
319 free(downstream_overlap);
320
321 printf("Processed %d reads in total while %d reads where skipped.\n",readCtr,skippedLinesCounter);
322 printf("%d were totally intronic. %d were outside of genes and %d were occurring on several positions.\n",uselessReadCtr,skippedReadCtr,multioccurReadCtr);
323 printf("%d reads were useless in total\n",uselessReadCtr+skippedReadCtr+multioccurReadCtr);
324 printf("%d reads were totally exonic\n",exonicReadCtr);
325 printf("%d reads overlap with prev. exon. %d reads overlap with current exon\n",prevOverlapCtr,currentOverlapCtr);
326 printf("%d reads where newly combined from two original reads\n",combined_reads);
327 printf("Total used reads: %d\n",exonicReadCtr+endPrevCtr+prevOverlapCtr+currentStartCtr+currentOverlapCtr);
328
329 status = munmap(reads_area,reads_filesize);
330 if(status != 0)
331 perror("munmap");
332
333 //free(current_line);
334 free(seq);
335 free(prb);
336 free(cal_prb);
337 free(chastity);
338 }
339
340 void combine_info(int exon_stop, int exon_start, void** upstream, int up_size, void** downstream, int down_size,FILE* out_fs,const char* gene_id) {
341 //printf("up/down size is %d/%d\n",up_size,down_size);
342
343 int up_idx, down_idx, status;
344 char* upstream_line = malloc(sizeof(char)*256);
345 char* downstream_line = malloc(sizeof(char)*256);
346
347 int buffer_size= 64;
348
349 int up_chr = 0;
350 int up_pos = 0;
351 char* up_seq = malloc(sizeof(char)*buffer_size);
352 int up_id = 0;
353 char up_strand = ' ';
354 int up_mismatch = 0;
355 int up_occurrence = 0;
356 int up_sz = 0;
357 int up_cut = 0;
358 char* up_prb = malloc(sizeof(char)*buffer_size);
359 char* up_cal_prb = malloc(sizeof(char)*buffer_size);
360 char* up_chastity = malloc(sizeof(char)*buffer_size);
361
362 int down_chr = 0;
363 int down_pos = 0;
364 char* down_seq = malloc(sizeof(char)*buffer_size);
365 int down_id = 0;
366 char down_strand = ' ';
367 int down_mismatch = 0;
368 int down_occurrence = 0;
369 int down_sz = 0;
370 int down_cut = 0;
371 char* down_prb = malloc(sizeof(char)*buffer_size);
372 char* down_cal_prb = malloc(sizeof(char)*buffer_size);
373 char* down_chastity = malloc(sizeof(char)*buffer_size);
374
375 int new_chr = 0;
376 char* new_seq = malloc(sizeof(char)*buffer_size);
377 char new_strand = ' ';
378 char* new_prb = malloc(sizeof(char)*buffer_size);
379 char* new_cal_prb = malloc(sizeof(char)*buffer_size);
380 char* new_chastity = malloc(sizeof(char)*buffer_size);
381 char* new_up_seq = malloc(sizeof(char)*read_size);
382 char* new_down_seq = malloc(sizeof(char)*read_size);
383
384 int overlap;
385 int fit;
386
387 char* used_flag = calloc(down_size,sizeof(char));
388
389 for(up_idx=0;up_idx<up_size;up_idx++) {
390 strncpy(upstream_line,upstream[up_idx],256);
391 status = sscanf(upstream_line,"%d\t%d\t%s\t%d\t%c\t%d\t%d\t%d\t%d\t%s\t%s\t%s\n",
392 &up_chr,&up_pos,up_seq,&up_id,&up_strand,&up_mismatch,&up_occurrence,&up_sz,
393 &up_cut,up_prb,up_cal_prb,up_chastity);
394
395 remove_ambiguities(up_seq,strlen(up_seq),new_up_seq);
396
397 overlap = exon_stop - up_pos;
398
399 for(down_idx=0;down_idx<down_size;down_idx++) {
400 if( used_flag[down_idx] == 1)
401 continue;
402
403 strncpy(downstream_line,downstream[down_idx],256);
404 status = sscanf(downstream_line,"%d\t%d\t%s\t%d\t%c\t%d\t%d\t%d\t%d\t%s\t%s\t%s\n",
405 &down_chr,&down_pos,down_seq,&down_id,&down_strand,&down_mismatch,&down_occurrence,&down_sz,
406 &down_cut,down_prb,down_cal_prb,down_chastity);
407
408 remove_ambiguities(down_seq,strlen(down_seq),new_down_seq);
409
410 new_seq[0] = '\0';
411 new_prb[0] = '\0';
412 new_cal_prb[0] = '\0';
413 new_chastity[0] = '\0';
414 int splitpos = 0;
415
416 fit = fitting(up_prb+(36-overlap),down_prb);
417 if (fit == -1)
418 continue;
419
420 if (! (fit < overlap ))
421 continue;
422
423 new_chr = up_chr;
424 new_strand = up_strand;
425
426 strncat(new_seq,new_up_seq,overlap);
427 strncat(new_prb,up_prb,overlap);
428 strncat(new_cal_prb,up_cal_prb,overlap);
429 strncat(new_chastity,up_chastity,overlap);
430
431 strncat(new_seq,new_down_seq+fit,read_size-overlap);
432 strncat(new_prb,down_prb+fit,read_size-overlap);
433 strncat(new_cal_prb,down_cal_prb+fit,read_size-overlap);
434 strncat(new_chastity,down_chastity+fit,read_size-overlap);
435
436 fprintf(out_fs,"%d\t%c\t%s\t%d\t%d\t%s\t%s\t%s\t%s\n",
437 new_chr,new_strand,new_seq,splitpos,read_size,new_prb,new_cal_prb,new_chastity,gene_id);
438
439 combined_reads++;
440 used_flag[down_idx] = 1;
441 }
442 }
443
444 free(upstream_line);
445 free(downstream_line);
446
447 free(new_up_seq);
448 free(new_down_seq);
449
450 free(up_seq);
451 free(up_prb);
452 free(up_cal_prb);
453 free(up_chastity);
454
455 free(down_seq);
456 free(down_prb);
457 free(down_cal_prb);
458 free(down_chastity);
459
460 free(new_seq);
461 free(new_prb);
462 free(new_cal_prb);
463 free(new_chastity);
464 }
465
466
467
468
469 /*
470 int fitting(char* up_prb, char* up_prb_end, char* down_prb, char* down_prb_end) {
471 double epsilon_mean = 15.0;
472 double epsilon_var = 10.0;
473 double mean_up = 0;
474 double variance_up = 0;
475 double mean_down = 0;
476 double variance_down = 0;
477
478 char *up_ptr = up_prb;
479 char *down_ptr = down_prb;
480
481 int w_size = 0;
482 while(up_ptr != up_prb_end) {
483 mean_up += (*up_ptr)-50;
484 mean_down += (*down_ptr)-50;
485 w_size++;
486 up_ptr++;
487 down_ptr++;
488 }
489 mean_up /= w_size;
490 mean_down /= w_size;
491
492
493 up_ptr = up_prb;
494 down_ptr = down_prb;
495 w_size = 0;
496 while(up_ptr != up_prb_end) {
497 variance_up += pow((*up_prb)-50 - mean_up,2);
498 variance_down += pow((*down_prb)-50 - mean_down,2);
499 w_size++;
500 up_ptr++;
501 down_ptr++;
502 }
503 variance_up /= (w_size-1);
504 variance_down /= (w_size-1);
505
506 //printf("means: %f %f, variances: %f %f\n",mean_up,mean_down,variance_up,variance_down);
507
508 if ( abs(mean_up - mean_down) < epsilon_mean && abs(variance_up - variance_down) < epsilon_var )
509 return 1;
510
511 return 0;
512 }
513 */
514
515 int fitting(char* up_prb, char* down_prb) {
516 double epsilon_mean = 30.0;
517 double epsilon_var = 30.0;
518 int w_size = 6;
519
520 double current_mean_up = 0;
521 double current_variance_up = 0;
522 double current_mean_down = 0;
523 double current_variance_down = 0;
524
525 double* mean_up = malloc(sizeof(double)*read_size-2*w_size);
526 double* variance_up = malloc(sizeof(double)*read_size-2*w_size);
527 double* mean_down = malloc(sizeof(double)*read_size-2*w_size);
528 double* variance_down = malloc(sizeof(double)*read_size-2*w_size);
529
530 int iidx = -1;
531 int uidx;
532 int didx;
533
534 for(uidx=iidx-w_size;uidx<iidx;uidx++) {
535 didx = uidx+w_size;
536 current_mean_up += up_prb[uidx]-50;
537 current_mean_down += up_prb[didx]-50;
538
539 }
540 current_mean_up /= w_size;
541 current_mean_down /= w_size;
542
543 for(uidx=iidx-w_size;uidx<iidx;uidx++) {
544 didx = uidx+w_size;
545 current_variance_up += pow(up_prb[uidx]-50 - current_mean_up,2);
546 current_variance_down += pow(up_prb[didx]-50 - current_mean_up,2);
547
548 }
549 current_variance_up /= (w_size-1);
550 current_variance_down /= (w_size-1);
551
552 for(iidx=w_size;iidx<30;iidx++) {
553 for(uidx=iidx-w_size;uidx<iidx;uidx++) {
554 didx = uidx+w_size;
555 mean_up[iidx-w_size] += down_prb[uidx]-50;
556 mean_down[iidx-w_size] += down_prb[didx]-50;
557
558 }
559 mean_up[iidx-w_size] /= w_size;
560 mean_down[iidx-w_size] /= w_size;
561
562 for(uidx=iidx-w_size;uidx<iidx;uidx++) {
563 didx = uidx+w_size;
564 variance_up[iidx-w_size] += pow(down_prb[uidx]-50 - mean_up[iidx-w_size],2);
565 variance_down[iidx-w_size] += pow(down_prb[didx]-50 - mean_down[iidx-w_size],2);
566 }
567 variance_up[iidx-w_size] /= (w_size-1);
568 variance_down[iidx-w_size] /= (w_size-1);
569
570 //printf("means: %f %f %f %f, variances: %f %f %f %f\n",current_mean_up,current_mean_down,mean_up,mean_down,current_variance_up,current_variance_down,variance_up,variance_down);
571 //if ( abs(current_mean_up - mean_up) < epsilon_mean && abs(current_variance_up - variance_up) < epsilon_var
572 //&& abs(current_mean_down - mean_down) < epsilon_mean && abs(current_variance_down - variance_down) < epsilon_var )
573 // return iidx;
574 }
575
576 int bidx;
577 int bestIdx = -1;
578 double min = 1000.0;
579 for(bidx=0;bidx<read_size-2*w_size;bidx++) {
580 if ( abs(current_mean_up - mean_up[bidx]) < epsilon_mean && abs(current_variance_up - variance_up[bidx]) < epsilon_var
581 && abs(current_mean_down - mean_down[bidx]) < epsilon_mean && abs(current_variance_down - variance_down[bidx]) < epsilon_var ) {
582 if ( abs(current_mean_up - mean_up[bidx]) + abs(current_variance_up - variance_up[bidx]) + abs(current_mean_down - mean_down[bidx]) + abs(current_variance_down - variance_down[bidx])) {
583 min = abs(current_mean_up - mean_up[bidx]) + abs(current_variance_up - variance_up[bidx]) + abs(current_mean_down - mean_down[bidx]) + abs(current_variance_down - variance_down[bidx]);
584 bestIdx = bidx;
585 }
586 }
587 }
588
589 free(mean_up);
590 free(variance_up);
591 free(mean_down);
592 free(variance_down);
593
594 return bestIdx;
595 }
596
597 void remove_ambiguities(char * old_seq, int old_seq_size, char* new_seq) {
598 int idx=0;
599 int new_idx = 0;
600
601 while(idx<old_seq_size) {
602 //printf("Current elem %c pos %d %d\n",old_seq[idx],idx,new_idx);
603 if (old_seq[idx] == ']' || old_seq[idx] == '-' ) {
604 idx++;
605 continue;
606 }
607
608 if (old_seq[idx] == '[') {
609 idx += 2;
610 //printf("%c %c\n",old_seq[idx-2],old_seq[idx]);
611 continue;
612 }
613
614 new_seq[new_idx] = old_seq[idx];
615 idx++;
616 new_idx++;
617 }
618
619 if (new_idx != 36) {
620 printf("Error: Sequence is not of length 36!\n");
621 printf("old seq: %s\n",old_seq);
622 printf("new seq: %s\n",new_seq);
623 exit(EXIT_FAILURE);
624 }
625 }
626
627 /*
628 * TODO:
629 * - Check strand -> done simple (only if equal)
630 * - check for [AC] and similar entries -> done simple (see function
631 * - remove_ambiguities (exchanges [XY] by the second entry)
632 */