InterPro - InterPro index utilities.
use Index::InterPro;
This package is used to index interpro.xml file. It indexes the database members accession number (see below 'dbkey="foo"').
# examples here use Index::InterPro;
my($res, $msg, $index); ($res, $index) = new Index::InterPro($file); #xml file here for interpro die $index unless $res;
($res, $msg) = $index->setRecDel('dumper', '</interpro>'); die($msg) unless($res);
($res, $r_inx) = $index->buildIndex(['ac', 'name']); #list of entries you want to index. $regexp in this module for allowing rules. die($r_inx) unless($res); #if no argument given, will build the index with all the rules describe in $regexp.
#or you can build the index on your own key-value pairs based on regular expression. Only the first match is taken into account. #so if you want to index multiple things based on the same line, you need to create another key-value pair. ($res, $r_inx) = $index->builIndex({ 'id' => '>(\S+)', 'name' => '^\s+\w+\s+(\S+)' }); die $r_inx unless $res;
($res, $mess) = $index->indexOut($r_inx); #need a reference to hash table. die $mess unless $res;
my $id = 'IPR000342'; my ($res, $pos) = $index->getIndex($id); #return the position in the file of the interpro entry containing this $id. die $pos unless $res;
#getEntry returns a reference to an array in case of multiple entries found. my ($res, $entry) = $index->getEntry($id); #return the complete interpro entry. die $entry unless $res; $entry = $entry->[0] if($entry);
#Either (parsing once the whole entry) my($res, $msg) = $index->parseFields(\$entry); die $msg unless $res;
my ($res, $name) = $index->getField('name'); #return the name of this interpro entry. $name = $name->[0] if $name; my ($res, $name) = $index->getField(['ac', 'name', 'desc']); #return the ac, name and description of this interpro entry. if($name){ my $nm = $name->[0]; my $ac = $name->[1]; my $de = $name->[2]; } .... # see below for fields you can retrieve. my ($res, $name) = $index->get_name(); #return the name of this interpro entry. $name = $name->[0] if $name;
#or simplier my ($res, $name) = $index->getField('name', \$entry); #return the name of this interpro entry by parsing it on the fly $name = $name->[0] if $name;
my ($res, $goterms) = $index->get_goclass(\$entry); #return the GO annotations for this interpro entry. die $goterms unless $res;
$Id: InterPro.pm.html,v 1.1.1.1 2005/08/18 13:18:25 hunter Exp $
Copyright (c) European Bioinformatics Institute 2002
Emmanuel Quevillon <tuco@ebi.ac.uk>
Description: Create a new object Index::InterPro.
Arguments: $file a file to index $tool Do you want to use Dispatcher::Tool to use index.conf values? (optional)
Returns: 1, $self on success 0, msg on failure
Description: Initialize record delimiter, file and parse configuration file from index configuration file. Argument: Returns: 1, '' on success 0, msg on error
Description: Retrieve GO terms tags for an InterPro entry.
Arguments:
Returns: 1, reference to an array containing the go informations. 0, msg on failure
Description: Return the DB name corresponding to the Application given.
Arguments: $entry, reference to a scalar which is the complete entry returned by get_entry subroutine.
Returns: 1, database name or unknown
Description: Retrieve methods informations (acc & name) from an InterPro entry. Arguments: Returns: 1, reference to an array containing strings ('ac: name'). 0, msg on error