This is a test version of Biostars. For the public version, visit https://www.biostars.org.
GSEApy

I want to run GSEApy as per describe in the documentation: </br>
https://gseapy.readthedocs.io/en/latest/gseapy_example.html#4.-GSEA-Example

Github code: https://github.com/zqfang/GSEApy/blob/master/gseapy/gsea.py

I also tried to run with the sample "Leukemia.cls" file provided by the example and received the same error message.

What is my mistake?

phenoA, phenoB, class_vector = gp.parser.gsea_cls_parser("../input/subtype-cls/subtype.cls")
gene_sets = ["KEGG_2021_Human", "Reactome_2022", "BioCarta_2016", "WikiPathway_2021_Human", "Panther_2016"]
# run gsea
# enrichr libraries are supported by gsea module. Just provide the name
gs_res = gp.gsea(data=gene_exp, # or data='./P53_resampling_data.txt'
                 gene_sets=gene_sets, # or enrichr library names
                 cls= "../input/subtype-cls/subtype.cls")

Traceback:

---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
/tmp/ipykernel_27/2082971161.py in <module>
      3 gs_res = gp.gsea(data=gene_exp, # or data='./P53_resampling_data.txt'
      4                  gene_sets=gene_sets, # or enrichr library names
----> 5                  cls= "../input/subtype-cls/subtype.cls")

/opt/conda/lib/python3.7/site-packages/gseapy/__init__.py in gsea(data, gene_sets, cls, outdir, min_size, max_size, permutation_num, weighted_score_type, permutation_type, method, ascending, threads, figsize, format, graph_num, no_plot, seed, verbose, processes, *arg, **kwarg)
    148         verbose,
    149     )
--> 150     gs.run()
    151 
    152     return gs

/opt/conda/lib/python3.7/site-packages/gseapy/gsea.py in run(self)
    245         self.cls_dict = cls_dict
    246         # data frame must have length > 1
--> 247         assert len(dat) > 1
    248         # ranking metrics calculation.
    249         dat2 = self.calculate_metric(

AssertionError: 

subtype.cls

287 2 1
# KIRC normal
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 0 1 0 1 0 0 0 1 0 1 0 0 1 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
gsea gseapy

0 answers

No answers yet.

Log in to answer this question.