[Bioperl-l] genbank to fasta conversion

Robert Buels rmb32 at cornell.edu
Thu Aug 20 16:43:06 EDT 2009


The error is that you are opening a filehandle called $outfile, and then 
you are stringifying it (resulting in a string containing "GLOB(..)", 
and telling Bio::SeqIO write to a file named "GLOB(...)", which it can't 
open.

You probably want to use the -fh arguments for your two uses of 
Bio::SeqIO, either that, or remove your open() calls and pass the 
filenames to the SeqIO objects directly, like:

my $in  =
   Bio::SeqIO->new
    ('-file' => "C:/Documents and Settings/mydir/Desktop/TARGETING.gb",
     '-format' => 'GenBank',
    );

my $out =
   Bio::SeqIO->new
    ('-file' => ">C:/Documents and Settings/mydir/Desktop/TARGET.fa",
     '-format' => 'fasta',
    );


Rob


Mgavi Brathwaite wrote:
> Hello,
> 
> I have previously converted multiple genbank files to fasta. For some reason
> I am having trouble with this simple script.
> #!/usr/bin/perl -w
> use strict;
> use Bio::SeqIO;
> 
> open (my $inFile, "C:/Documents and Settings/mydir/Desktop/TARGETING.gb");
> open (my $outfile, ">C:/Documents and Settings/mydir/Desktop/TARGET.fa");
> my $in  = Bio::SeqIO->new('-file' => "$inFile" ,
>                            '-format' => 'GenBank');
> my $out = Bio::SeqIO->new('-file' => "$outfile" ,'-format' => 'Fasta');
> print $out $_ while <$in>;
> 
> I keep getting the error:
> ------------- EXCEPTION: Bio::Root::Exception -------------
> MSG: Could not open GLOB(0x36a214): No such file or directory
> STACK: Error::throw
> STACK: Bio::Root::Root::throw C:/Perl/site/lib/Bio/Root/Root.pm:359
> STACK: Bio::Root::IO::_initialize_io C:/Perl/site/lib/Bio/Root/IO.pm:310
> STACK: Bio::SeqIO::_initialize C:/Perl/site/lib/Bio/SeqIO.pm:454
> STACK: Bio::SeqIO::genbank::_initialize C:/Perl/site/lib/Bio\SeqIO\
> genbank.pm:202
> STACK: Bio::SeqIO::new C:/Perl/site/lib/Bio/SeqIO.pm:351
> STACK: C:/Perl/site/lib/Bio/SeqIO.pm:377
> -----------------------------------------------------------
> 
> I am probably missing something simple, but would appreciate any help.
> 
> M
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
> 


-- 
Robert Buels
Bioinformatics Analyst, Sol Genomics Network
Boyce Thompson Institute for Plant Research
Tower Rd
Ithaca, NY  14853
Tel: 503-889-8539
rmb32 at cornell.edu
http://www.sgn.cornell.edu



More information about the Bioperl-l mailing list