Skip to content

Commit

Permalink
Merge pull request #306 from lilab-bcb/yiming
Browse files Browse the repository at this point in the history
Fix bug in writing GSEA results to file
  • Loading branch information
yihming authored Jun 11, 2024
2 parents cbd4b5c + 86ad35c commit 2d315e3
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 2d315e3

Please sign in to comment.