diff --git a/src/find_interaction_cluster/nt_and_community.py b/src/find_interaction_cluster/nt_and_community.py index 838dc6a581513929876c823a00ad25272d3823fc..7ca5a53d151ff62dae52ad9985bb6b6834b38b30 100644 --- a/src/find_interaction_cluster/nt_and_community.py +++ b/src/find_interaction_cluster/nt_and_community.py @@ -472,10 +472,13 @@ def make_barplot_perm(df_bar: pd.DataFrame, outfile: Path, cpnt_type: str, """ sns.set(context="poster") df_ctrl = df_bar.loc[df_bar[f"id_{feature}"] == 'ctrl', :] - df_bar = df_bar.loc[df_bar[f"id_{feature}"] != 'ctrl', :] - g = sns.catplot(x="community", y=cpnt, data=df_bar, kind="bar", + df_bar = df_bar.loc[df_bar[f"id_{feature}"] != 'ctrl', :].copy() + g2 = sns.catplot(x="community", y=cpnt, data=df_bar, kind="bar", ci="sd", aspect=2.5, height=14, errwidth=0.5, capsize=.4, palette= ["darkgray"] * (df_bar.shape[0])) + g = sns.catplot(x="community", y=cpnt, data=df_bar, kind="point", + ci="sd", aspect=2.5, height=14, errwidth=0.5, capsize=.4, + scale=0.5, palette= ["darkgray"] * (df_bar.shape[0])) xrange = g.ax.get_xlim() df_ctrl.plot(x="community", y=cpnt, kind="scatter", ax=g.ax, yerr= "ctrl_std", legend=False, zorder=10, @@ -488,7 +491,7 @@ def make_barplot_perm(df_bar: pd.DataFrame, outfile: Path, cpnt_type: str, g.set(xticklabels=[]) g.ax.set_ylabel(f'Frequency of {cpnt}') df_bara = df_bar.drop_duplicates(subset="community", keep="first") - for i, p in enumerate(g.ax.patches): + for i, p in enumerate(g2.ax.patches): stats = "*" if df_bara.iloc[i, :]["p-adj"] < 0.05 else "" com = df_bara.iloc[i, :]["community"] csd = np.std(df_bar.loc[df_bar["community"] == com, cpnt]) @@ -837,6 +840,7 @@ def multiple_nt_lm_launcher(ps: int, f"must be 'exon' not '{region}'. Setting it to exon. " \ f"(corresponds to the concatenation of exons for all genes)" logging.warning(msg) + region = 'exon' logging.info(f"Checking if communities as an effect on {component_type} " "frequency") project = get_projects(global_weight, project)