我尝试访问和使用 NCBI 中的不同页面,例如
http://www.ncbi.nlm.nih.gov/nuccore/NM_000036
但是,当我使用 perl 的 LWP::Simple 'get' 函数时,我没有得到相同的结果手动保存页面时得到的输出(使用 Firefox 浏览器的“另存为 html”选项)。我从“get”函数中得到的缺少我需要的数据。
难道我做错了什么?我应该使用其他工具吗?
我的脚本是:
use strict;
use warnings;
use LWP::Simple;
my $input_name='GENES.txt';
open (INPUT, $input_name ) || die "unable to open $input_name";
open (OUTPUT,'>', 'Selected_Genes')|| die;
my $line;
while ($line = <INPUT>)
{
chomp $line;
print OUTPUT '>'.$line."\n";
my $URL='http://www.ncbi.nlm.nih.gov/nuccore/'.$line;
#e.g:
#$URL=http://www.ncbi.nlm.nih.gov/nuccore/NM_000036
my $text=gets($URL);
print $text."\n";
$text=~m!\r?\n\r?\s+\/translation="((?:(?:[^"])\r?\n?\r?)*)"!;
print OUTPUT $1."\n";
}
提前致谢!