[gt-users] get feature by ID
Brent Pedersen
bpederse at gmail.com
Thu Feb 12 17:45:14 CET 2009
On Thu, Feb 12, 2009 at 3:31 AM, Gordon Gremme <gremme at gmail.com> wrote:
>>> i do this often enough that i just wrote a FeatureIndexMemory subclass
>>> to automatically
>>> create a dict with key => value of ID => gt_pointer. then the
>>> FeatureNode object is not
>>> created until it's actually requested.
>>> i also had some fun abusing the python slicing syntax. usage and
>>> implementation here:
>>> http://gist.github.com/62359
>>>
>>> it currently doesn't handle potentially repeated ID's... but i'm
>>> usually just dealing with a single file at a time.
>>
>> Looks very convenient and intuitive (python-like) to use. If this can be
>> extended to handle ID clashes as well (e.g. by using the filename as an
>> additional key which is optional if there is only one file), it may find
>> its way into the official bindings. Any comments?
at least in python, this could be done by having the with_ids kwarg
accept a collision
strategy so it would either 'append', 'raise' or 'ignore'. where only
'append' would
keep a list.
>
> Another possibility would be to return an array of all Features with
> the given ID.
>
> Wouldn't it make more sense to have this functionality on the C-side?
> It's not complicated to implement.
> This way it would be available for all bindings without reimplementing
> it for every binding.
is it also possible for feature_index_memory_new() to take an optional
...args list of gff3files?
>
> Gordon
> _______________________________________________
> gt-users mailing list
> gt-users at genometools.org
> http://genometools.org/mailman/listinfo/gt-users
>
More information about the gt-users
mailing list