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

How to interpret the ec2pathway.pkl file (e.g., enzyme and pathway labels)? #3

Open
jolespin opened this issue May 3, 2024 · 0 comments

Comments

@jolespin
Copy link

jolespin commented May 3, 2024

I've loaded the file into Python but I can't figure out how to interpret the results inside. I'm assuming the rows are compounds and columns are pathways but how can I get the labels of enzymes and pathways?

import pickle
with open("/Users/jolespin/Databases/Pathway2Vec/ec2pathway.pkl", "rb") as f:
    ec2pathway = pickle.load(f)
    # DeprecationWarning: Please use `lil_matrix` from the `scipy.sparse` namespace, the `scipy.sparse.lil` namespace is deprecated.
    
type(ec2pathway) 
# scipy.sparse._lil.lil_matrix

ec2pathway.data
# array([list([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]),
#        list([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]),
#        list([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]),
#        ..., list([]), list([1, 1, 1, 1, 1, 1, 1, 1]), list([1, 1])],
#       dtype=object)

df = pd.DataFrame(ec2pathway.todense())
print(df.shape)
# (6378, 2526)

df[0][lambda x: x != 0]

# 3579    1
# 3667    1
# 3678    1
# 3681    1
# Name: 0, dtype: int32
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

1 participant