2017-04-04 26 views
1

我用perl程序,使這隻需一個序列在時間發現的圖案生物信息學服務器,把我的序列($ SEQ),同時從文本文件(example.txt)包含6000多個超過10000bp的序列。問題是當我的序列超過1408bp時,由於這樣的長度,我得到URL無法檢索的錯誤。請幫助我解決perl中的這個問題。檢索URL Perl中獲得,因爲方法它對在生物信息學服務器長度

#!usr/bin/perl 
use LWP::Simple; 
my $file = 'example.txt'; 
open my $fh, '<', $file or die; 
$/ = undef; 
$all=<$fh>; 
@other=split(">",$all); 

for($i=1;$i<=$#other;$i++) 
{ 
    my ($first,@other)=split("\n",$other[$i]); 
$seq=join("\n",@other); 
$len=length($seq); 

my $link = "http://regrna2.mbc.nctu.edu.tw/detection_output.php?S1=%3E%0D%0A$seq&tfbs=ON&tfbs_species=rice%2C+Oryza+sativa&RadioGroup1=matrix&matchscore=1&rho=ON&SplicingSite=ON&GeneSplicer_species=Rice&SplicingMotif_species=Homo+sapiens&Polya=ON&RBSfinder=ON&UTRsite=ON&AUrich=ON&RNAediting=ON&RiboSW=ON&ERPIN=ON&Rfam=ON&LongStem=ON&LongStem_len=40&fRNAdb=ON&fRNAdb_similarity=0.9&fRNAdb_match_len=30&miRNA=ON&miRNA_species=Oryza+sativa&score=170&miRNA_FE=-25&ncRNA=ON&ncRNA_species=Oryza_sativa&ncRNA_length=20&ncRNA_FE=-20&S2=&GCratio=ON&GCratio_window_size=100&accessibility=ON&accessibility_window_size=100&unpair_size=6&StartCodon=1&draw_dotline=ON&position_line_interval_len=100&Size=950&B1=Submit"; 

$link =~m/.\/Results\/(\d+)\.all\.result/; 


my $second = get("http://regrna2.mbc.nctu.edu.tw/Results/$1.all.result") or die "cannot retrieve code\n"; 


my $filename = "$first.txt"; 
open(my $fhh, '>', $filename) or die "Could not open file '$filename' $!"; 
print $fhh "$second"; 
close $fhh; 

} 

回答

1

URL長度由客戶端和服務器決定。請參閱:

What is the maximum length of a URL in different browsers?

這樣看來,你可能無法通過get()提交,如字符的長序列的限制可能是服務器端。您可能需要使用POST,在此所說明:

http://lwp.interglacial.com/ch05_07.htm

具體做法是:

但文件上傳部分涉及到一些做。首先,你必須 添加一個'Content_Type'=>'form-data'的標題行,表示是的, 你真的認爲這是一個「multipart/form-data」POSTING。和 其次,在那裏你會在「saywhat」 =>文本字符串,你 而不是有一個數組引用,其中第一陣列產品的路徑 您要上傳的文件。所以它看起來像這樣:

my $response = $browser->post(
    'http://pastel.int/feedback.pl', 
    [ 'subject' => 'Demand for pie.', 
    'saywhat' => ["./today/earth_pies1.dml"], 
    'user' => 'Adm. Kang', 
    ], 
    'Content_Type' => 'form-data', 
    ...any other header lines... 
);