Exemplo n.º 1
0
 def get_features_for_seqid(self, seqid):
     rval = gtlib.gt_feature_index_get_features_for_seqid(self.fi,
             seqid)
     if rval:
         a = Array(rval, True)
         result = []
         for i in range(a.size()):
             fptr = gtlib.gt_genome_node_ref(a.get(i))
             result.append(FeatureNode.create_from_ptr(fptr))
         return result
     else:
         return None
Exemplo n.º 2
0
 def create_from_ptr(cls, node_ptr, newref=False):
     if node_ptr == 0 or node_ptr == None:
         gterror("GenomeNode pointer cannot be NULL (was: " + str(node_ptr) + ")")
     n = cls()
     if newref:
         n.own = True
         n.gn = gtlib.gt_genome_node_ref(node_ptr)
     else:
         n.own = False
         n.gn = node_ptr
     n._as_parameter_ = n.gn
     return n
Exemplo n.º 3
0
 def create_from_ptr(cls, node_ptr, newref=False):
     if node_ptr == 0 or node_ptr == None:
         gterror("GenomeNode pointer cannot be NULL (was: "+ str(node_ptr) +
                 ")")
     n = cls()
     if newref:
         n.own = True
         n.gn = gtlib.gt_genome_node_ref(node_ptr)
     else:
         n.own = False
         n.gn = node_ptr
     n._as_parameter_ = n.gn
     return n
Exemplo n.º 4
0
 def get_features_for_range(self, start, end, seqid):
     from ctypes import byref
     a = Array.create()
     err = Error()
     rng = Range(start, end)
     rval = gtlib.gt_feature_index_get_features_for_range(self.fi, a,
             seqid, byref(rng), err)
     if rval != 0:
         gterror(err)
     result = []
     for i in range(a.size()):
         fptr = gtlib.gt_genome_node_ref(a.get(i))
         result.append(FeatureNode.create_from_ptr(fptr))
     return result
Exemplo n.º 5
0
 def get_features_for_seqid(self, seqid):
     err = Error()
     result = []
     rval = gtlib.gt_feature_index_get_features_for_seqid(
         self.fi, seqid.encode('UTF-8'), err)
     if rval:
         a = Array(rval, True)
         for i in range(a.size()):
             fptr = gtlib.gt_genome_node_ref(a.get(i))
             result.append(FeatureNode.create_from_ptr(fptr))
         return result
     else:
         gterror(err)
     return result
Exemplo n.º 6
0
 def get_features_for_seqid(self, seqid):
     err = Error()
     result = []
     rval = gtlib.gt_feature_index_get_features_for_seqid(self.fi,
             seqid, err._as_parameter_)
     if rval:
         a = Array(rval, True)
         for i in range(a.size()):
             fptr = gtlib.gt_genome_node_ref(a.get(i))
             result.append(FeatureNode.create_from_ptr(fptr))
         return result
     else:
         gterror(err)
     return result
Exemplo n.º 7
0
 def get_features_for_range(self, start, end, seqid):
     from ctypes import byref
     a = Array.create()
     err = Error()
     rng = Range(start, end)
     rval = gtlib.gt_feature_index_get_features_for_range(
         self.fi, a, seqid, byref(rng), err)
     if rval != 0:
         gterror(err)
     result = []
     for i in range(a.size()):
         fptr = gtlib.gt_genome_node_ref(a.get(i))
         result.append(FeatureNode.create_from_ptr(fptr))
     return result