[Bioperl-l] Sporadic Failure to retrieve Sequence Objects from GenPept

Torsten Seemann torsten.seemann at infotech.monash.edu.au
Sat Mar 18 03:29:35 UTC 2006


Warren,

> 	I am getting a sporadic error running a script.  The code fragment  
> that is failing is
> 	foreach $gi (@ginumbers){
> 		$find_gi = $gi;

This line is the problem:

> 		$find_gi =~ s/gi(\d+)/"$1"/;

You are converting gi73998177 to "73998177"
ie. you are adding double quotes to it.

Then you try and lookup and id called "733998177" (with quotes!) rather than 
the integer alone:

> 		$seq_object = $database -> get_Seq_by_id("$find_gi");
> 		$description = $seq_object -> desc;      #line 54
> 		$species_object = $seq_object -> species;
> 		$species_name = $species_object -> binomial;
> 
> It is returning a message like this, although the gi number that it  
> fails on varies from run to run.
> -------------------- WARNING ---------------------
> MSG: id ("73998177") does not exist

The confusing part here is that these double-quotes are yours, not part of the 
BioPerl's error message :-)

> ---------------------------------------------------
> Can't call method "desc" on an undefined value at gi_to_name.pl line 54.

# defensive programming, add this line
die "could get get_Seq_by_id($find_gi)" if not defined $seq_object;

-- 
Torsten Seemann
Victorian Bioinformatics Consortium, Monash University, Australia
http://www.vicbioinformatics.com/
Phone: +61 3 9905 9010



More information about the Bioperl-l mailing list