HelplessEskimo has asked for the wisdom of the Perl Monks concerning the following question:

Probably a ridiculously easy problem to fix but I am losing what little hope and hair I have left in trying to get it running

This line of code produces the error below

my $out=(); $out = Bio::AlignIO->new(-file => $array[3], -format => 'fasta +');

------------- EXCEPTION: Bio::Root::Exception -------------
MSG: Could not read file 'X.fasta': No such file or directory
STACK: Error::throw
STACK: Bio::Root::Root::throw
/home/depledge/perl5/lib/perl5/Bio/Root/Root.pm:449
STACK: Bio::Root::IO::_initialize_io /home/depledge/perl5/lib/perl5/Bio/Root/IO.pm:270
STACK: Bio::AlignIO::_initialize /home/depledge/perl5/lib/perl5/Bio/AlignIO.pm:401
STACK: Bio::AlignIO::new /home/depledge/perl5/lib/perl5/Bio/AlignIO.pm:311
STACK: Bio::AlignIO::new /home/depledge/perl5/lib/perl5/Bio/AlignIO.pm:332
STACK: GetSubSequence.pl:72
-----------------------------------------------------------

Replies are listed 'Best First'.
Re: Bio::AlignIO help needed...
by Athanasius (Archbishop) on Aug 23, 2014 at 16:08 UTC

    Hello HelplessEskimo, and welcome to the Monastery!

    Although it looks bizarre, that is simply the error message thrown by Bio::AlignIO->new() when the specified file does not exist. I verified this as follows:

    So, I suggest you add the following immediately before the call to Bio::AlignIO->new():

    use Cwd; printf "Current working directory: '%s'\n", getcwd; printf "Fasta file to read: '%s'\n", $array[3];

    to verify that the -file parameter you are passing to new really does name a file which exists in the current working directory.

    Hope that helps,

    Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,