From 6225facb68256b4948cc3cb8c9709444e1aef515 Mon Sep 17 00:00:00 2001 From: Yuki SUYAMA Date: Fri, 22 Dec 2023 15:18:32 +0900 Subject: [PATCH 1/2] Fixed to run prerank without error with rnk (type(pd.Series.name) == str) --- gseapy/base.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/gseapy/base.py b/gseapy/base.py index c2efa60..96312aa 100644 --- a/gseapy/base.py +++ b/gseapy/base.py @@ -183,11 +183,15 @@ def _load_data(self, exprs: Union[str, pd.Series, pd.DataFrame]) -> pd.DataFrame elif isinstance(exprs, pd.Series): # change to DataFrame self._logger.debug("Input data is a Series with gene names") - if exprs.name is None: - # rename col if name attr is none - exprs.name = "sample1" - elif exprs.name.dtype != "O": - exprs.name = exprs.name.astype(str) + if not isinstance(exprs.name, str): + if exprs.name is None: + # rename col if name attr is none + exprs.name = "sample1" + elif hasattr(exprs.name, "dtype"): + if exprs.name.dtype != "O": + exprs.name = exprs.name.astype(str) + else: + exprs.name = str(exprs.name) rank_metric = exprs.reset_index() elif os.path.isfile(exprs): rank_metric = self._read_file(exprs) From a667b14621c66308b83388a0ee65825d454a9741 Mon Sep 17 00:00:00 2001 From: Yuki SUYAMA Date: Tue, 20 Feb 2024 12:23:33 +0900 Subject: [PATCH 2/2] align gene hits track in TracePlot (fixes zqfang/GSEApy#248) --- gseapy/plot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gseapy/plot.py b/gseapy/plot.py index d528d53..0cc4441 100644 --- a/gseapy/plot.py +++ b/gseapy/plot.py @@ -1342,7 +1342,7 @@ def axes_hits( trans2 = transforms.blended_transform_factory(ax2.transData, ax2.transAxes) # align hits to runes ax2.vlines( - [0, len(self.runes) - 1], + [1, len(self.runes[0])], 0, 1, linewidth=0.5,