[Bioperl-l] [Proposed change] HSP::frame()

Chris Fields cjfields at uiuc.edu
Mon Apr 21 15:07:17 UTC 2008


I have noticed (in relation to bug 2485, http://bugzilla.open-bio.org/show_bug.cgi?id=2485) 
  that the Bio::Search::HSP::GenericHSP frame() method is implemented  
very differently from strand(), start(), end(), and most other HSP  
methods.  The current behavior is to return an array of two values  
(query and hit frame) under list conditions, the query frame if one  
value is passed, and the subject frame if no value is passed under  
scalar context and both under list context.  The latter behavior is  
unfortunately leading to the aforementioned bug above.  The method is  
also implied to be a getter/setter, but the implementation doesn't  
allow that; it always sets to the instantiated values (in fact,  
repeatedly so).

In order to fix that and make the interface more consistent I am  
changing frame() to behave like strand(), etc., in that the first  
argument is 'query/subject/hit/list' (default = 'query' if no arg  
specified) and the rest optional values for setting, in query/subject  
order.

One issue: I can catch and imitate most of the older behavior with a  
few additional checks, the one exception being the old frame() default  
return value which is now 'query' (not context-dependent).  If needed  
we can change the default to 'hit', but I believe method consistency  
is probably the better route, and I can always add a warning under old  
API circumstances indicating the change.

I am also modifying HSPTableWriter to print frame_hit and frame_query  
(previously it was only printing 'frame', which implied the hit  
frame).  I can see this being an issue with anyone expecting 'frame'  
instead of 'frame_hit';  I could hack in a fix for that if needed.

If there aren't any objections or suggestions, I'll commit this in the  
next day or two.

chris



More information about the Bioperl-l mailing list