MCPcopy Create free account
hub / github.com/CamaraLab/scTDA / dendritic_graph

Method dendritic_graph

scTDA/main.py:1491–1512  ·  view source on GitHub ↗

Builds skeleton of the topological representation (used internally)

(self)

Source from the content-addressed store, hash-verified

1489 return ind, ind2
1490
1491 def dendritic_graph(self):
1492 """
1493 Builds skeleton of the topological representation (used internally)
1494 """
1495 diam = networkx.diameter(self.gl)
1496 g3 = networkx.Graph()
1497 dicdend = {}
1498 for n in range(diam-1):
1499 nodedist = []
1500 for k in self.pl:
1501 dil = networkx.shortest_path_length(self.gl, self.root, k)
1502 if dil == n:
1503 nodedist.append(str(k))
1504 g2 = self.gl.subgraph(nodedist)
1505 dicdend[n] = sorted(networkx.connected_components(g2))
1506 for n2, yu in enumerate(dicdend[n]):
1507 g3.add_node(str(n) + '_' + str(n2))
1508 if n > 0:
1509 for n3, yu2 in enumerate(dicdend[n-1]):
1510 if networkx.is_connected(self.gl.subgraph(list(yu)+list(yu2))):
1511 g3.add_edge(str(n) + '_' + str(n2), str(n-1) + '_' + str(n3))
1512 return g3, dicdend
1513
1514 def __init__(self, name, table, rootlane='timepoint', shift=None, log2=True, posgl=False, csv=False, groups=True):
1515 """

Callers 1

__init__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected