예제 #1
0
 def get_first_seqid(self):
     err = Error()
     str = gtlib.gt_feature_index_get_first_seqid(self.fi, err._as_parameter_)
     if str == None:
         if err.is_set():
             gterror(err)
     return str
예제 #2
0
 def get_height(self):
     err = Error()
     height = c_ulong()
     gtlib.gt_layout_get_height(self.layout, byref(height), err)
     if err.is_set():
         gterror(err)
     return height.value
예제 #3
0
 def __init__(self, diagram, width, style):
     err = Error()
     self.layout = gtlib.gt_layout_new(diagram._as_parameter_, width,
                                       style._as_parameter_, err._as_parameter_)
     if err.is_set():
         gterror(err)
     self._as_parameter_ = self.layout
예제 #4
0
파일: layout.py 프로젝트: 9beckert/TIR
 def get_height(self):
     err = Error()
     height = c_ulong()
     gtlib.gt_layout_get_height(self.layout, byref(height), err)
     if err.is_set():
         gterror(err)
     return height.value
예제 #5
0
 def get_first_seqid(self):
     err = Error()
     str = gtlib.gt_feature_index_get_first_seqid(self.fi, err)
     if str == None:
         if err.is_set():
             gterror(err)
     return str
예제 #6
0
 def __init__(self, diagram, width, style):
     err = Error()
     self.layout = gtlib.gt_layout_new(diagram._as_parameter_, width,
                                       style._as_parameter_,
                                       err._as_parameter_)
     if err.is_set():
         gterror(err)
     self._as_parameter_ = self.layout
예제 #7
0
 def get_first_seqid(self):
     err = Error()
     str = gtlib.gt_feature_index_get_first_seqid(self.fi,
                                                  err._as_parameter_)
     if str == None:
         if err.is_set():
             gterror(err)
     return str.decode('UTF-8')
예제 #8
0
 def from_index(feature_index, seqid, rng, style):
     from ctypes import byref
     err = Error()
     if rng.start > rng.end:
         gterror("range.start > range.end")
     diagram = gtlib.gt_diagram_new(feature_index, seqid, byref(rng),
             style, err)
     if err.is_set():
         gterror(err)
     return Diagram(diagram)
예제 #9
0
 def from_index(feature_index, seqid, rng, style):
     from ctypes import byref
     err = Error()
     if rng.start > rng.end:
         gterror("range.start > range.end")
     diagram = gtlib.gt_diagram_new(feature_index, seqid, byref(rng), style,
                                    err)
     if err.is_set():
         gterror(err)
     return Diagram(diagram)
예제 #10
0
 def meta_node_w(mn_p, err_p):
     mn = EOFNode.create_from_ptr(mn_p)
     err = Error(err_p)
     try:
         try:
             self.visit_meta_node(mn)
         except AttributeError:
             pass
         return 0
     except GTError, errmsg:
         err.set(str(errmsg))
         return -1
예제 #11
0
 def next_w(nodepp, err):
     error = Error(err)
     try:
         nextnode = self.next()
         if nextnode:
             nodepp[0] = nextnode.gn
         else:
             nodepp[0] = None
         return 0
     except GTError as errmsg:
         error.set(str(errmsg))
         return -1
예제 #12
0
 def feature_node_w(fn_p, err_p):
     fn = FeatureNode.create_from_ptr(fn_p)
     err = Error(err_p)
     try:
         try:
             self.visit_feature_node(fn)
         except AttributeError:
             pass
         return 0
     except GTError, errmsg:
         err.set(str(errmsg))
         return -1
예제 #13
0
 def comment_node_w(cn_p, err_p):
     cn = CommentNode.create_from_ptr(cn_p)
     err = Error(err_p)
     try:
         try:
             self.visit_comment_node(cn)
         except AttributeError:
             pass
         return 0
     except GTError, errmsg:
         err.set(str(errmsg))
         return -1
예제 #14
0
 def next_w(nodepp, err):
     error = Error(err)
     try:
         nextnode = self.next()
         if nextnode:
             nodepp[0] = nextnode.gn
         else:
             nodepp[0] = None
         return 0
     except Error, errmsg:
         error.set(str(errmsg))
         return -1
예제 #15
0
 def sequence_node_w(sn_p, err_p):
     sn = SequenceNode.create_from_ptr(sn_p)
     err = Error(err_p)
     try:
         try:
             self.visit_sequence_node(sn)
         except AttributeError:
             pass
         return 0
     except GTError, errmsg:
         err.set(str(errmsg))
         return -1
예제 #16
0
 def eof_node_w(en_p, err_p):
     en = EOFNode.create_from_ptr(en_p)
     err = Error(err_p)
     try:
         try:
             self.visit_eof_node(en)
         except AttributeError:
             pass
         return 0
     except GTError, errmsg:
         err.set(str(errmsg))
         return -1
예제 #17
0
 def eof_node_w(en_p, err_p):
     en = EOFNode.create_from_ptr(en_p)
     err = Error(err_p)
     try:
         try:
             self.visit_eof_node(en)
         except AttributeError:
             pass
         return 0
     except GTError, errmsg:
         err.set(str(errmsg))
         return -1
예제 #18
0
 def region_node_w(rn_p, err_p):
     rn = RegionNode.create_from_ptr(rn_p)
     err = Error(err_p)
     try:
         try:
             self.visit_region_node(rn)
         except AttributeError:
             pass
         return 0
     except GTError, errmsg:
         err.set(str(errmsg))
         return -1
예제 #19
0
 def feature_node_w(fn_p, err_p):
     fn = FeatureNode.create_from_ptr(fn_p)
     err = Error(err_p)
     try:
         try:
             self.visit_feature_node(fn)
         except AttributeError:
             pass
         return 0
     except GTError, errmsg:
         err.set(str(errmsg))
         return -1
예제 #20
0
 def meta_node_w(mn_p, err_p):
     mn = EOFNode.create_from_ptr(mn_p)
     err = Error(err_p)
     try:
         try:
             self.visit_meta_node(mn)
         except AttributeError:
             pass
         return 0
     except GTError, errmsg:
         err.set(str(errmsg))
         return -1
예제 #21
0
 def sequence_node_w(sn_p, err_p):
     sn = SequenceNode.create_from_ptr(sn_p)
     err = Error(err_p)
     try:
         try:
             self.visit_sequence_node(sn)
         except AttributeError:
             pass
         return 0
     except GTError, errmsg:
         err.set(str(errmsg))
         return -1
예제 #22
0
 def region_node_w(rn_p, err_p):
     rn = RegionNode.create_from_ptr(rn_p)
     err = Error(err_p)
     try:
         try:
             self.visit_region_node(rn)
         except AttributeError:
             pass
         return 0
     except GTError, errmsg:
         err.set(str(errmsg))
         return -1
예제 #23
0
 def comment_node_w(cn_p, err_p):
     cn = CommentNode.create_from_ptr(cn_p)
     err = Error(err_p)
     try:
         try:
             self.visit_comment_node(cn)
         except AttributeError:
             pass
         return 0
     except GTError, errmsg:
         err.set(str(errmsg))
         return -1
예제 #24
0
    def from_index(feature_index, seqid, rng, style):
        from ctypes import byref
        FeatureIndex.from_param(feature_index)
        Style.from_param(style)

        err = Error()
        if rng.start > rng.end:
            gterror("range.start > range.end")
        diagram = gtlib.gt_diagram_new(feature_index._as_parameter_, seqid,
                byref(rng), style._as_parameter_, err._as_parameter_)
        if err.is_set():
            gterror(err)
        return Diagram(diagram)
예제 #25
0
 def next_w(nodepp, err):
     error = Error(err)
     try:
         nextnode = self.next()
         if nextnode:
             nodepp[0] = nextnode.gn
         else:
             nodepp[0] = None
         return 0
     except Error:
         import sys
         errmsg = sys.exc_info()[1]
         error.set(str(errmsg))
         return -1
예제 #26
0
 def eof_node_w(en_p, err_p):
     en = EOFNode.create_from_ptr(en_p)
     err = Error(err_p)
     try:
         try:
             self.visit_eof_node(en)
         except AttributeError:
             pass
         return 0
     except GTError:
         import sys
         errmsg = sys.exc_info()[1]
         err.set(str(errmsg))
         return -1
예제 #27
0
 def eof_node_w(en_p, err_p):
     en = EOFNode.create_from_ptr(en_p)
     err = Error(err_p)
     try:
         try:
             self.visit_eof_node(en)
         except AttributeError:
             pass
         return 0
     except GTError:
         import sys
         errmsg = sys.exc_info()[1]
         err.set(str(errmsg))
         return -1
예제 #28
0
        def next_w(nodepp, err):
            error = Error(err)
            try:
                nextnode = self.next()
                if nextnode:
                    nodepp[0] = nextnode.gn
                else:
                    nodepp[0] = None
                return 0
            except Error:
                import sys

                errmsg = sys.exc_info()[1]
                error.set(str(errmsg))
                return -1
예제 #29
0
파일: rdb.py 프로젝트: pythseq/EDTA
 def __init__(self, filename):
     err = Error()
     rdb = gtlib.gt_rdb_sqlite_new(filename, err._as_parameter_)
     if rdb == None:
         gterror(err)
     self.rdb = rdb
     self._as_parameter_ = self.rdb
