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

Hilmar Lapp hlapp at gmx.net
Fri Sep 28 11:36:39 EDT 2007


You do have a point here. From a design perspective, it feels odd if  
instantiating an object can fail with an I/O exception. But in  
reality that's how it's done all the time, from Bio::SeqIO to  
java.io.*, if I'm not mistaken. I also agree that asking a  
conditional that we know will be false every time except once  
violates the sense of elegance.

So upon second consideration, I think I agree with you. And a GFF3  
file with zero features in it should still be a valid GFF3 file,  
i.e., have the mandatory headers.

Does that make sense?

	-hilmar

On Sep 25, 2007, at 6:00 AM, Sendu Bala wrote:

> 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)?

-- 
===========================================================
: Hilmar Lapp  -:-  Durham, NC  -:-  hlapp at gmx dot net :
===========================================================







More information about the Bioperl-l mailing list