甚至没有性感,但它的工作原理(基于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