TFcomb.plotting module¶
- TFcomb.plotting.get_gene_color_dict(oracle_part, source_state)[source]¶
Generate the gene_color_dict
- Parameters:
oracle_part (celloracle object) – CellOracle object.
source_state (str) – Name of the source state.
- Returns:
A dict mapping genes to colors. gene_color_dict_2 (dict): A dict mapping genes to colors 2.
- Return type:
gene_color_dict (dict)
- TFcomb.plotting.plot_GRN(tf_GRN_dict=None, plot_tf_list=None, save_dir_GRN=None, filter_link=True, figsize=(15, 15), anno_tfs=None, anno_edges=None, show_mode=True, seed=2, scale=0.5, iterations=5, k=0.1, gene_color_dict=None)[source]¶
Plot the GRN with TFs and target genes.
- Parameters:
tf_GRN_dict (dict, optional) – A dict where keys are TFs and values are target genes. Defaults to None.
plot_tf_list (list, optional) – A list of TFs to be plotted. Defaults to None.
save_dir_GRN (str, optional) – Path to save the figure. Defaults to None.
filter_link (bool, optional) – Whether filter the links with small values. Defaults to True.
figsize (tuple, optional) – Size of figure. Defaults to (15,15).
anno_tfs (list, optional) – Nodes to be annotated. Defaults to None.
anno_edges (list, optional) – Edges to be annotated. Defaults to None.
show_mode (bool, optional) – Whether plot the figure. Defaults to True.
seed (int, optional) – Random seed. Defaults to 2.
scale (float, optional) – The scale to show the graph. Defaults to 0.5.
iterations (int, optional) – The parameters of nx.spring_layout. Defaults to 5.
k (float, optional) – The parameters of nx.spring_layout. Defaults to 0.1.
gene_color_dict (dict, optional) – A dict where keys are genes and values are colors, which is used to give colors representing the differentially expressed degree. Defaults to None.
- TFcomb.plotting.plot_coef(coef, regression_percentile, annot_shifts=None, xlabel=None, ylabel=None, save=None, tf_list=None)[source]¶
Plot the coefficients of the ridge regression model. The coefficients are also regarded as the expected alterations.
- Parameters:
coef (list) – The coefficients of regression model. The length is equal to the length of TFs.
regression_percentile (float) – The percentage to show the TFs.
annot_shifts (tuple, optional) – A pair of coordinates. The shifts of text to the point. Defaults to None.
xlabel (str, optional) – Name of x label. Defaults to None.
ylabel (str, optional) – Name of y label. Defaults to None.
save (str, optional) – The path to save the figure. Defaults to None.
tf_list (list, optional) – List containing TFs. Defaults to None.
- TFcomb.plotting.plot_score_comparison(df, value, cluster1, cluster2, percentile1=99, percentile2=99, annot_shifts=None, fillna_with_zero=True, plt_show=True, de_genes=[], gt_tfs=[], title=None, if_line=True, plot_all_tf=False, save=None, goi_size=10, point_size=15)[source]¶
Create a scatter plot to visualize the directing scores and expected alterations of transcription factors (TFs).
- Parameters:
df (pd.DataFrame) – A Pandas DataFrame containing directing scores and expected alterations.
value (str) – The column name representing the values in df.
cluster1 (str) – The column name for expected alterations.
cluster2 (str) – The column name for directing scores.
percentile1 (int) – The quantile percentage for filtering TFs based on expected alterations. Defaults to 99.
percentile2 (int, optional) – The quantile percentage for filtering TFs based on directing scores. Defaults to 99.
annot_shifts (tuple, optional) – A pair of coordinates specifying the text shift relative to data points. Defaults to None.
fillna_with_zero (bool, optional) – Whether to fill missing values in df with zeros. Defaults to True.
plt_show (bool, optional) – Whether to display the plot. Defaults to True.
de_genes (list, optional) – A list of genes differentially expressed between source and target cell states. Defaults to an empty list.
gt_tfs (list, optional) – A list of ground-truth TFs. Defaults to an empty list.
title (str, optional) – The title of the plot. Defaults to None.
if_line (bool, optional) – Whether to display a red line indicating the filter threshold. Defaults to True.
plot_all_tf (bool, optional) – Whether to plot all TFs, regardless of filtering. Defaults to False.
save (str, optional) – The file path to save the plot. Defaults to None.
goi_size (int, optional) – The font size for gene-of-interest (GOI) labels. Defaults to 10.
point_size (int, optional) – The size of scatter plot points. Defaults to 15.
- Returns:
A list of filtered TFs based on the specified criteria.
- Return type:
gois (list)