[Biopython-dev] derive from Seq

Matthias Bernt MatatTHC at gmx.de
Wed Feb 17 08:33:11 UTC 2010


Hi, 

I'm dealing with circular sequences. Thus, I need some specialised functions (e.g. getting a subsequence). Furthermore, for me it seems to be the natural way to extend the functionality of Seq to my own needs. 
But, maybe this is not the best way. 

Matthias


> > Hi Matthias;
> >
> >> I've implemented a class derived from Seq. Many of the Seq functions
> >> return Seq. Thus, I can not use those functions because I need
> >> instances of the derived class.
> >>
> >> This can easily be fixed by returning:
> >>
> >> self.__class__( .. )
> 
> We debated this on the mailing list a while ago (I'd hack to search
> a little harder to find the thread). While switching to this form makes
> subclassing easier in some cases, it doesn't in all.
> 
> > More generally, it is interesting that you are subclassing Seq. Can
> > you describe your application for this? ... I'd be interested in
> > hearing ... additional functionality is needed on a Seq object.
> >
> > Brad
> 
> Last time this (subclassing the Seq object) was mentioned, the
> specific use was to change the equality operations to be string
> like. This is a change we're considering making in Biopython itself
> (and again was something Brad, Michiel and I chatted about
> last week - I will be sending out an email about that next week,
> I'm on holiday right now and haven't had internet access till
> today).
> 
> But to echo Brad, use cases for subclassing the Seq are
> of great interest.


-- 
NEU: Mit GMX DSL über 1000,- ¿ sparen!
http://portal.gmx.net/de/go/dsl02



More information about the Biopython-dev mailing list