Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: <koriege <at> googlemail.com>
Subject: problem with Bio::*::Fasta id_parser
Newsgroups: gmane.comp.lang.perl.bio.general
Date: Friday 1st February 2013 02:49:20 UTC (over 3 years ago)
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|
 
CD: 3ms