Bonjour,

étant actuellement en plein développement d'une interface web mêlant PHP et Perl, les scripts Perl étant appelés par PHP et pouvant afficher les informations relatives aux calculs au format HTML dans la page générée par PHP, je me retrouve à un problème de taille.
Je pense que celui-ci vient du fait que je fais un pré-traitement sur plusieurs fichiers afin de récupérer des tables de hashages pour faire les relations entre les informations qui sont dans les différents fichiers avant l'affichage d'un tableau. Lorsque je lance le script sur une seule session, celui-ci tourne sans problème et m'affiche bien le tableau. Mais lorsque je souhaite faire la même chose en le lançant sous deux sessions, le serveur me renvoit l'erreur suivante :
Gateway incorrecte!

Le serveur proxy a reçu une réponse incorrecte de la part d'un serveur supérieur.

The proxy server could not handle the request <em><a href="/diyhttp/index.php">GET&nbsp;/diyhttp/index.php</a></em>.<p> Reason: <strong>Error reading from remote server</strong></p>

Si vous pensez qu'il s'agit d'une erreur du serveur, veuillez contacter le gestionnaire du site

Error 502
Etant donné que l'interface que je suis en train de développer a pour objectif d'être un service web, je risque de très rapidement retrouver ce problème si plusieurs utilisateurs souhaitent afficher le tableau généré par le script, ce qui rendra donc mon application totalement inutile. Quelle serait la meilleure solution à utiliser ? Probablement l'utilisation d'une base de données, mais au stade actuel du projet celle-ci n'a pas encore été définie ni construite. Peut-être faudrait-il que je passe par le module FastCGI ou que je procède autrement dans mon cas ?

Si cela peut vous aider, je vous joint le script utilisé actuellement :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
#!/usr/bin/perl
 
use CGI;
use strict;
use warnings;
use List::MoreUtils qw(uniq);
 
my $blast = $ARGV[0];
my $genelink = $ARGV[1];
my $organism = $ARGV[2];
my $params = $ARGV[3];
my $cross_check = $ARGV[4];
my $uniprotdbr = "/mnt/Temp2/diyhttp/Databases/DB_relations/unip-id_dbr_".$organism.".dat";
my $gene_info = "/mnt/Temp2/diyhttp/Databases/DB_relations/".$organism."-gene_info.txt";
my $generef = "/mnt/Temp2/diyhttp/Databases/DB_sources/gene2refseq";
my $uniacref = "/mnt/Temp2/diyhttp/Databases/DB_sources/gene_refseq_uniprotkb_collab";
 
# extract some datas from $uniprotdbr :
# - the GeneID for the UniProt-ID;
# - the UniProt-AC for the UniProt-ID.
open (UNIPROT, "<", $uniprotdbr) or ( warn "Can't read file $uniprotdbr\n$!\n" and die );
my (%upid2upac, %upid2geneid);
while(<UNIPROT>){
    chomp;
    my ($upid, $upac, $geneid, $go, $pir, $taxon, $ens) = split(/\t/, $_);
    $upid2geneid{$upid} = $geneid;
    $upid2upac{$upid} = $upac;
}
close UNIPROT;
 
# extract the official symbol for the GeneID
open (GENE, "<", $gene_info) or ( warn "Can't read file $gene_info\n$!\n" and die );
my %geneid2symbol;
my $count = 0;
while(<GENE>){
    chomp;
    my ($taxid, $geneid, $symbol, $update) = split(/\t/, $_);
    $geneid2symbol{$geneid} = $symbol;
}
close GENE;
 
# protgi references for the GeneID
my (%geneid2protgi, %uniac2protacc);
open (GENEREF, "<", $generef) or ( warn "Can't read file $generef\n$!\n" and die );
while(<GENEREF>){
    chomp;
    my ($taxid, $geneid, $status, $rna_acc, $rna_gi, $protacc, $protgi) = split(/\t/, $_);
    if ( ( defined($geneid) and defined($protgi) )
     and ( $geneid !~ "-" and $protgi !~ "-" ) ){
        push(@{$geneid2protgi{$geneid}}, $protgi) ;
    }
}
close GENEREF;
 
open (UNIACREF, "<", $uniacref) or ( warn "Can't read file $uniacref\n$!\n" and die );
while(<UNIACREF>){
    chomp;
    my ($protgi, $uniac) = split(/\t/, $_);
    if ( defined($protgi) and defined($uniac) ){
        $uniac2protacc{$uniac} = $protgi;
    }
}
close UNIACREF;
 
# extract params selected by the user
my @params = split(/-/, $params);
 
# initialise script for writting xml file output
use XML::Writer;
use IO::File;
 
my ($dir, $file_name) = $blast =~ /(.+[\/\\])([^\/\\]+)$/;
 
my $output_file = "tmp/".$file_name.".xml";
my $output = new IO::File("> ".$output_file);
 
