[Bioperl-l] please help me to check why this perl script does notwork!

Marc Logghe Marc.Logghe at devgen.com
Sun May 29 16:50:03 EDT 2005


Hi,
There are a few issues with the script:
1) @seq is not an array of (fasta) sequences, but in your case a list of
lines. This can be fixed like so:
#@seq = <INPUT>;
local $/ = undef;
@seq = split /\n(?=>)/, <INPUT>;

2) You have to POST all necessary parameters, including the hidden ones.
Also, apparently, you have to pass a hash ref in stead of an array ref
to post():
         my $response =
$browser->post('http://www.cbs.dtu.dk/cgi-bin/nph-webface',
                       { "SEQPASTE" => "$item",
                         full => 'full',
                         "configfile" =>
"/usr/opt/www/pub/CBS/services/ChloroP-1.1/chlorop.cf"
                       }
                         );

3) The resulting content is an html page with javascript in it and a url
where to fetch the result when finished. So I guess you have to parse
out that url and perform another request.

HTH,
Marc


Marc Logghe, PhD
deVGen NV
Technologiepark 30
B - 9052 Ghent-Zwijnaarde
Tel. +32 9 324 24 83 
Fax. +32 9 324 24 25 
Web: www.devgen.com

 --- Disclaimer start ---
This e-mail and any attachments thereto may contain information which is
confidential and/or which is proprietary to the sender. Accordingly,
this e-mail and any attachments thereto, as well as any and all
information contained therein, are intended for the sole use of the
recipient or recipients designated above. Any use of this e-mail, of any
attachments thereto, of any and all information contained therein,
and/or of any part(s) thereof (including, without limitation, total or
partial reproduction, communication and/or distribution in any form) by
persons other than the designated recipient(s) is prohibited. If you
have received this e-mail in error, please notify the sender either by
telephone or by e-mail and delete the material from any computer. 
Thank you for your cooperation.
--- Disclaimer end ---
  

> -----Original Message-----
> From: bioperl-l-bounces at portal.open-bio.org 
> [mailto:bioperl-l-bounces at portal.open-bio.org] On Behalf Of Fei Li
> Sent: Sunday, May 29, 2005 9:37 AM
> To: Bioperl-l at portal.open-bio.org
> Subject: [Bioperl-l] please help me to check why this perl 
> script does notwork!
> 
> I wish to submit some protein sequences via LWP:UserAgent  to 
> the http://www.cbs.dtu.dk/services/ChloroP/
> 
> The error message is given as follows:
> 
> <HTML><HEAD><TITLE>Webface Error</TITLE></HEAD><font 
> color=red><h1>Webface Error: </h1><h4>
> Read: Field not declared; 'seqpaste'</h4> <br> </font></HTML>
> 
> *********************************
> 
> 
> #! /usr/bin/perl -w
> use strict;
> use HTTP::Request::Common;
> use LWP::UserAgent;
> 
> my $browser = LWP::UserAgent->new;
> my @seq;
> my $count =0;
> 
> my $infile = "my_test_file"; #input my Fasta file
> 
> open INPUT, "$infile" or die "can not open $infile:$!"; open 
> OUTPUT, ">>$infile.ChloroP.res" or die "Cannot create the 
> output file: $!";
> 
> @seq = <INPUT>;
> my $total = @seq;
> 
> foreach my $item (@seq){
>         $count ++;
>         chomp $item;
>          my $response =
> $browser->post('http://www.cbs.dtu.dk/cgi-bin/nph-webface',
>                        [ "SEQPASTE" => "$item",
>                        	 "submit" => "Submit"]
>                          );
>           warn "WARN!: ", $response->status_line, "\n" unless 
> $response->is_success;
> 
>           if($response->is_success){
>                   my $result = $response->content;
>                   open OUTPUT, ">>$infile.ChloroP.res" or die 
> "Cannot create the output file: $!";
>                   print OUTPUT "$result\n";
>                   print OUTPUT 
> "\n*********************************\n\n\n";
>             }
>   print "$count of $total finished\n";
>   }
> 
>  close OUTPUT;
>  close INPUT;
> 
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l
> 



More information about the Bioperl-l mailing list