This is the code I have until now, it is telling me Odd number of elements in hahs assigment at line 17, any ideas
#the file name
$filename= hwk2.seq;
use strict;
use warnings;
use lib '/class/bi617a/share/textbook';
use BeginPerlBioinfo;
#Declare initialize the variables
my @file_data=();
my %seqs= '';
my $query= '';
my $dna= '';
#Read the contents of the file hwk3.seq
@file_data=get_file_data("hwk2.seq");
print "Please enter the clone ID:\n";
$query=<STDIN>;
chomp $query;
my $seqs= &get_fasta(@file_data);
if (exists $seqs{$query}) { print " This is the sequence: $seqs{$query
+},
\n";
}
else{ print "Not an ID\n\n;";}
exit;
sub get_fasta{
my $header;
my $first = 0;
for my $file_data(@file_data){
if ($file_data =~ /^>/) {
$query = $file_data;
$query=~ s/^>//;
$query=~ s/\s,*//;
if ($first == 0) {
$first =1;
}
next;
}
if ($first == 0) {die("Not a standard FASTA file.\n"); }
$seqs{$query} = $file_data;
return \%seqs;
}
}
return \%seqs;
}
}
|