nichesphere.coloc.colocNW_old

Contents

nichesphere.coloc.colocNW_old#

nichesphere.coloc.colocNW_old(x_diff, adj, cell_group, group=None, group_cmap='tab20', ncols=20, clist=None, nodeSize=None, legend_ax=[0.7, 0.05, 0.15, 0.2], layout='neato', lab_spacing=9, thr=0, alpha=1, fsize=(8, 8), pos=None, edge_scale=1)#

(Differential) co-localization network

Parameters:
  • xdiff (pd.DataFrame) – cell types x cell types data frame of significant scores for each cell cell interaction

  • adj (pd.DataFrame) – cell types x cell types adjacency matrix (calculated from the cell cell interaction scores)

  • cell_group (dict) – dictionary with niche names as keys and lists of their corresponding cell types as values

  • group (list (default: None)) – list of nodes whose interaction will be highlighted

  • group_cmap (str (default: 'tab20')) – name of the color map from which the niche colors will be taken

  • ncols (int (default: 20)) – number of colors for the group_cmap

  • clist (list (default: None)) – alternatively , one can input a list of niche colors

  • nodeSize (str (default: None)) – value that will define the size of the nodes. Options are ‘betweeness’, ‘pagerank’ (network statistics)

  • legend_ax (list (default: [0.7, 0.05, 0.15, 0.2])) – legend position in the form [x0, y0, width, height]

  • layout (str (default: 'neato')) – name of the layout to be used. Options are ‘neato’, ‘dot’, ‘kamada_kawai’, ‘spring’, ‘spectral’, ‘circular’, ‘force_atlas2’, ‘fruchterman_reingold’ and ‘random’)

  • lab_spacing (int (default: 9)) – spacing between labels and nodes

  • thr (float (default: 0)) – edge weights absolute value must be above this value for the edge to be shown

  • alpha (float (default: 1)) – edge transparency (from 0 to 1)

  • fsize (tuple) – figure size in the form (x,y)

  • pos (dict) – dictionary containing the calculated 2D positions (x, y coordinates) for every node

  • edge_scale (float) – factor to scale the edge width

Returns:

  • gCol (nx.Graph) – Graph object with cell cell interaction scores as weights

  • Network plot