Commit 13f34fa8 by Eric Coissac

Patch to fit the version 0.20 of cython

parent efbcd978
......@@ -81,7 +81,7 @@ cdef class BioSequence(object):
self._seq=seq
self._info = dict(info)
if rawinfo is not None:
self.__rawinfo=' ' + rawinfo
self.__rawinfo=b' ' + rawinfo
else:
self.__rawinfo=None
self._rawparser=rawparser
......@@ -221,7 +221,7 @@ cdef class BioSequence(object):
m = p.search(self.__rawinfo)
if m is not None:
v=m.group(1)
self.__rawinfo=' ' + self.__rawinfo[0:m.start(0)]+self.__rawinfo[m.end(0):]
self.__rawinfo=b' ' + self.__rawinfo[0:m.start(0)]+self.__rawinfo[m.end(0):]
try:
v = eval(v)
except:
......@@ -301,7 +301,7 @@ cdef class BioSequence(object):
m = p.search(self.__rawinfo)
if m is not None:
v=m.group(1)
self.__rawinfo=' ' + self.__rawinfo[0:m.start(0)]+self.__rawinfo[m.end(0):]
self.__rawinfo=b' ' + self.__rawinfo[0:m.start(0)]+self.__rawinfo[m.end(0):]
try:
v = eval(v)
except:
......@@ -640,7 +640,7 @@ cdef class SubSequence(WrappedBioSequence):
return len(self._xrange)
cpdef bytes getStr(self):
return ''.join([x for x in self])
return b''.join([x for x in self])
def __iter__(self):
return (self.wrapped.getSymbolAt(x) for x in self._xrange)
......@@ -651,11 +651,11 @@ cdef class SubSequence(WrappedBioSequence):
id = property(getId,setId, None)
cdef dict _comp={'a': 't', 'c': 'g', 'g': 'c', 't': 'a',
'r': 'y', 'y': 'r', 'k': 'm', 'm': 'k',
's': 's', 'w': 'w', 'b': 'v', 'd': 'h',
'h': 'd', 'v': 'b', 'n': 'n', 'u': 'a',
'-': '-'}
cdef dict _comp={b'a': b't', b'c': b'g', b'g': b'c', b't': b'a',
b'r': b'y', b'y': b'r', b'k': b'm', b'm': b'k',
b's': b's', b'w': b'w', b'b': b'v', b'd': b'h',
b'h': b'd', b'v': b'b', b'n': b'n', b'u': b'a',
b'-': b'-'}
cdef class DNAComplementSequence(WrappedBioSequence):
......@@ -693,7 +693,7 @@ cdef class DNAComplementSequence(WrappedBioSequence):
return len(self._wrapped)
cpdef bytes getStr(self):
return ''.join([x for x in self])
return b''.join([x for x in self])
def __iter__(self):
return (self.getSymbolAt(x) for x in xrange(len(self)))
......@@ -714,16 +714,16 @@ cdef class DNAComplementSequence(WrappedBioSequence):
id = property(getId,setId, None)
cdef set _iupac=set(['r', 'y', 'k', 'm',
's', 'w', 'b', 'd',
'h', 'v', 'n',
'R', 'Y', 'K', 'M',
'S', 'W', 'B', 'D',
'H', 'V', 'N'])
cdef set _iupac=set([b'r', b'y', b'k', b'm',
b's', b'w', b'b', b'd',
b'h', b'v', b'n',
b'R', b'Y', b'K', b'M',
b'S', b'W', b'B', b'D',
b'H', b'V', b'N'])
#cdef char *_iupac=b"acgtrykmswbdhvnu-"
cdef set _nuc = set(['a', 'c', 'g', 't','u','A', 'C', 'G', 'T','U','-'])
cdef set _nuc = set([b'a', b'c', b'g', b't',b'u',b'A', b'C', b'G', b'T',b'U',b'-'])
#cdef char *_nuc=b"acgt-"
......
......@@ -214,7 +214,7 @@ cpdef bytes formatFastq(object data, bint gbmode=False, bint upper=False):
id = sequence.id
if gbmode:
if b'gi' in sequence:
id = b"gi|%s|%s" % (sequence[b'gi'],id)
id = bytes(b"gi|%s|%s" % (sequence[b'gi'],id))
else:
id = b"lcl|%s|" % (id)
if hasattr(sequence, b"quality"):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment