scPhyloX.tools ============== .. py:module:: scPhyloX.tools Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/scPhyloX/tools/PhyloCircular/index /autoapi/scPhyloX/tools/data_factory/index /autoapi/scPhyloX/tools/utils/index Attributes ---------- .. autoapisummary:: scPhyloX.tools.population_size scPhyloX.tools.tumor_data scPhyloX.tools.tumor_size Functions --------- .. autoapisummary:: scPhyloX.tools.corr_plot scPhyloX.tools.colless_index scPhyloX.tools.colless_index_corrected scPhyloX.tools.ext_gen scPhyloX.tools.ext_cid scPhyloX.tools.reconstruct scPhyloX.tools.cell_number_calc scPhyloX.tools.get_branchlen scPhyloX.tools.get_mutnum scPhyloX.tools.mutnum_fly scPhyloX.tools.branchlen_fly scPhyloX.tools.polar_plot Package Contents ---------------- .. py:function:: corr_plot(x, y, ax, stats='pearson', r0_x=None, r0_y=None, r1_x=None, r1_y=None, line='fit', alternative='two-sided', fontsize=10) Draw a scatter plot of the two sets of data and show their correlation coefficients Args: x: data1 y: data2 ax: axes to draw scatter on stats: pearson or spearman r0_x, r0_y, r1_x, r1_y: locations to label the correlation coefficient and the p-value line: fit or diag, fit for linear regression alternative: greater, less or two-sided fontsize: fontsize Return: matplotlib.axes .. py:function:: colless_index(tree) calculate Colless' index Args: tree: Phylogenetic tree Return: float: Colless' index .. py:function:: colless_index_corrected(tree) calculate corrected Colless' index Args: tree: Phylogenetic tree Return: float: corrected Colless' index .. py:function:: ext_gen(cell) Extract generation with given cell name .. py:function:: ext_cid(cell) Extract cell id with given cell name .. py:function:: reconstruct(lineage_info, sel_cells, file_name=None) Reconstruct phylogenetic tree of simulation data Args: lineage_info: system.lineage_info sel_cells: cells to build phylogenetic tree file_name: path to save tree. if None, just return Return: text newick tree .. py:data:: population_size .. py:function:: cell_number_calc(w, l, r, coef=100000000.0) Calculate tumor cell number with given width, height and scale Args: w: width l: heigth r: scale coef: cell density Return: float: cell number .. py:data:: tumor_data .. py:data:: tumor_size .. py:function:: get_branchlen(seqtab: numpy.ndarray = None, sys=None) Calculate LP distance with given mutation character matrix Args: seqtab: mutation character matrix sys: Gillespie simulator with results Return: np.array: LP distance .. py:function:: get_mutnum(seqtab=None, sys=None, filter_trunk=True) Calculate LR distance with given mutation character matrix Args: seqtab: mutation character matrix sys: Gillespie simulator with results filter_trunk: Filter trunk mutations Return: np.array: LR distance .. py:function:: mutnum_fly(seqs, ref) calculate LR distance for SMALT-fly dataset Args: seqs: DNA muataion character matrix ref: reference seuence Return: np.array: LR distance .. py:function:: branchlen_fly(seqs, ref, rs=1) calculate LP distance for SMALT-fly dataset Args: seqs: DNA muataion character matrix ref: reference seuence rs: resampling ratio Return: np.array: LP distance .. py:function:: polar_plot(tree, ax=None, arc=350, start=0, root_distance=0.1, label_leaf=True, patch_leaf=True, wedge=True, pad_label=0, pad_patch=0, pad_wedge=0, externals=[], lw=1)