From a2eb05de695c29f1352033e7690d0f12becd88f3 Mon Sep 17 00:00:00 2001 From: Zhuoqing Fang Date: Tue, 3 Dec 2024 22:15:00 -0800 Subject: [PATCH] write rnk file --- gseapy/gsea.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gseapy/gsea.py b/gseapy/gsea.py index 1e450a7..3610d55 100644 --- a/gseapy/gsea.py +++ b/gseapy/gsea.py @@ -410,6 +410,10 @@ def run(self): self._heatmat(df=dat.iloc[gsum.indices[0]], classes=self.groups) # write output and plotting self.to_df(gsum.summaries, gmt, self.ranking) + if self._outdir is not None: + self.ranking.to_csv( + os.path.join(self.outdir, "gsea_data.rnk"), sep="\t", header=False + ) self._logger.info("Congratulations. GSEApy ran successfully.................\n") return @@ -582,8 +586,8 @@ def run(self): indices=gsum.indices if isinstance(dat2, pd.DataFrame) else None, ) if self._outdir is not None: - self._logger.info( - "Start to generate gseapy reports, and produce figures..." + self.ranking.to_csv( + os.path.join(self.outdir, "prerank_data.rnk"), sep="\t", header=False ) self._logger.info("Congratulations. GSEApy runs successfully................\n")