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

Method __init__

scTDA/main.py:1514–1559  ·  view source on GitHub ↗

Initializes the class by providing the the common name ('name') of .gexf and .json files produced by e.g. ParseAyasdiGraph(), the name of the file containing the filtered raw data ('table'), as produced by Preprocess.save(), and the name of the column that contains sampling

(self, name, table, rootlane='timepoint', shift=None, log2=True, posgl=False, csv=False, groups=True)

Source from the content-addressed store, hash-verified

1512 return g3, dicdend
1513
1514 def __init__(self, name, table, rootlane='timepoint', shift=None, log2=True, posgl=False, csv=False, groups=True):
1515 """
1516 Initializes the class by providing the the common name ('name') of .gexf and .json files produced by
1517 e.g. ParseAyasdiGraph(), the name of the file containing the filtered raw data ('table'), as produced by
1518 Preprocess.save(), and the name of the column that contains sampling time points. Optional argument
1519 'shift' can be an integer n specifying that the first n columns of the table should be ignored, or a
1520 list of columns that should only be considered. If optional argument 'log2' is False, it is assumed that
1521 the filtered raw data is in units of TPM instead of log_2(1+TPM). When optional argument 'posgl' is False,
1522 a files name.posg and name.posgl are generated with the positions of the graph nodes for visualization.
1523 When 'posgl' is True, instead of generating new positions, the positions stored in files name.posg and
1524 name.posgl are used for visualization of the topological graph.
1525 """
1526 UnrootedGraph.__init__(self, name, table, shift, log2, posgl, csv, groups)
1527 self.rootlane = rootlane
1528 self.root, self.leaf = self.find_root(self.get_dendrite())
1529 self.g3, self.dicdend = self.dendritic_graph()
1530 self.edgesize = []
1531 self.dicedgesize = {}
1532 self.edgesizeprun = []
1533 self.nodesize = []
1534 self.dicmelisa = {}
1535 self.nodesizeprun = []
1536 self.dicmelisaprun = {}
1537 for ee in self.g3.edges():
1538 yu = self.dicdend[int(ee[0].split('_')[0])][int(ee[0].split('_')[1])]
1539 yu2 = self.dicdend[int(ee[1].split('_')[0])][int(ee[1].split('_')[1])]
1540 self.edgesize.append(self.gl.subgraph(list(yu)+list(yu2)).number_of_edges()-self.gl.subgraph(yu).number_of_edges()
1541 - self.gl.subgraph(yu2).number_of_edges())
1542 self.dicedgesize[ee] = self.edgesize[-1]
1543 for ee in self.g3.nodes():
1544 lisa = []
1545 for uu in self.dicdend[int(ee.split('_')[0])][int(ee.split('_')[1])]:
1546 lisa += self.dic[uu]
1547 self.nodesize.append(len(set(lisa)))
1548 self.dicmelisa[ee] = set(lisa)
1549 try:
1550 from networkx.drawing.nx_agraph import graphviz_layout
1551 self.posg3 = graphviz_layout(self.g3, 'sfdp')
1552 except:
1553 self.posg3 = networkx.spring_layout(self.g3)
1554 self.dicdis = self.get_distroot(self.root)
1555 pel2, tol = self.get_gene(self.rootlane, ignore_log=True)
1556 self.pel = numpy.array([pel2[m] for m in self.pl])*tol
1557 dr2 = self.get_distroot(self.root)
1558 self.dr = numpy.array([dr2[m] for m in self.pl])
1559 self.po = scipy.stats.linregress(self.pel, self.dr)
1560
1561 def select_diff_path(self):
1562 """

Callers

nothing calls this directly

Calls 6

find_rootMethod · 0.95
get_dendriteMethod · 0.95
dendritic_graphMethod · 0.95
get_distrootMethod · 0.95
get_geneMethod · 0.95
__init__Method · 0.45

Tested by

no test coverage detected