32 lines
668 B
Cython
32 lines
668 B
Cython
cimport cython
|
|
from libc.stdlib cimport malloc, free, realloc
|
|
from libc.string cimport strncpy
|
|
|
|
cdef class FastaFormat:
|
|
|
|
def __init__(self, list tags=[], bint printNAKeys=False):
|
|
self.headerFormater = HeaderFormat(True,
|
|
tags,
|
|
printNAKeys)
|
|
|
|
@cython.boundscheck(False)
|
|
def __call__(self, dict data):
|
|
cdef bytes brawseq = data['sequence']
|
|
cdef size_t lseq = len(brawseq)
|
|
cdef size_t k=0
|
|
cdef list lines = []
|
|
|
|
for k in range(0,lseq,60):
|
|
lines.append(brawseq[k:(k+60)])
|
|
|
|
brawseq = b'\n'.join(lines)
|
|
|
|
return "%s\n%s" % (self.headerFormater(data),bytes2str(brawseq))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|