yanwu2014 / swne

Similarity Weighted Nonnegative Embedding (SWNE), a method for visualizing high dimensional datasets
BSD 3-Clause "New" or "Revised" License
103 stars 20 forks source link

Seurat- SCTransform compatibility? #30

Closed mr-september closed 3 years ago

mr-september commented 3 years ago

Seems similar to #25.

Typical PBMC 5K data, preprocessed and clustered in Seurat (and native SCTransform).

FindNeighours done, UMAP generated. But swne.embedding <- RunSWNE(data_transcripts_seurat, k = 20)

calculating variance fit ... using gam [1] "4800 variable genes to use"
Computing nearest neighbor graph
Computing SNN
Error in as(object@graphs$RNA_snn, "dgCMatrix") : 
  no method or default for coercing “NULL” to “dgCMatrix”
In addition: Warning message:
In pf(exp(df$res), n.obs, n.obs, lower.tail = F, log.p = F) : NaNs produced

Checking my seurat object, it turns out there's no RNA_snn, but instead there's SCT_nn and SCT_snn.

Would this error be solved by making SWNE look for object@graphs$SCT_snn instead? If so, how?

yanwu2014 commented 3 years ago

Hi! Sorry for the late reply, was working on a manuscript deadline. Thanks for pointing this out, I've updated the RunSWNE function to look for object@graphs$SCT_nn when the DefaultAssay is SCT, which it is automatically set to after running SCTransform. Let me know if that works!

mr-september commented 3 years ago

Hi, thank you! I forgot about this but just tried it again today and it works flawlessly now!

Just another suggestion: in your Readme, maybe recommend remotes::install_github() instead of devtools::install_github(), the former has much less dependencies and often work where the latter gives errors.

yanwu2014 commented 3 years ago

Thanks for the suggestion, I just updated to using remotes! Yeah I've noticed devtools does not handle dependencies well too

mr-september commented 3 years ago

Hi @yanwu2014, apologies for the mistake, I double checked and realised it's remotes::install_github(), not remotes::install()