JinmiaoChenLab / Rphenograph

Rphenograph: R implementation of the PhenoGraph algorithm
46 stars 26 forks source link

I load the Phenograph package, but I keep getting the error "could not find function "Rphenograph" #5

Open Gesseca opened 5 years ago

Gesseca commented 5 years ago

I installed the Phenograph package with the following code:

Load data.table package

library(data.table)

Load Phenograph

if(!require(devtools)){ install.packages("devtools") # If not already installed } devtools::install_github("JinmiaoChenLab/Rphenograph")

When I try to use the Rphenograph function, I get an error:

data<- df_phenograph Rphenograph_out <- Rphenograph(data, k = 30)

"Error in Rphenograph(data, k = 30) : could not find function "Rphenograph"

Any idea why this could be happening? Thank you.

ebecht commented 5 years ago

Naive guess but have you tried adding library(Rphenograph) before the call to Rphenograph() ? The part about installation (install_github()...) doesn't actually load the package

Gesseca commented 5 years ago

O.M.G. Newbie mistake LOL. I will try it!

Gesseca commented 5 years ago

Yup. It worked and I feel silly. No guess is too naive! Thanks for the help. Sometimes you just need an extra set of eyes : )

Gesseca commented 5 years ago

Ok, so that one line of code now works:

Rphenograph_out <- Rphenograph(data, k = 30)

but the next line of code doesn't:

df_phenograph$Phenograph <- factor(membership(Rphenograph_out[[2]]))

It says "Error: object 'Rphenograph_out' not found"

How can this be, when I literally just stored the output in the object 'Rphenograph_out' in the previous line?

Thank you

ebecht commented 5 years ago

Yes that should indeed work. Are you certain that the first line actually worked ? i.e. can you succesfully run str(Rphenograph_out) ?

Gesseca commented 5 years ago

Nope. I get this:

Error in str(Rphenograph_out) : object 'Rphenograph_out' not found

So I guess the first line didn't work, but no error was thrown or anything like that. The output seems like it worked:

Rphenograph_out<- Rphenograph(data, k = 30) Run Rphenograph starts: -Input data of 2194921 rows and 28 columns -k is set to 30 Finding nearest neighbors...Error in nn2(data, data, k, searchtype = "standard") : NA/NaN/Inf in foreign function call (arg 1) In addition: Warning messages: 1: In nn2(data, data, k, searchtype = "standard") : NAs introduced by coercion 2: In nn2(data, data, k, searchtype = "standard") : NAs introduced by coercion Timing stopped at: 38.25 1.148 43.09

So reading this again, I am guessing that the NA values are causing a problem. Do you have a suggestion for how to handle them? Will I get better results if I remove all lines that have NAs or if I just replace NA's with zeros? I feel like replacing them with zeros might alter the data in a way that's misleading. Thoughts?

ebecht commented 5 years ago

Indeed the NAs are causing the issue. I think if that's a valid option it's a good and easy first step to remove rows with NAs.

Then if you really need to keep them you can try to impute these, I have never tried that though.

ElsaCardoso commented 2 years ago

Hi, I would like to run Rphenograph but RStudio doesn´t find it:

library(devtools) library(usethis) library(Rphenograph) Error in library(Rphenograph) : there is no package called ‘Rphenograph’

I also can´t find this package in CRAN or bioconductor Any help is welcome!

ebecht commented 2 years ago

You can check out https://github.com/JinmiaoChenLab/Rphenograph to see how to install the package from github (use install_github())

ElsaCardoso commented 2 years ago

Thanks. It worked, but after running twice R section aborted

SamGG commented 2 years ago

Hi, I think you should have started a new issue. I updated and released a new version of Rphenograph at https://github.com/i-cyto/Rphenograph Issues are also opened on that repo. You could also try the fast version of Jan https://github.com/stuchly/Rphenoannoy @ebecht take a look at Jan's autoencoder for dimension reduction https://github.com/stuchly/rVictis Best.

ElsaCardoso commented 2 years ago

Thank you Samuel