From a7cf3b21d5c4904c96b3a30fdc90ec94240a56bf Mon Sep 17 00:00:00 2001
From: Fontrodona Nicolas <nicolas.fontrodona@ens-lyon.fr>
Date: Mon, 4 Jan 2021 15:04:39 +0100
Subject: [PATCH] 
 src/find_interaction_cluster/community_figures/fig_functions.py: fix
 lm_with_ctrl function

---
 .../community_figures/fig_functions.py                         | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/find_interaction_cluster/community_figures/fig_functions.py b/src/find_interaction_cluster/community_figures/fig_functions.py
index 09fbfdcf..dc755a65 100644
--- a/src/find_interaction_cluster/community_figures/fig_functions.py
+++ b/src/find_interaction_cluster/community_figures/fig_functions.py
@@ -110,6 +110,9 @@ def lm_with_ctrl(df: pd.DataFrame,
     list of feature.
     """
     df['community'] = df['community'].fillna("C-CTRL")
+    size = df.loc[df["community"] == "C-CTRL", :].shape[0]
+    df['community_size'] = df['community_size'].fillna(size)
+    df['community_size'] = df['community_size'].astype(int)
     return df, lm_maker_summary(df, outfile, target_col)
 
 
-- 
GitLab