Search code examples
perlbioperl

BIO-Perl Error when running the first program


I tried to run bio perl using Eclipse.

The code I tried to execute is:

use Bio::Seq;
$seq_obj = BIO::Seq->new(-seq=> "atcgatgcatgcatgcatgc", -alphabet=> 'dna');
#print $seq_obj->seq;

And I got the following error:

Can't locate object method "new" via package "BIO::Seq" (perhaps you forgot to load "BIO::Seq"?) at C:/2ndSemester/BIO424-DevelopBioinformaticTools/PerlPrograms/BIOPerlExamples/TestBIOPerl1.pl line 3.

Anybody knows why this error occured?


Solution

  • The class is called Bio::Seq, not BIO::Seq. Perl is case sensitive so you want to say:

    $seq_obj = Bio::Seq->new(-seq=> "atcgatgcatgcatgcatgc", -alphabet=> 'dna');
    

    Note the "Bio" rather than "BIO".