[Bioperl-l] Trouble with fetching a sequence from indexed fasta file

Oliver Homann homann at wi.mit.edu
Wed Apr 27 23:09:53 EDT 2005

Hello everyone,

First off, thanks to those of you that advised my about bioperl 
installation.  I was eventually able to install using the Fedora core 2 
version at biolinux.com (it seems to work so far).

I'm writing now in the hopes that someone can help resolve a bit of 
beginner's confusion that is currently plaguing me.  Specifically, I'm 
trying to fetch sequences from a large indexed fasta file using the code 
posted below.  I;'ve left out everything but the relevant section.  The part 
that has me puzzled is that my string of IDs that I'm using to fetch the 
sequences only works when entered manually into the fetch() method.  In 
other words, the block below doesn't work, nor does the version without the 
extra $id = 'orf...' line.  These approaches yield the error message "Can't 
call method seq on an undefined value".  However, it DOES work if I relpace 
fetch($id) with fetch ('orf19.1168.prot_[A.aaa]').  Could someone please 
explain to me why this is the case?  I suspect I'm missing something 
fundamental here...

Many thanks!

my $inx = Bio::Index::Fasta->new('/home/oliver/Sequences/proteins.idx');

foreach my $id(@idlist) {

print "$id \n";

$id = 'orf19.1168.prot_[A_aaa]';

my $seq_obj = $inx->fetch($id);

my $sequence = $seq_obj->seq;

print "$sequence \n";


More information about the Bioperl-l mailing list