Commit 49c0594a authored by nfontrod's avatar nfontrod
Browse files

src/gc_content/gc_stats.py: fix mann_whitney and make_stat function used when...

src/gc_content/gc_stats.py: fix mann_whitney and make_stat function used when more than two lists of exons are used
parent 6fd5c886
......@@ -21,10 +21,12 @@ def mann_whitney(df: pd.DataFrame) -> List[Any]:
:return: The name of the groups and their p-value
"""
regions = df['region'].unique()
res = []
for r1, r2 in combinations(regions, 2):
v1 = df.loc[df['region'] == r1, "gc_content"]
v2 = df.loc[df['region'] == r2, "gc_content"]
return [r1, r2, mannwhitneyu(v1, v2)[-1]]
res.append([r1, r2, mannwhitneyu(v1, v2)[-1]])
return res
def make_stat(df: pd.DataFrame) -> List[List[Any]]:
......@@ -35,12 +37,12 @@ def make_stat(df: pd.DataFrame) -> List[List[Any]]:
"""
if len(df['location'].unique()) == 1:
return [mann_whitney(df)]
else:
list_pval = []
for loc in df['location'].unique():
df_tmp = df.loc[df["location"] == loc, :]
res = mann_whitney(df_tmp)
list_pval = []
for loc in df['location'].unique():
df_tmp = df.loc[df["location"] == loc, :]
result = mann_whitney(df_tmp)
for res in result:
res[0] = (loc, res[0])
res[1] = (loc, res[1])
list_pval.append(res)
return list_pval
return list_pval
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment