Skip to content

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

Description

@jolespin

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions