甚至不性感,但它可以工作(基于 HTML::Treebuilder 模块)——你必须解析 HTML 并提取信息。在此示例中,结果将作为 csv 存储在文件“result.txt”中
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;
}