Commit 53852200 by Eric Coissac

Add a default length of 10 if estimated gap length is below zero

parent 221ccc08
......@@ -382,15 +382,21 @@ def scaffold(self,assgraph,minlink=5,back=200,addConnectedLink=False):
if kind=="s":
glengths = [frglen - i - self.index.getReadSize() for i in delta]
glengths = [i for i in glengths if i >=0]
glength = sum(glengths) / len(glengths)
glengthsd= math.sqrt(sum((i-glength)**2 for i in glengths) /(len(glengths)-1))
attr['label']="Gap (%dbp) [%d,%d] %d -> %d" % (glength,z,len(glengths),s1,s2)
attr['length']=int(glength)
pglengths = [i for i in glengths if i >=0]
if pglengths:
glength = sum(pglengths) / len(pglengths)
glengthsd= math.sqrt(sum((i-glength)**2 for i in pglengths) /(len(pglengths)-1))
else:
glength = sum(glengths) / len(glengths)
glengthsd= math.sqrt(sum((i-glength)**2 for i in glengths) /(len(glengths)-1))
attr['label']="Gap (%dbp) [%d,%d] %d -> %d" % (glength,z,len(pglengths),s1,s2)
attr['length']=int(glength) if int(glength) > 0 else 10
attr['first']=first
attr['last']=last
attr['weight']=0
attr['gappairs']=len(glengths)
attr['gaplength']=int(glength)
attr['gapsd']=int(math.sqrt(frglensd**2+glengthsd**2))
attr['gapdeltas']=[frglen - i - self.index.getReadSize() for i in delta]
attr['pairendlink']=z
......
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