甚至沒有性感,但它的工作原理(基於HTML :: Treebuilder模塊) - 你必須解析HTML並提取信息。在這個例子中,結果會被存儲爲文件「的Result.txt」 CSV
use LWP::Simple;
use HTML::TreeBuilder;
my $uniprot= "P15700";
my $url= "http://wwwdev.ebi.ac.uk/interpro/ISearch?query=$uniprot+";
my $resp = get($url);
my $tree = HTML::TreeBuilder->new_from_content($resp);
my $first=$tree->look_down(_tag => 'div',class => 'prot_fam') ;
$first=$first->look_down(_tag => 'div',class => 'entry-parent');
$first=$first->look_down(_tag => 'div',class => 'entry-parent');
$first=$first->look_down(_tag => 'a');
open (FH,">>result.txt");
print FH $uniprot.";";
print FH $first->content_list;
print FH "\n";
close(FH);
編輯: 下面是檢查「uniprots」的很多的變體。玩弄
use LWP::Simple;
use HTML::TreeBuilder;
my @ports=qw(Q9H4B7 Q96RI1 P04150 P35354 P23219 P61073 P0A3M6 Q8DR59 Q7CRA4 Q27738 P35367 P35367 P35367 P08172 P35367 P10275 P25021 P07550 P08588 P13945);
for (my $i=0;$i < scalar(@ports);$i++) {
my $url= "http://wwwdev.ebi.ac.uk/interpro/ISearch?query=".$ports[$i]."+";
my $resp = get($url);
my $tree = HTML::TreeBuilder->new_from_content($resp);
my $first=$tree->look_down(_tag => 'div',class => 'prot_fam') ;
$first=$first->look_down(_tag => 'div',class => 'entry-parent');
$first=$first->look_down(_tag => 'div',class => 'entry-parent');
$first=$first->look_down(_tag => 'a');
open (FH,">>result.txt");
print FH $ports[$i].";";
print FH $first->content_list;
print FH "\n";
close(FH);
sleep 10;
}
爲什麼要解析HTML,當你在你的手得到了無數Webservices的sleepdelay?看看[dbfetch](http://www.ebi.ac.uk/Tools/dbfetch/)工具([example](http://www.ebi.ac.uk/Tools/dbfetch/dbfetch?db = uniprotkb&id = P15700&format = annot&style = default&Retrieve = Retrieve)) - 如果它是「只是」Interpro已經有[Perl客戶端](http://www.ebi.ac.uk/Tools/webservices/services/pfa/ iprscan_rest)。然後是[BioPerl](https://metacpan.org/module/BioPerl) - 特別是[Bio :: Index :: EMBL](https://metacpan.org/module/Bio::Index::EMBL)。 –
Sebastian Stumpf,通過實際的代碼示例來回答問題的要求,並保證有一個滿意的答案。 – daxim