Commit 039c87f4 by Eric Coissac

remove memory leak

parent cdffb415
......@@ -142,35 +142,31 @@ cdef class IterOnConsensus:
def buildConsensus(ali):
cdef array.array[double] quality = array.array('d',[0])
cdef array.array[char] aseq = array.array('c',' ')
cdef double* dquality
cdef char* cseq
cdef double quality[1000]
cdef char aseq[1000]
cdef int i=0
cdef int j=0
cdef char* cnuc
cdef bytes nuc
cdef double score
cdef str sseq
array.resize(quality,len(ali[0]))
array.resize(aseq,len(ali[0]))
dquality = quality._d
cseq = aseq._c
cdef bytes sseq
if len(ali[0])>999:
raise AssertionError,"To long alignemnt"
ic=IterOnConsensus(ali)
for nuc,score in ic:
cnuc=nuc
dquality[i]=score
cseq[i]=cnuc[0]
quality[i]=score
aseq[i]=cnuc[0]
i+=1
array.resize(quality,i)
array.resize(aseq,i)
sseq=''.join(aseq)
aseq[i]=0
sseq=aseq
seq=NucSequence(ali[0].wrapped.id+'_CONS',sseq,**ali[0].wrapped.getTags())
seq.quality=quality
seq.quality=array.array('d',[quality[j] for j in range(i)])
if hasattr(ali, "direction"):
seq['direction']=ali.direction
......
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