예제 #30
0
 def add_gff3file(self, filename):
     err = Error()
     rval = gtlib.gt_feature_index_add_gff3file(self.fi,
                                                filename.encode('UTF-8'),
                                                err)
     if rval != 0:
         gterror(err)
예제 #31
0
 def __init__(self):
     err = Error()
     ads = gtlib.gt_anno_db_gfflike_new()
     if ads == None:
         gterror(err)
     self.ads = ads
     self._as_parameter_ = self.ads
예제 #32
0
 def mirror(self):
     if self.is_mirrored():
         gterror("encoded sequence is already mirrored")
     err = Error()
     ret = gtlib.gt_encseq_mirror(self.encseq, err.error)
     if ret != 0:
         gterror(err)
예제 #33
0
파일: encseq.py 프로젝트: pythseq/EDTA
 def encode(self, seqfiles, indexname):
     if not isinstance(seqfiles, list):
         raise TypeError("argument must be a list of strings")
     if len(seqfiles) == 0:
         raise Error("list of input sequence files must be non-empty")
     sa = StrArray()
     for f in seqfiles:
         if not os.path.exists(str(f)):
             raise IOError("file not found: %s" % str(f))
         sa.add(str(f))
     err = Error()
     esptr = gtlib.gt_encseq_encoder_encode(self.ee, sa.strarr,
                                            str(indexname).encode("UTF-8"),
                                            err.error)
     if esptr != 0:
         gterror(err)
예제 #34
0
 def to_str(self):
     err = Error()
     string = Str()
     if gtlib.gt_style_to_str(self.style, string, err) == 0:
         return str(string)
     else:
         gterror(err)
예제 #35
0
 def load_str(self, string):
     err = Error()
     strg = Str(str(string.encode("utf-8")))
     rval = gtlib.gt_style_load_str(self.style, strg._as_parameter_,
                                    err._as_parameter_)
     if rval != 0:
         gterror(err)
예제 #36
0
 def to_file(self, filename):
     err = Error()
     rval = gtlib.gt_canvas_cairo_file_to_file(
         self.canvas,
         str(filename).encode('UTF-8'), err)
     if rval != 0:
         gterror(err)
예제 #37
0
 def get_feature_index(self, rdb):
     err = Error()
     fi = gtlib.gt_anno_db_schema_get_feature_index(self.ads,
                                                    rdb._as_parameter_,
                                                    err._as_parameter_)
     if fi == None:
         gterror(err)
     return FeatureIndexFromPtr(fi)
예제 #38
0
 def to_str(self):
     err = Error()
     string = Str()
     if gtlib.gt_style_to_str(self.style, string._as_parameter_,
                              err._as_parameter_) == 0:
         return str(string)
     else:
         gterror(err)
예제 #39
0
 def __init__(self, style, width, height, ii=None):
     err = Error()
     canvas = gtlib.gt_canvas_cairo_file_new(style, GRAPHICS_PNG, width,
                                             height, ii, err)
     if canvas == None:
         gterror(err)
     self.canvas = canvas
     self._as_parameter_ = self.canvas
예제 #40
0
 def has_seqid(self, seqid):
     from ctypes import c_int, byref
     val = c_int()
     err = Error()
     ret = gtlib.gt_feature_index_has_seqid(self.fi, byref(val), seqid, err)
     if ret != 0:
         gterror(err)
     else:
         return (val.value > 0)
예제 #41
0
 def get_seqids(self):
     result = []
     err = Error()
     stra = StrArray(gtlib.gt_feature_index_get_seqids(self.fi, err))
     if stra == None:
         gterror(err)
     for i in range(stra.size()):
         result.append(stra.get(i))
     return result
예제 #42
0
 def next_tree(self):
     err = Error()
     genome_node = c_void_p()
     rval = gtlib.gt_node_stream_next(self.gs, byref(genome_node), err)
     if rval != 0:
         gterror(err)
     if genome_node.value == None:
         return None
     else:
         return GenomeNode.create_from_ptr(genome_node.value)
예제 #43
0
 def create_from_file(indexname):
     if not os.path.exists(indexname + ".al1"):
         raise IOError, ("file not found: %s" % (indexname + ".al1"))
     e = Error()
     a_ptr = gtlib.gt_alphabet_new_from_file(str(indexname), e)
     a = Alphabet(a_ptr, True)
     if a == None:
         gterror(e)
     else:
         return a
예제 #44
0
 def sketch(self, canvas):
     err = Error()
     had_err = gtlib.gt_layout_sketch(self.layout, canvas._as_parameter_,
                                      err._as_parameter_)
     if err.is_set():
         gterror(err)
예제 #45
0
파일: layout.py 프로젝트: 9beckert/TIR
 def sketch(self, canvas):
     err = Error()
     had_err = gtlib.gt_layout_sketch(self.layout, canvas, err)
     if err.is_set():
         gterror(err)