I am trying to download the sequence file from the gene bank database using perl but it shows error. I don't have any guide to correct my program.
Can any one help me with this? The error is in line 6 (use Bio::DB::GenBank;
)
File accnumber.txt is on my desktop and I am running the program from desktop itself. I am using CentOS.
#!usr/bin/perl -w
use strict;
use warnings;
use Bio::DB::GenBank;
open (INPUT_FILE, 'accnumber.txt');
open (OUTPUT_FILE, 'sequence_dwnl.fa');
while()
{
chomp;
my $line = $_;
my @acc_no = split(",", $line);
my $counter = 0;
while ($acc_no[$counter])
{
$acc_no[$counter] =~ s/\s//g;
if ($acc_no[$counter] =~ /^$/)
{
exit;
}
my $db_obj = Bio::DB::GenBank->new;
my $seq_obj = $db_obj->get_Seq_by_acc($acc_no[$counter]);
my $sequence1 = $seq_obj->seq;
print OUTPUT_FILE ">"."$acc_no[$counter]","\n";
print OUTPUT_FILE $sequence1,"\n";
print "Sequence Downloaded:", "\t", $acc_no[$counter], "\n";
$counter++;
}
}
close OUTPUT_FILE;
close INPUT_FILE;
These are errors I get:
Bareword "Bio::DB::GenBank" not allowed while "strict subs" in use at db.pl line 6.
Bareword "new" not allowed while "strict subs" in use at db.pl line 27.
Bareword "seq" not allowed while "strict subs" in use at db.pl line 29.
Execution of db.pl aborted due to compilation errors.