Skip to content

Commit

Permalink
Fix bug in writing GSEA results to file
Browse files Browse the repository at this point in the history
  • Loading branch information
yihming committed Jun 11, 2024
1 parent cbd4b5c commit 86ad35c
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions pegasus/tools/gsea.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ def _run_gseapy(

res_df = res.res2d
res_df.rename(columns={"FDR q-val": "padj", "Term": "pathway"}, inplace=True)
res_df["ES"] = res_df["ES"].astype(np.float64)
res_df["NES"] = res_df["NES"].astype(np.float64)
res_df["NES abs"] = np.abs(res_df["NES"])
res_df["padj"] = res_df["padj"].astype(np.float64)
Expand Down Expand Up @@ -298,11 +299,7 @@ def format_short_output_cols(
"""
df = pd.DataFrame(df_orig, copy = True) # copy must be true, otherwise the passed df_orig will be modified.

cols = []
for name in df.columns:
if (not name.endswith("pval")) and (not name.endswith("qval")):
cols.append(name)

cols = ["ES", "NES"]
df.loc[:, cols] = df.loc[:, cols].round(ndigits)
return df

Expand Down

0 comments on commit 86ad35c

Please sign in to comment.