From 7d16d760e4994af4c6a9f83d33ee5e2444e43f2d Mon Sep 17 00:00:00 2001 From: Zhuoqing Fang Date: Sun, 15 Dec 2024 16:26:50 -0800 Subject: [PATCH] input format check, #250 --- gseapy/gsea.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gseapy/gsea.py b/gseapy/gsea.py index b910eba..80817c5 100644 --- a/gseapy/gsea.py +++ b/gseapy/gsea.py @@ -518,6 +518,12 @@ def load_ranking(self): parse rnk input """ rank_metric = self._load_data(self.rnk) # gene id is the first column + # only two column dataframe is accepted + if rank_metric.shape[1] > 2: + raise ValueError( + "Input gene rankings should be a two column dataframe, " + + "with the first column as gene names and the second column as prerank values." + ) if rank_metric.select_dtypes(np.number).shape[1] == 1: # return series return self._load_ranking(rank_metric)