nichesphere.comm.catNW#
- nichesphere.comm.catNW(x_chem, colocNW, cell_group, group=None, group_cmap='tab20', ncols=20, color_group=None, plot_title='', clist=None, nodeSize=None, legend_ax=[0.7, 0.05, 0.15, 0.2], layout='neato', thr=0, fsize=(8, 8), alpha=1, lab_spacing=7, edge_scale=1, pos=None)#
(Differential) communication network
- Parameters:
xchem (pd.DataFrame) – cell types x cell types data frame of significant scores for each cell cell interaction (for a specific LR category)
colocNW (nx.Graph) – Graph object with (differential) co-localization scores as weights
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
color_group (list) – list of colors (one color per node)
plot_title (str (default: '')) – plot title to be shown at the top of the network plot
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’ , ‘signed_betweeness’, ‘signed_pagerank’ (network statistics; the ‘signed_*’ options size nodes by |log2((pos+eps)/(neg+eps))|, matching nichesphere.tl.compute_network_stats)
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:
G (nx.Graph) – Graph object with (differential) cell communication scores as weights
Network plot