[gt-users] New feature announcement

Brent Pedersen bpederse at gmail.com
Mon Jan 26 17:28:06 CET 2009


On Sat, Jan 24, 2009 at 12:34 PM, Brent Pedersen <bpederse at gmail.com> wrote:
> On Sat, Jan 24, 2009 at 3:40 AM, Sascha Steinbiss
> <steinbiss at zbh.uni-hamburg.de> wrote:
>> Brent Pedersen wrote:
>>> thanks! is the z_index going into the main repo soon?
>>
>> Yes, this may happen quite soon.
>>
>>> also, a couple stylistic questions.
>>> 1) would you accept a patch that switches the use of e.g.
>>> Feature.create() and Feature.__init__() i think it's more idiomatic to
>>> be able to do
>>>>>> f = FeatureNode(seqid, "gene", 100, 900, "+")
>>> and then
>>>>>> f = FeatureNode.create(ptr)
>>> than vice-versa and it could rename to FeatureNode.create_from_ptr()
>>
>> I agree. What does Gordon think of this? This is an interface change, so
>> I would rather not decide this alone.
>>
>>> 2) would you accept a patch that implements python descriptors so one can use:
>>>>>> fnode.strand
>>> '+'
>>>>>> fnode.strand = '-'
>>> instead of fnode.get/set_strand() ?
>>
>> I think it would be best if both methods were available so the interface
>> is not too divergent from the C "get/set" method names. Otherwise, this
>> sounds more Python-like, of course.
>>
>
> the changes i made do keep the original methods.
>
>>> if either both of those seem reasonable, i'll upload a patch to the tracker.
>>
>> Thanks! I have already pulles your changes from github and keep them in
>> a separate branch, ready to merge if everything is ok. I did some minor
>> cleanup though (the old FeatureNode constructor was also called in the
>> RecMap, FeatureIndex and Block classes,so I adapted them).
>>
>
> oops. i guess did the search and replace in the wrong order.
> and next time, i'll create a branch. i just did that locally then
> merged into my master.
>
>>> -brent
>>
>> Have a nice weekend,
>> Sascha
>>
>> --
>> Sascha Steinbiss
>> Center for Bioinformatics
>> University of Hamburg
>> Bundesstr. 43
>> 20146 Hamburg
>> Germany
>>
>> Email:  steinbiss at zbh.uni-hamburg.de
>> URL:    http://www.zbh.uni-hamburg.de/steinbiss
>> Phone:  +49 (40) 42838 7322
>> FAX:    +49 (40) 42838 7312
>>
>> _______________________________________________
>> gt-users mailing list
>> gt-users at genometools.org
>> http://genometools.org/mailman/listinfo/gt-users
>>
>

hi again,
on a sorta related question:
should a FeatureStream yield FeatureNodes? currently, it's
GenomeNodes. i tried to implement with the patch below, and ti works
for
soem cases, but segfaults for others. i think there may be a problem
with the FeatureNode.create_from_ptr() that i added when it needs
a newref(?).


diff --git a/gtpython/gt/annotationsketch/feature_stream.py
b/gtpython/gt/annotationsketch/feature_stream.py
index 2b8d8c8..45d02f7 100644
--- a/gtpython/gt/annotationsketch/feature_stream.py
+++ b/gtpython/gt/annotationsketch/feature_stream.py
@@ -18,6 +18,7 @@
 from gt.dlload import gtlib
 from gt.annotationsketch.feature_index import FeatureIndex
 from gt.extended.genome_stream import GenomeStream
+from gt.extended.feature_node import FeatureNode

 class FeatureStream(GenomeStream):
   def __init__(self, genome_stream, feature_index):
@@ -30,6 +31,12 @@ class FeatureStream(GenomeStream):
     return obj._as_parameter_
   from_param = classmethod(from_param)

+  def next_tree(self):
+      gnode = GenomeStream.next_tree(self)
+      if gnode is None:
+          return None
+      return FeatureNode.create_from_ptr(gnode, True)
+
   def register(cls, gtlib):
     gtlib.gt_feature_stream_new.restype = c_void_p
     gtlib.gt_feature_stream_new.argtypes = [GenomeStream, FeatureIndex]


More information about the gt-users mailing list