my $writer = new XML::Writer(
    OUTPUT      => $output,
    DATA_INDENT => 4,             # indentation, 4 spaces
    DATA_MODE   => 1,             # change line
    ENCODING    => 'utf-8',       # encoding character
);
 
 
$writer->xmlDecl("UTF-8");
$writer->startTag("BlastRead");
# define organism tag
$writer->startTag("Organism");
$writer->characters($organism);
$writer->endTag("Organism");
 
# user could select the GeneID that he evaluates as interesting
print "<table id=\"showlines\">\n";
print "\t<tr id=\"first-line\"><th>#</th><th width=\"10%\">Peptids</th><th>Genes</th><th width=\"10%\">Proteins</th>";
if ( grep(/A|H/, @params) and !grep(/N/, @params) ){
    print "<th>HomoloGene</th>";
}
if ( grep(/A|P/, @params) and !grep(/N/, @params)){
    print "<th>PIRSF</th>"
}
if ( grep(/A|O/, @params) and !grep(/N/, @params)){
    print "<th>OrthoMCL</th>"
}
print "<th>Cross</th>";
print "</tr>\n";
 
open (BLAST, "<", $blast) or ( warn "Can't read $blast file!<br />$!" and die );
my $i = 0;
my $line = 1;
while(<BLAST>){
    chomp;
    my ($nbpept, $peptid, $upid, $homo, $pirsf, $ortho, $cross) = split(/\t/, $_);
    my @crossed = split(/\s/, $cross);
    if ( ( grep(/$cross_check/, @crossed) ) or ( $cross_check =~ /N/ ) )
    {
        # in condition, start Pack tag
        $writer->startTag("Pack", "value"=>$i, "number"=>$nbpept);
        my @peptids = split(/\s/, $peptid);
        my @upids = split(/\s/, $upid);
        my @homos = split(/\s/, $homo);
        my @pirsf_r = split(/\s/, $pirsf);
        my @orthos = split(/\s/, $ortho);
        my @crossed = split(/\s/, $cross);
        print "\t<tr id=\"line$i\">";
 
        print "<td valign=\"top\">";
        print $nbpept;
        print "</td>";
 
        print "<td valign=\"top\">";
        print join(", ", @peptids);
        print "</td>";
 
        $writer->startTag("Peptids");
        $writer->characters( join(", ", @peptids) );
        $writer->endTag("Peptids");
 
        # show list of genes for the peptids pack
        print "<td valign=\"top\">";
        # stat gene tag
        $writer->startTag("Gene");
        my @geneids = map { $upid2geneid{$_} } @upids;
        @geneids = uniq(@geneids);
        my $last_geneid = pop(@geneids);
        foreach my $geneid (@geneids){
            if ( $geneid ){
                if ( $geneid2symbol{$geneid} ){
                    print "<input type=\"checkbox\" name=\"geneid[]\" value=\"".$geneid."+".$geneid2symbol{$geneid}."+".$line."\" />";
                    print "<a href=\"".$genelink."&amp;geneid=".$geneid."&amp;symbol=".$geneid2symbol{$geneid}."&amp;organism=".$organism."\" title=\"".$geneid2symbol{$geneid}."\">".$geneid2symbol{$geneid}."</a>,<br />";
 
                    # input geneid tag
                    $writer->startTag("geneid");
                    $writer->characters($geneid);
                    $writer->endTag("geneid");
 
                    # input gene symbol tag
                    $writer->startTag("genesymbol");
                    $writer->characters($geneid2symbol{$geneid});
                    $writer->endTag("genesymbol");
                }
                else{
                    print "<input type=\"checkbox\" name=\"geneid[]\" value=\"".$geneid."+".$geneid."+".$line."\" />";
                    print "<a href=\"".$genelink."&amp;geneid=".$geneid."&amp;symbol=".$geneid."&amp;organism=".$organism."\" title=\"".$geneid."\">".$geneid."</a>,<br />";
 
                    # input geneid tag
                    $writer->startTag("geneid");
                    $writer->characters($geneid);
                    $writer->endTag("geneid");
 
                    # input gene symbol tag
                    $writer->startTag("genesymbol");
                    $writer->characters("Unknown");
                    $writer->endTag("genesymbol");
                }
            }
            else{
                print "-,<br />";
 
                # input geneid tag
                $writer->startTag("geneid");
                $writer->characters("Unknown");
                $writer->endTag("geneid");
 
                # input gene symbol tag
                $writer->startTag("genesymbol");
                $writer->characters("Unknown");
                $writer->endTag("genesymbol");
                }
            }
            else{
                print "-,<br />";
 
                # input geneid tag
                $writer->startTag("geneid");
                $writer->characters("Unknown");
                $writer->endTag("geneid");
 
                # input gene symbol tag
                $writer->startTag("genesymbol");
                $writer->characters("Unknown");
                $writer->endTag("genesymbol");
            }
        }
 
        if ( $last_geneid ){
            if ( $geneid2symbol{$last_geneid} ){
                print "<input type=\"checkbox\" name=\"geneid[]\" value=\"".$last_geneid."+".$geneid2symbol{$last_geneid}."+".$line."\" />";
                print "<a href=\"".$genelink."&amp;geneid=".$last_geneid."&amp;symbol=".$geneid2symbol{$last_geneid}."&amp;organism=".$organism."\" title=\"".$geneid2symbol{$last_geneid}."\">".$geneid2symbol{$last_geneid}."</a>";
 
                # input geneid tag
                $writer->startTag("geneid");
                $writer->characters($last_geneid);
                $writer->endTag("geneid");
 
                # input gene symbol tag
                $writer->startTag("genesymbol");
                $writer->characters($geneid2symbol{$last_geneid});
                $writer->endTag("genesymbol");
            }
            else{
                print "<input type=\"checkbox\" name=\"geneid[]\" value=\"".$last_geneid."+".$last_geneid."+".$line."\" />";
                print "<a href=\"".$genelink."&amp;geneid=".$last_geneid."&amp;symbol=".$last_geneid."&amp;organism=".$organism."\" title=\"".$last_geneid."\">".$last_geneid."</a>";
 
                # input geneid tag
                $writer->startTag("geneid");
                $writer->characters($last_geneid);
                $writer->endTag("geneid");
 
                # input gene symbol tag
                $writer->startTag("genesymbol");
                $writer->characters("Unknown");
                $writer->endTag("genesymbol");
            }
        }
        else{
            print "-";
 
            # input geneid tag
            $writer->startTag("geneid");
            $writer->characters("Unknown");
            $writer->endTag("geneid");
 
            # input gene symbol tag
            $writer->startTag("genesymbol");
            $writer->characters("Unknown");
            $writer->endTag("genesymbol");
        }
        # end gene tag
        $writer->endTag("Gene");
        print "</td>";
 
        # show proteins with their gi accessor, if exists
        print "<td valign=\"top\">";
        $writer->startTag("Proteins");
        # start tag for listing the Protein gi
        $writer->startTag("ProtGI");
 
        my $last_upid = pop(@upids);
 
        foreach my $upid (@upids){
#       ( $upid2geneid{$upid} ) ? print $geneid2symbol{$upid2geneid{$upid}}.":<br />" : print "Gene not found:<br />";
 
            if ( defined($uniac2protacc{$upid2upac{$upid}}) ){
                print "<a href=\"http://www.ncbi.nlm.nih.gov/protein/".$uniac2protacc{$upid2upac{$upid}}."\">".$upid."</a>,<br />";
 
                # add the protgi
                $writer->startTag("gi");
                $writer->characters($uniac2protacc{$upid2upac{$upid}});
                $writer->endTag("gi");
 
                # add the UniProt-ID which correspond
                $writer->startTag("UniProt-ID");
                $writer->characters($upid);
                $writer->endTag("UniProt-ID");
            }
            else {
                print $upid.",<br />";
                # add the UniProt-ID
                $writer->startTag("UniProt-ID");
                $writer->characters($upid);
                $writer->endTag("UniProt-ID");
            }
        }
 
        if ( defined($uniac2protacc{$upid2upac{$last_upid}}) ){
            print "<a href=\"http://www.ncbi.nlm.nih.gov/protein/".$uniac2protacc{$upid2upac{$last_upid}}."\">".$last_upid."</a><br />";
 
            # add the protgi
            $writer->startTag("gi");
            $writer->characters($uniac2protacc{$upid2upac{$last_upid}});
            $writer->endTag("gi");
 
            # add the UniProt-ID which correspond
            $writer->startTag("UniProt-ID");
            $writer->characters($upid);
            $writer->endTag("UniProt-ID");
        }
 
        else {
            print $last_upid."<br />";
            # add the UniProt-ID
            $writer->startTag("UniProt-ID");
            $writer->characters($last_upid);
            $writer->endTag("UniProt-ID");
        }
 
        # end the protein gi list
        $writer->endTag("ProtGI");
        $writer->endTag("Proteins");
        print "</td>";
 
 
        # user want to see HomoloGene's column
        # show the HomoloGene's list for the peptids pack
        if ( grep(/A|H/, @params) and !grep(/N/, @params) ){
            print "<td valign=\"top\">";
 
            # start homologene tag
            $writer->startTag("HomoloGene");
            if ( scalar(@homos) > 0 ){
#           @homos = uniq(@homos);
                my $last_homo = pop(@homos);
                print map { ( $_ !~ "None" ) ? "<a href=\"http://www.ncbi.nlm.nih.gov/homologene/".$_."\">".$_."</a>,<br />"    : $_.",<br />" ;} @homos;
 
                # input homologeneID tag
                map { $writer->startTag("HomoloGeneID");
                    $writer->characters($_);
                    $writer->endTag("HomoloGeneID");
                } @homos;
 
                ( $last_homo !~ "None" ) ? print "<a href=\"http://www.ncbi.nlm.nih.gov/homologene/".$last_homo."\">".$last_homo."</a>" : print $last_homo;
 
                # input homologeneID tag
                $writer->startTag("HomoloGeneID");
                $writer->characters($last_homo);
                $writer->endTag("HomoloGeneID");
            }
            else{
                print "None";
                # none HomoloGene, input characters
                $writer->characters("None");
            }
 
            # end homologene tag
            $writer->endTag("HomoloGene");
            print "</td>";
        }
 
        # user want to see PIRSF families' column
        # show the PIRSF Families' list for the peptids pack
        if ( grep(/A|P/, @params) and !grep(/N/, @params) ){
            print "<td valign=\"top\">";
 
            # start PIRSF tag
            $writer->startTag("PIRSF");
            if ( scalar(@pirsf_r) > 0){
#           @pirsf_r = uniq(@pirsf_r);
                my $last_pirsf = pop(@pirsf_r);
                print map { ( $_ !~ "None" ) ? $_.",<br />" : $_.",<br />"; } @pirsf_r;
                # input PIRSF Families
                map { $writer->startTag("PIRSF_family");
                      $writer->characters($_);
                      $writer->endTag("PIRSF_family");} @pirsf_r;
                ( $last_pirsf !~ "None" ) ? print $last_pirsf : print $last_pirsf;
                # input last PIRSF Family
                $writer->startTag("PIRSF_family");
                $writer->characters($last_pirsf);
                $writer->endTag("PIRSF_family");
            }
            else{
                print "None";
                # none PIRSF, input characters
                $writer->characters("None");
            }
 
            # end PIRSF tag
            $writer->endTag("PIRSF");
            print  "</td>";
        }
 
        # user want to see OrthoMCL's column
        # show the OrthoMCL's list for the peptids pack
        if ( grep(/A|O/, @params) and !grep(/N/, @params) ){
            print "<td valign=\"top\">";
 
            # start OrthoMCL tag
            $writer->startTag("OrthoMCL");
            if ( scalar(@orthos) > 0 ){
#           @orthos = uniq(@orthos);
                my $last_ortho = pop(@orthos);
                print map { ( $_ !~ "None" ) ? "<a href=\"http://orthomcl.org/cgi-bin/OrthoMclWeb.cgi?rm=sequenceList&groupac=".$_."\">".$_."</a>,<br />" : $_.",<br />"; } @orthos;
 
                # input OrthoMCL access number
                map { $writer->startTag("OrthoMCL_ac");
                      $writer->characters($_);
                      $writer->endTag("OrthoMCL_ac");
                    } @orthos;
                ( $last_ortho !~ "None" ) ? print "<a href=\"http://orthomcl.org/cgi-bin/OrthoMclWeb.cgi?rm=sequenceList&groupac=".$last_ortho."\">".$last_ortho."</a>" : print $last_ortho;
 
                # input OrthoMCL access number
                $writer->startTag("OrthoMCL_ac");
                $writer->characters($last_ortho);
                $writer->endTag("OrthoMCL_ac");
            }
            else{
                print "None";
                # none OrthoMCL, input characters
                $writer->characters("None");
            }
 
            # end OrthoMCL tag
            $writer->endTag("OrthoMCL");
            print "</td>";
        }
 
        print "<td valign=\"top\" align=\"center\">";
        foreach my $pcross (@crossed){
            ( $pcross eq "X" ) ? print "<div class=\"cross\">".$pcross."</div>" : print "<div class=\"differ\">".$pcross."</div>";
 
            # input if datas from HomoloGene, PIRSF and OrthoMCL cross for proteins found or not
            my $pcrossed = ( $pcross eq "X" ) ? "cross" : "uncross";
            $writer->emptyTag("CrossDatas", "value" => $pcrossed );
        }
        print "</td>";
 
        print "</tr>\n";
 
        # end Pack tag
        $writer->endTag("Pack");
        print "\t<script type=\"text/javascript\">\n";
        print "\t\t\$(\"#showlines\").load(\"#line$i\");\n";
        print "\t</script>\n";
        $i++;
        }
    $line++;
}
close BLAST;
 
print "</table>\n";
 
# end writting xml file output
$writer->endTag("BlastRead");
$writer->end();
$output->close();
 
print "<hr /><a href=\"file_downloader.php?file=".$output_file."\">Download table result as XML file output.</a><br />";
Merci d'avance aux personnes qui auront plus d'idées que moi, personnellement je sèche !
Cordialement, Norore.