Skip to content

Commit

Permalink
fix wrong output (lead_gene and heatmap) when permutation_type='gene_…
Browse files Browse the repository at this point in the history
…set' of gsea(), #190
  • Loading branch information
zqfang committed Feb 7, 2023
1 parent 4e29b42 commit be376cd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions gseapy/gsea.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ def calculate_metric(
else:
logging.error("Please provide correct method name!!!")
raise LookupError("Input method: %s is not supported" % method)
# ser = ser.sort_values(ascending=ascending)
ser_ind = ser.values.argsort().tolist()
ser = ser.iloc[ser_ind]
if ascending:
Expand Down Expand Up @@ -295,8 +294,10 @@ def run(self):
self.seed,
)
## need to update indices, prerank_rs only stores input's order
gsum.rankings[0] = dat2.values # so compatible with code code below
gsum.indices[0] = idx
# so compatible with code code below
indices = gsum.indices
indices[0] = idx
gsum.indices = indices # only accept [[]]
else: # phenotype permutation
group = list(
map(lambda x: True if x == self.pheno_pos else False, cls_vector)
Expand All @@ -319,7 +320,6 @@ def run(self):
self._logger.info(
"Start to generate GSEApy reports and figures............"
)

self.ranking = pd.Series(gsum.rankings[0], index=dat.index[gsum.indices[0]])
# reorder datarame for heatmap
# self._heatmat(df=dat.loc[dat2.index], classes=cls_vector)
Expand Down

0 comments on commit be376cd

Please sign in to comment.