[Bioperl-l] problem with Bio::*::Fasta id_parser

koriege at googlemail.com koriege at googlemail.com
Fri Feb 1 02:49:20 UTC 2013


Hi,

I tried two methods to create a bioperl FASTA database, but it failes by 
extracting the substring out of my headers.
Can someone explain me why I get the standard header or show me a work 
around? 

thanks in advance.
pyr0

i)
my $objDB = Bio::Index::Fasta->new(-filename => $PATHdbIdx, -write_flag => 
1);
$objDB->id_parser(\&get_id);
$objDB->make_index(glob($objParameter->dbGenome()));

sub get_id {
   my $header = shift;
   $header =~ /^>.*\bsp\|([A-Z]\d{5}\b)/;
   $1;
}

output
Use of uninitialized value $id in concatenation (.) or string at 
/usr/share/perl5/Bio/Index/Abstract.pm line 753, <$FASTA> line 1.
Use of uninitialized value $id in exists at 
/usr/share/perl5/Bio/Index/Abstract.pm line 754, <$FASTA> line 1.
Use of uninitialized value $id in hash element at 
/usr/share/perl5/Bio/Index/Abstract.pm line 757, <$FASTA> line 1.
gi|376282008|ref|NC_016798.1|

ii)
my $PATHdbIdx=catfile($objParameter->DIR,'data','db.idx');
unlink($PATHdbIdx);
my $objDB = Bio::DB::Fasta->new($objParameter->dbGenome(), -makeid => 
\&get_id);
$objDBgenome->set(\$objDB);

output:
Use of uninitialized value $key in pattern match (m//) at 
/usr/share/perl5/Bio/DB/Fasta.pm line 1178.
Use of uninitialized value $id in exists at 
/usr/share/perl5/Bio/DB/Fasta.pm line 617.
gi|376282008|ref|NC_016798.1|



More information about the Bioperl-l mailing list