Commit dde94122 by Eric Coissac

Add a *class* key containing the value `scaffold:paired-end` to the

edges added by the scaffold function on the base of the pair-ended links
parent 46c64ffc
......@@ -400,12 +400,16 @@ def scaffold(self,assgraph,minlink=5,back=200,addConnectedLink=False):
attr['gapsd']=int(math.sqrt(frglensd**2+glengthsd**2))
attr['gapdeltas']=[frglen - i - self.index.getReadSize() for i in delta]
attr['pairendlink']=z
attr['ingene']=0
attr['graphics']={'width':z // 10.,
'arrow':'last',
'fill':color
}
attr['stemid']=nid
attr['sequence']=b"N" * attr['length']
attr['path']=[first] + [0] * (attr['length']-1) + [last]
attr['class']='scaffold:paired-end'
__cacheAli = set()
__cacheAli2 = set()
......@@ -1095,7 +1099,11 @@ def path2fasta(self,assgraph,path,identifier="contig",minlink=10,nlength=20,back
s2 = alledges[path[0]]
sid1=assgraph.getEdgeAttr(*s1)['stemid']
sid2=assgraph.getEdgeAttr(*s2)['stemid']
connected,ml,sl,delta = pairEndedConnected(self,assgraph,sid1,sid2,back)
connected,ml,sl,delta = pairEndedConnected(self, # @UnusedVariable
assgraph,
sid1,
sid2,
back)
if s1[1]==s2[0]:
......@@ -2087,7 +2095,7 @@ def cutHighCoverage(self,maxcov,terminal=True):
print('',file=sys.stderr)
return ilength - len(self)
def path2sam(self,assgraph,path,identifier="contig",minlink=10,nlength=20,back=200):
def path2sam(self,assgraph,path,identifier="contig",minlink=10,nlength=20,back=200,logger=None,tags=[]):
'''
Convert a path in an compact assembling graph in a fasta formated sequences.
......@@ -2114,7 +2122,8 @@ def path2sam(self,assgraph,path,identifier="contig",minlink=10,nlength=20,back=2
:raises: :py:class:`AssertionError`
'''
alledges = dict((assgraph.getEdgeAttr(*e)['stemid'],e)
alledges = dict((assgraph.getEdgeAttr(*e)['stemid'],
e)
for e in assgraph.edgeIterator(edgePredicate = lambda i: 'stemid' in assgraph.getEdgeAttr(*i)))
slength=[]
......@@ -2141,7 +2150,7 @@ def path2sam(self,assgraph,path,identifier="contig",minlink=10,nlength=20,back=2
print("Both segments %d and %d are connected" % (oldid,stemid),file=sys.stderr)
else:
# addInFront=True
connected,ml,sl,delta = pairEndedConnected(self,assgraph,oldid,stemid,back)
connected,ml,sl,delta = pairEndedConnected(self,assgraph,oldid,stemid,back) # @UnusedVariable
print("Both segments %d and %d are disconnected" % (oldid,stemid),file=sys.stderr)
if connected >= minlink:
print("But linked by %d pair ended links" % connected,file=sys.stderr)
......@@ -2159,7 +2168,7 @@ def path2sam(self,assgraph,path,identifier="contig",minlink=10,nlength=20,back=2
# addInfront=True
seq.append(attr['sequence'])
seq.append(attr['path'])
slength.append(attr['length'])
oldstem = stem
......@@ -2177,7 +2186,7 @@ def path2sam(self,assgraph,path,identifier="contig",minlink=10,nlength=20,back=2
if connected >= minlink:
print("Path is circular but disconnected",file=sys.stderr)
print("Linked by %d pair ended links" % connected,file=sys.stderr)
seq.append(b'N'*nlength)
seq.append([0]*nlength)
else:
print("Path is linear",file=sys.stderr)
......
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