[Bioperl-l] [Bioperl -l] Passing argument via Command line

Iain Wallace iain.m.wallace at gmail.com
Mon Jul 18 07:54:41 EDT 2005


Hi all,

I am wondering if anybody can help me. I am trying to open a sequence file 
and parse it via Bio::SeqIO.

My script works fine if I pass the filename in via the commandline e.g. perl 
test_embl.pl filename.
but it doesn't work if i hard code the filename into the script, and I 
cann't figure out why. 

The only two lines i change are:
#my $seqfile = $ARGV[0]; 
my $seqfile = "HBB_HUMAN.BC007075.embl";

Thanks for any help you can give me

Iain 

--The Script--
use Bio::AlignIO;
use Bio::SeqIO;
use Bio::LocatableSeq;

#my $seqfile = $ARGV[0];
my $seqfile = "HBB_HUMAN.BC007075.embl";
print $seqfile,"\n";
my $input = new Bio::SeqIO->new(
-file => $seqfile,-format=>'EMBL');

while ( my $seq = $input->next_seq() ) {
print $seq->id,"\n";
@features = $seq->get_SeqFeatures(); # just top level
foreach my $feat ( @features ) {
if($feat->primary_tag eq "CDS"){
$cds_obj= $feat->spliced_seq;
$cds_seq=$cds_obj->seq;
my @translated = $feat->each_tag_value('translation');
$translated_seq= $translated[0];
print $translated_seq,"\n";
}
}

}



More information about the Bioperl-l mailing list