[Bioperl-l] NCBI BLink

Paulo Almeida palmeida at igc.gulbenkian.pt
Tue Jan 18 14:49:08 EST 2005


Is anyone working on a parser for BLink? I found a module by Rob Edwards
(http://www.salmonella.org/bioperl/Blink.pm), but I wanted to have the
Best Hits page, so I added an extra parameter (-besthits) to that module,
which you set to '1' to have the desired behavior.

I'm attaching the .diff file and the module itself.

--
Paulo Almeida
Instituto Gulbenkian de Ciencia
Apartado 14, 2781-901, Oeiras, PORTUGAL
tel  +351 21 446 46 35
fax  +351 21 440 79 70
http://www.igc.gulbenkian.pt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: BlinkNew.pm
Type: text/x-perl
Size: 11386 bytes
Desc: not available
Url : http://portal.open-bio.org/pipermail/bioperl-l/attachments/20050118/b721ccdc/BlinkNew.bin
-------------- next part --------------
115c115
<     my ($gi, $cutoff) = $self->_rearrange([qw(GI CUTOFF)], @args);
---
>     my ($gi, $cutoff, $besthits) = $self->_rearrange([qw(GI CUTOFF BESTHITS)], @args);
117a118
>     $self->{besthits}=$besthits || 0;
154a156,171
> =head2 besthits
> 
> Title	: besthits
> Usage	: $blink->besthits($besthits)
> Function: Get/Set All Hits or Best Hits
> Returns	: Current status
> Args	: 1 for best hits, anything else for all hits
> 
> =cut
> 
> sub besthits {
>  my ($self, $val)=@_;
>  if ($val) {$self->{besthits}=$val}
>  return $self->{besthits}
> }
> 
208a226
>  $header{'org'}=$self->{besthits};
256,257c274,278
<  return ($self->{$r2r}->{bl2sqlurl}, $self->{$r2r}->{score}, $self->{$r2r}->{p}, $self->{$r2r}->{prot2url}, 
<          $self->{$r2r}->{p2acc}, $self->{$r2r}->{p2blinkurl}, $self->{$r2r}->{p2gi}, $self->{$r2r}->{p2desc});
---
>  
>   return ($self->{$r2r}->{bl2sqlurl}, $self->{$r2r}->{score}, $self->{$r2r}->{p}, $self->{$r2r}->{prot2url},
>           $self->{$r2r}->{p2acc}, $self->{$r2r}->{p2blinkurl}, $self->{$r2r}->{p2gi}, $self->{$r2r}->{p2desc}) if $self->{besthits} != 1;
>   return ($self->{$r2r}->{bl2sqlurl}, $self->{$r2r}->{score}, $self->{$r2r}->{p}, $self->{$r2r}->{prot2url},
>           $self->{$r2r}->{p2acc}, $self->{$r2r}->{p2blinkurl}, $self->{$r2r}->{p2gi}, $self->{$r2r}->{p2desc}, $self->{$r2r}->{hitsurl}, $self->{$r2r}->{hits}) if $self->{besthits} == 1;
259c280
< 
---
> 		
284c305,307
<          $self->{$r2r}->{p2acc}, $self->{$r2r}->{p2blinkurl}, $self->{$r2r}->{p2gi}, $self->{$r2r}->{p2desc});
---
>          $self->{$r2r}->{p2acc}, $self->{$r2r}->{p2blinkurl}, $self->{$r2r}->{p2gi}, $self->{$r2r}->{p2desc}) if $self->{besthits} != 1;
>   return ($self->{$r2r}->{bl2sqlurl}, $self->{$r2r}->{score}, $self->{$r2r}->{p}, $self->{$r2r}->{prot2url},
> 	           $self->{$r2r}->{p2acc}, $self->{$r2r}->{p2blinkurl}, $self->{$r2r}->{p2gi}, $self->{$r2r}->{p2desc}, $self->{$r2r}->{hitsurl}, $self->{$r2r}->{hits}) if $self->{besthits} == 1;
317a341
>    next if (m#SCORE.*P.*ACCESSION#);
326,328c350
<    (m#^.*?onclick.*?href=(\S+?)>(\d+)</a>\s+(\d+)<img src.*?href=(\S+).*?>(\S+)</a>.*?<a.*?onclick.*?href=(\S+)>(\d+)</a>(.*?)$#i);
<      
< # fix vi!
---
> #   print STDERR "\n", $self->{besthits}, "\n";
330c352,359
<    unless ($1 && $2 && $3 && $4 && $5 && $6 && $7 && $8) {print STDERR "Couldn't parse\n$_\n"; next}
---
>    (m#^.*?onclick.*?href=(\S+?)>(\d+)</a>\s+(\d+)<img src.*?href=(\S+).*?>(\S+)</a>.*?<a.*?onclick.*?href=(\S+)>(\d+)</a>.*?<a.*?href=(\S+)>(\d+)</a>.*?<i>(.*?)</i>$#i) if $self->{besthits} ==1;  
>    unless  (($1 && $2 && $3 && $4 && $5 && $6 && $7 && $8 && $9 && $10) || ($self->{besthits} !=1))
>    {print STDERR "Couldn't parse\n$_\n"; next}
> 	 
>    (m#^.*?onclick.*?href=(\S+?)>(\d+)</a>\s+(\d+)<img src.*?href=(\S+).*?>(\S+)</a>.*?<a.*?onclick.*?href=(\S+)>(\d+)</a>(.*?)$#i) if $self->{besthits} != 1;
>    unless (($1 && $2 && $3 && $4 && $5 && $6 && $7 && $8) || ($self->{besthits}==1))
>    {print STDERR "Couldn't parse\n$_\n"; next}
>    
341c370,375
<    $self->{$rcount}->{p2desc}=$8;
---
>    if ($self->besthits != 1 ) { $self->{$rcount}->{p2desc}=$8; }
>    else {
>    $self->{$rcount}->{hitsurl}=$8;
>    $self->{$rcount}->{hits}=$9;
>    $self->{$rcount}->{p2desc}=$10;
>    }


More information about the Bioperl-l mailing list