-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatically create custom derived classes with e.g. closest
#5
Comments
working on this now. |
so we can do this, but you can't add slots declarations to a dynamically generated class, so we'd have to use another arbitrary name. the other problem is that if you have a bed file, it might only contain 4 columns, but the slots dictionary has 12. ... having trouble thinking how to do it cleanly. |
'doh. i'll have to play with slots some more, i was hoping that sort of thing would be solved with a does this help at all? (from http://docs.python.org/reference/datamodel.html#slots):
|
yeah, the problem is that you can't define the slots dynamically. so neither:
nor:
will work. because the slots are defined at, um, compile time. which makes sense, in retrospect... i left what i had at my work machine, i can check it in on monday. |
Ah now I see. It make sense now after seeing it written out like that. Do you think it's worth having a DerivedFeature base class that acts similarly to Feature but doesn't have the speed of slots? Though I guess that would mean copying all the GFFFeature, BedFeature, etc code to the new DerivedGFFFeature, DerivedBedFeature etc . . . which would get ugly fast. |
yes, i think that might work. i will (time allowing) prototype on monday. it wont take too long, just have to change init et al to use _dynamic_slots instead of slots and it wont require copying all of them, only the Feature class will have an orthologous DynamicFeature... i think. |
cool. take your time, no rush. |
so i put what i had for the start of this here: https://gist.github.com/890525 it's not working because of the slots stuff we mentioned above. and it's pretty ugly.
but i think the way i have it set up is too complex--and fragile because it depends on the column numbers. any ideas? |
tricky . . . i'll have to think about this and fiddle around some more. i agree, the column numbers seems easy to break, but then again that's what the "canonical" feature classes are using to parse a line into slots in the first place, so that part is prob fine. |
from comments on https://gist.github.com/887065 :
The text was updated successfully, but these errors were encountered: