http://www.ncbi.nlm.nih.gov/nuccore/NM_000036などの NCBI の別のページにアクセスして使用しようとしていますが、
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";
}
前もって感謝します!