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

Aditya - Changing cell node initializing value from Nan to data index #146

Merged
merged 3 commits into from
Jan 24, 2023

Conversation

adiark
Copy link
Collaborator

@adiark adiark commented Jan 21, 2023

NaN's were passed to initialize cell node parameter to build the graph, changed to index value

graph.ndata['label'] = torch.tensor([-1] * num_genes + list(np.arange(len(X))))

@adiark adiark requested a review from RemyLau January 23, 2023 15:41
@RemyLau
Copy link
Collaborator

RemyLau commented Jan 23, 2023

Thanks for your contribution @adiark! Could you elaborate a little more on the reason for this change? Does this cause an error in one of the examples scripts you are running? If so, could you provide some more context about the error it caused and how this change fixes that particular error?

@RemyLau
Copy link
Collaborator

RemyLau commented Jan 23, 2023

Since @WenzhuoTang worked on this module before, I'll also involve him in this thread.

@adiark
Copy link
Collaborator Author

adiark commented Jan 23, 2023

Sure @RemyLau. As per my understanding, on running the code graphsc.py with any example dataset, the function cell_gene_graph() was creating a graph with NAN values assigned in graph.ndata['label'] feature. So when training ID's where fetch (train_ids = np.where(labels != -1)[0]) to pass into dgl.dataloading.NodeDataLoader() function only NaN's where passed resulting in NoneType error. Changing graph.ndata['label'] = torch.tensor([-1] * num_genes + np.nan*len(x)) to graph.ndata['label'] = torch.tensor([-1] * num_genes + list(np.arange(len(X)))), results in adding row index at the end of the tensor. Therefore, train_ids will fetch the row index to pass into NodeDataLoader function, result in creating dataloader with right trainingID's

Copy link
Collaborator

@RemyLau RemyLau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explanation. Please remove the commented part #[np.nan]... from the code base. Otherwise, it LGTM.

dance/transforms/graph_construct.py Outdated Show resolved Hide resolved
Co-authored-by: Remy Liu <36778645+RemyLau@users.noreply.github.com>
@RemyLau RemyLau merged commit 980ce64 into OmicsML:main Jan 24, 2023
@adiark adiark deleted the Grapsc-Error branch January 24, 2023 01:06
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

Successfully merging this pull request may close these issues.

2 participants