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

umap() produces matrix instead of S3 object #19

Closed
umasstr opened this issue Dec 24, 2022 · 2 comments
Closed

umap() produces matrix instead of S3 object #19

umasstr opened this issue Dec 24, 2022 · 2 comments

Comments

@umasstr
Copy link

umasstr commented Dec 24, 2022

I have a data frame, b, with 21 sample rows and 1789 uniquely-names gene rows.

> class(b)
[1] "data.frame"
> ncol(b)
[1] 1789
> nrow(b)
[1] 21

umap runs without error or warning. I think that umap is supposed to generate an S3 object, but I only get a 2-column matrix with coordinates. This is fine for generating the plot, but I wanted to extract other information from layout. Any suggestions? Thanks!

> um<-umap(b,n_neighbors = 10)
> class(um)
[1] "matrix"
> nrow(um)
[1] 21
> ncol(um)
[1] 2
@tkonopka
Copy link
Owner

Hi @umasstr. Yes, the output is supposed to be an S3 object. If you are getting a matrix, is it possible that you loaded package uwot after loading package umap? (Package uwot performs dimensional reduction in a similar way, but it has slightly different features and API.) If that's the case, and if you want to keep using both packages in the same R session, you can still run umap from this package by calling umap::umap(b).

@umasstr
Copy link
Author

umasstr commented Dec 24, 2022

Wow, I wouldn't have thought of that. All set—runs quickly and without error or warning.
Thanks, and happy holidays!

@umasstr umasstr closed this as completed Dec 24, 2022
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

2 participants