[Bioperl-l] different syntaxes for SeqI constructor and Factory constructor?

Brian Osborne bosborne11 at verizon.net
Thu Dec 7 19:32:21 UTC 2006


Chris,

The latest StandAloneBlast takes "dashed parameters", as in:

 @params = (-database => 'swissprot',-outfile => 'blast1.out');
 $factory = Bio::Tools::Run::StandAloneBlast->new(@params);

Or

 my $factory = Bio::Tools::Run::StandAloneBlast->new(-program =>"wublastp",
                                                     -database=>"swissprot",
                                                     -e => 1e-20);

So that's why I asked "what version?"

Someone made the change to allow dashes in @params a few months ago and I
believe that that someone was you!

Brian O.


On 12/7/06 1:44 PM, "Chris Fields" <cjfields at uiuc.edu> wrote:

> 
> On Dec 6, 2006, at 9:13 PM, zhihua li wrote:
> 
>> Hi netters,
>> 
>> Recently I found this:
>> 
>> For constructing a new SeqI object, I had to write:
>> $seq_obj=Bio::SeqIO->new(
>>      -file => '/home/myfile',
>>      -format => 'Fasta');              #Note the dash before the
>> two arguments.
>> 
>> If I omitted the dash:
>> $seq_obj=Bio::SeqIO->new(
>>     file => '/home/myfile',
>>     format => 'Fasta');
>> I'd get error:
>> MSG: Unknown format given or could not determine it []
>> STACK Bio::SeqIO::new /usr/lib/perl5/site_perl/5.8.7/Bio/SeqIO.pm:377
>> 
>> So it seems to me that the dashes before the arguments are
>> essential.  However, when I tried to build a factory for
>> StandaloneBlast, I found the other way around.
>> 
>> If the script had the dash:
>> $blast_obj=Bio::Tools::Run::StandAloneBlast->new(
>>             -program => 'blastn',
>>             -database => '/home/mydatabase');
>> 
>> I'd get the error message: MSG: Unallowed parameter: - !
>> STACK Bio::Tools::Run::StandAloneBlast::AUTOLOAD /usr/lib/perl5/
>> site_perl/5.8.7/Bio/Tools/Run/StandAloneBlast.pm:433
>> STACK Bio::Tools::Run::StandAloneBlast::new /usr/lib/perl5/
>> site_perl/5.8.7/Bio/Tools/Run/StandAloneBlast.pm:400
>> 
>> If I left out the dash by saying:
>> $blast_obj=Bio::Tools::Run::StandAloneBlast->new(
>>             program => 'blastn',
>>             database => '/home/mydatabase');
>> 
>> Everyting is fine.
>> 
>> Now I'm confused. Why sometimes I have to add the dash, while
>> sometimes I'm not allowed to?
>> 
>> Thanks in advance!
> 
> I agree that this should be more consistent.  Does anyone know the
> reasoning for this?
> 
> Christopher Fields
> Postdoctoral Researcher
> Lab of Dr. Robert Switzer
> Dept of Biochemistry
> University of Illinois Urbana-Champaign
> 
> 
> 
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l





More information about the Bioperl-l mailing list