KrishnaswamyLab / PHATE

PHATE (Potential of Heat-diffusion for Affinity-based Transition Embedding) is a tool for visualizing high dimensional data.
http://phate.readthedocs.io
GNU General Public License v2.0
464 stars 72 forks source link

Install "scottgigante/seurat", ref="patch/add-PHATE-again" get error #104

Closed Roger-GOAT closed 3 years ago

Roger-GOAT commented 3 years ago

Dear Dr.Gigante, I get great result from phate.R. However, I can't write the embedding back to Seurat object. Q1: devtools::install_github("scottgigante/seurat", ref="patch/add-PHATE-again"), error as below: Error in parse(con, keep.source = FALSE, srcfile = NULL) : 284:1: unexpected input 283: export(RunPCA) 284: << ^ Calls: ... withCallingHandlers -> loadNamespace -> parseNamespaceFile -> parse Execution halted ERROR: lazy loading failed for package ‘Seurat’ ─ removing ‘/tmp/RtmpjZATAL/Rinst217acf75462a82/Seurat’

ERROR: package installation failed Error: Failed to install 'Seurat' from GitHub: System command 'R' failed, exit status: 1, stdout + stderr (last 10 lines): E> 284:1: unexpected input E> 283: export(RunPCA) E> 284: << E> ^ E> Calls: ... withCallingHandlers -> loadNamespace -> parseNamespaceFile -> parse E> Execution halted E> ERROR: lazy loading failed for package ‘Seurat’ E> * removing ‘/tmp/RtmpjZATAL/Rinst217acf75462a82/Seurat’ E> ----------------------------------- E> ERROR: package installation failed Q2:If I give up to install this version of Seurat, how to write the Phate result into Seurat object? Or write a .csv file from py.phate result? I notice the there is more than one embedding in phate result. Thank you for your time. Best!

scottgigante commented 3 years ago

Hi @Roger-GOAT ,

Looks like installation from satijalab/seurat is broken right now per https://github.com/satijalab/seurat/issues/4226.

You can fix this with

devtools::install_version("spatstat", version = "1.64-1")

and then try again to install my fork, which I've updated to Seurat 4.0.0.

devtools::install_github("scottgigante/seurat", ref="patch/add-PHATE-again")

If you can't install the fork, you can run PHATE on a Seurat object by doing the following:

assay = 'RNA'
data <- t(GetAssayData(object = seurat_data, slot = 'data', assay = assay))
phate_output <- phateR::phate(data)

# save PHATE result to csv
readr::write_csv(as.data.frame(phate_output))

# save PHATE result to Seurat
phate_output <- as.matrix(phate_output)
colnames(phate_output) <- paste0("PHATE_", 1:ncol(phate_output))
rownames(phate_output) <- rownames(seurat_data)
phate.reduction <- CreateDimReducObject(
    embeddings = phate_output,
    key = "PHATE_",
    assay = assay
)
seurat_data[["phate"]] <- phate.reduction

Feel free to reopen if you're still having issues.

Roger-GOAT commented 3 years ago

Thank you Scott. I don't know why I succeed to do this: devtools::install_github("scottgigante/seurat", ref="patch/add-PHATE-again") (I done this "spatstat", version = "1.64-1" before I submited this issue). But I get all the reduction image (tSNE,umap,PHATE) like this: image I never met this before. Maybe some conflicts between packages.

scottgigante commented 3 years ago

Does this happen if you go back to the reference installation for Seurat?