NAME

Hmm - Indexes HMM datafile


SYNOPSIS

  use Index::Hmm;


DESCRIPTION

  This package is used to index HMM datafiles (profiles).
  It indexes the file by the accession number (ACC xxx) and by name (NAME xxx).
  #HMMER2.0  [2.2g]
  #NAME  0008074 56436
  #LENG  172
  #ALPH  Amino
  #RF    no
  #CS    no
  #MAP   no
  #ACC   0008074
  #DESC  C-type lectin-like
  #COM   This model comes under the license at http://supfam.org/SUPERFAMILY/license.html
  #COM   SUPERFAMILY http://supfam.org Julian Gough <gough@supfam.org>
  #NSEQ  0
  #DATE  2003-07-23
  #XT      -8455     -4  -1000  -1000  -8455     -4  -8455     -4 
  #NULT      -4  -8455
  #NULE     595  -1558     85    338   -294    453  -1158    197    249    902  -1085   -142    -21   -313     45    531    201    384  -1998   -644 
  #EVD   -10.945670   0.657704
  #HMM        A      C      D      E      F      G      H      I      K      L      M      N      P      Q      R      S      T      V      W      Y    
  #         m->m   m->i   m->d   i->m   i->i   d->m   d->d   b->m   m->e
  #          -70      *  -4407
  #     1   -458   -685    252   -522    374   -272     78     28   -136   -423    733    451    362    418    286    265   -276   -311    -39      1 
  #     -     44    -28    112     50    -33   -138    118     78    117   -185     59     62   -290     60    -80    -87     60    143    -91    126 
  #     -    -29  -7169  -6598  -1906   -448  -3170   -170  -1070  -8418 
  #     2   -406    625  -1191   -872    345   -607     35     13   -377    178   1236   -129    807   -452    435   -344   -243     38    236    926
  # ...
  # examples here
  use Index::Hmm;
  my($res, $msg, $index);
  ($res, $index) = new Index::Hmm($file); #Hmm file to index
  die $index unless $res;
  #This input record delimeter is used when retrieving an entry from a file.
  ($res, $msg) = $index->setRecDel('dumper', '\n//');
  die($msg) unless($res);
  #This input record delimeter is used during the building of the index file. It reads the file line by line
  #and need a specific pattern to record the position in the file.
  ($res, $msg) = $index->setRecDel('building', '//');
  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 = 'SM00135';
  my ($res, $pos) = $index->getIndex($id); #return the position in the file for 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 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 entry.
  $name = $name->[0] if $name;
  my ($res, $name) = $index->getField(['ac', 'name', 'desc']); #return the ac, name and description of this 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 entry.
  $name = $name->[0] if $name;
  #or simplier
  my ($res, $name) = $index->getField('name', \$entry); #return the name of this entry by parsing it on the fly
  $name = $name->[0] if $name;


VERSIONS

$Id: Hmm.pm.html,v 1.1.1.1 2005/08/18 13:18:25 hunter Exp $

Copyright (c) European Bioinformatics Institute 2002


AUTHORS / ACKNOWLEDGEMENTS

Emmanuel Quevillon <tuco@ebi.ac.uk>

new

 Description:  Create a new object Index::HMM.
 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

_init

       Description: Initialize record delimiter, file and parse configuration file from index configuration file.
       Argument:    
       Returns:     1, '' on success
                    0, msg on error