Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prerank empties out the dictionary #80

Closed
jolespin opened this issue May 28, 2019 · 4 comments
Closed

Prerank empties out the dictionary #80

jolespin opened this issue May 28, 2019 · 4 comments

Comments

@jolespin
Copy link

It's not working for some reason. I also don't know why it's emptying out my dictionary.

image

@jolespin jolespin changed the title Prerank fails with dictionary gene set and empties out the dictionary Prerank empties out the dictionary May 28, 2019
@zqfang
Copy link
Owner

zqfang commented May 29, 2019

Your gene_sets input has to be dictionary.

 gene_set = { 'GO:008138': ['b1838','b1411','b2737','b0049'], ...}

@zqfang zqfang closed this as completed Apr 22, 2020
@jolespin
Copy link
Author

Not sure how I'm just seeing this now but it's still doing it. My example above was a dictionary which is why I did .items so I could show the structure of the key value pairs.

@jolespin
Copy link
Author

jolespin commented Feb 22, 2021

image

Here's the code:

import pandas as pd
import gseapy as gp #version 

'0.10.1'
import numpy as np
import pickle

# Get gene rank weights
with open("data_files/gene_weights.dict.pkl", "rb") as f:
    genes = pd.Series(pickle.load(f))
rnk = genes.to_frame().reset_index()
rnk.columns = [0,1]    

# Make directories and containers
outdir = "prerank_output_testing"


# Get gene set
with open("data_files/ecocyc_pathways.dict.pkl", "rb") as f:
    gene_sets = pickle.load(f)

print("gene_sets is a {} type".format(type(gene_sets)))
print("First 10 items:", dict(list(gene_sets.items())[:10]))
print("There are a total of {} items".format(len(gene_sets)))

pre_res = gp.prerank(
    rnk=rnk, 
    gene_sets=gene_sets,
    processes=4,
    min_size=5,
    permutation_num=1000, 
    outdir=outdir,
    seed=0, 
    no_plot=False,

)

Here's the data_files directory:
data_files.zip

Can I request that we reopen this?

@dawe
Copy link

dawe commented May 9, 2022

Following up on this issue, I am using prerank on "KEGG_2021_Human" and I realized a gene list ('Non-homologous end-joining') is constantly removed from the testable ones. It is true it only contains 13 genes, but the same odd behaviour happens when I set min_size=5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants