[Bioperl-l] Bio::FeatureIO::gff bug?

Sendu Bala bix at sendu.me.uk
Tue Sep 25 10:00:20 UTC 2007


Hilmar Lapp wrote:
> On Sep 24, 2007, at 9:35 AM, Chris Fields wrote:
>> I think that'll work fine.  The other option would be call a
>> print_gff_header() function within write_feature() with the intent to
>> print the header only once, using a flag or similar:
>>
>> if (!$self->header_printed) {
>>      $self->print_gff_header;
>>      $self->header_printed(1);
>> }
 >
> I'd lean toward this or a similar approach too. Writing stuff out in the 
> constructor doesn't feel like the best design.

I'd argue that the alternative is just inefficient with no compensating 
benefit. You have something that must only be done once, and a method 
(_initialize) that is only called once. The constructor is used to set 
up the file, getting it into a state ready to add features. This 
involves opening it for writing with the correct filename and setting 
the desired GFF version. Why wouldn't it also output what ever else was 
necessary it initialize the file?

Also, what do we expect should happen when we use Bioperl to create a 
GFF file and don't write any features to it? Should it be an empty file, 
or should it contain whatever GFF information the user had managed to 
supply (the version)?



More information about the Bioperl-l mailing list