[Bioperl-l] BioPerl help with 2D arrays

Nathan Haseley (RIT Student) nsh9351 at rit.edu
Mon Jun 23 19:32:08 UTC 2008


Hello,
   I am writing a script that returns an array of array references to  Bio::Search::HSP::GenericHSP objects (2D array of Bio::Search::HSP::GenericHSP objects).  Whenever I try to call functions such as ->num_identical I get an error message: 
Can't call method "num_identical" without a package or object reference.

Below are the segments of the code that are giving me problems to give you a general idea of what I'm doing.  Is there a way around this?  What am I doing wrong?  Thanks!
Sincerely,
Nathan

my $in = new Bio::SearchIO( -format => 'blast',
				    -file => $file );
my $ j = -1;
while( $result = $in->next_result and ref($result)) {
   ++$j;
   while( $has_species == 0) {
      if( my $hit = $result->next_hit) {
   	if( $hit -> description =~ /$species_names[$i]/i) {
       		$has_species = 1;
   		$temp[$i] = $hit->next_hsp;
       		$result->rewind;
        }
      }
     }   
  $homologs[$j] = [@temp];
.
.
.
return $homologs
.
.
. (eventually in a separate fucntion)
$temp = $homologs[$i]->[$j];
$temp->num_identical;










More information about the Bioperl-l mailing list