maximilianh / cellBrowser

main repo: https://github.com/ucscGenomeBrowser/cellBrowser/ - Python pipeline and Javascript scatter plot library for single-cell datasets, http://cellbrowser.rtfd.org
https://github.com/ucscGenomeBrowser/cellBrowser/
GNU General Public License v3.0
104 stars 41 forks source link

cbImportSeurat does not work with Seurat4.0.0 objects? #210

Closed cotedivoir closed 3 years ago

cotedivoir commented 3 years ago

Hi! Tried to run cbImportSeurat and got this error:

Object was created with Seurat version 4.0.0 Error in ExportToCellbrowser : can only process Seurat2 or Seurat3 objects, version of rds is 4.0.0

matthewspeir commented 3 years ago

Hi, @cotedivoir.

Thanks for the report! Sorry for the delay. We'll look into this soon. Would you be willing to share your Seurat 4 RDS with us so that we have a testing dataset when we sit down to investigate Seurat 4 support? If so, you can share a link to it with us at cells@ucsc.edu.

maximilianh commented 3 years ago

Hi Matt, I've allowed Seurat4 objects now in the develop branch. If you have Seurat4 installed, you can use pbmc_small or the pbmc3k object that is part of the tutorial: https://satijalab.org/seurat/archive/v3.0/interaction_vignette.html. It's possible that it just works... fingers crossed. I hope the Seurat authors have not broken compatibility, again...

On Thu, Apr 8, 2021 at 6:38 PM Matt Speir @.***> wrote:

Hi, @cotedivoir https://github.com/cotedivoir.

Thanks for the report! Sorry for the delay. We'll look into this soon. Would you be willing to share your Seurat 4 RDS with us so that we have a testing dataset when we sit down to investigate Seurat 4 support? If so, you can share a link to it with us at @.***

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/maximilianh/cellBrowser/issues/210#issuecomment-815972159, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACL4TN6PQGAHNSX5W7WRGTTHXLXBANCNFSM4Z4LFNBA .

matthewspeir commented 3 years ago

Your ExportToCellbrowser function doesn't seem to like that an older version of Seurat was used to create the RDS file?

INFO:root:inFname: seurat4.rds, outDir: tmp_seurat4, datasetName: tmp_seurat4
HERE rds
INFO:root:Wrote R script to tmp_seurat4/runSeurat.R
INFO:root:running tmp_seurat4/runSeurat.R through Rscript
Loading required package: Seurat
Attaching SeuratObject
Reading seurat4.rds as .rds file
Exporting Seurat data to tmp_seurat4
Seurat Version installed: 4.0.1
Object was created with Seurat version 3.1.4
Error in ExportToCellbrowser(sobj, "tmp_seurat4", "tmp_seurat4", markers.file = NULL,  : 
  The installed version of Seurat is different from Seurat object loaded. You have to down- or upgrade your installed Seurat version, see the Seurat documentation
Execution halted
maximilianh commented 3 years ago

Yes you need to save the object with Seurat 4, not 3.

On Fri 9 Apr 2021 at 18:37, Matt Speir @.***> wrote:

Your ExportToCellbrowser function doesn't seem to like that an older version of Seurat was used to create the RDS file?

INFO:root:inFname: seurat4.rds, outDir: tmp_seurat4, datasetName: tmp_seurat4 HERE rds INFO:root:Wrote R script to tmp_seurat4/runSeurat.R INFO:root:running tmp_seurat4/runSeurat.R through Rscript Loading required package: Seurat Attaching SeuratObject Reading seurat4.rds as .rds file Exporting Seurat data to tmp_seurat4 Seurat Version installed: 4.0.1 Object was created with Seurat version 3.1.4 Error in ExportToCellbrowser(sobj, "tmp_seurat4", "tmp_seurat4", markers.file = NULL, : The installed version of Seurat is different from Seurat object loaded. You have to down- or upgrade your installed Seurat version, see the Seurat documentation Execution halted

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/maximilianh/cellBrowser/issues/210#issuecomment-816807200, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACL4TIUNY7CY52R6CDNXL3TH4UMTANCNFSM4Z4LFNBA .

maximilianh commented 3 years ago

Hmm, there also is this function: https://www.rdocumentation.org/packages/Seurat/versions/3.1.4/topics/UpdateSeuratObject

I don't understand what it does, does it update from seurat 2 to seurat 3? Would it also work from Seurat 3 to Seurat 4? If it does, you could try it? Hey @cotedivoir, do you understand how to convert seurat objects between the different versions?

matthewspeir commented 3 years ago

I saved it in my env with Seurat4 installed, though I had to load it through their SeuratData package, so maybe that's why.

matthewspeir commented 3 years ago

The UpdateSeuratObject worked is updating it to v4.

Seems like cbImportSeurat is happy? It exported the matrix/meta/coords and it's calculating the markers now.

maximilianh commented 3 years ago

Great! This was a lot easier than expected.

On Fri 9 Apr 2021 at 19:39, Matt Speir @.***> wrote:

The UpdateSeuratObject worked is updating it to v4.

Seems like cbImportSeurat is happy? It exported the matrix/meta/coords and it's calculating the markers now.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/maximilianh/cellBrowser/issues/210#issuecomment-816844522, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACL4TJWY4Y2YVX4YIYKYRTTH43VHANCNFSM4Z4LFNBA .

cotedivoir commented 3 years ago

Hi! I commented out : if (substr(object@version, 1, 1)!='4' && substr(object@version, 1, 1)!='3') { stop("can only process Seurat2 or Seurat3 objects, version of rds is ", object@version) } in runSeurat which cbImportSeurat generates, and it worked for my Seurat 4 objects

maximilianh commented 3 years ago

Great, yes, that's more or less what I did in the develop version, to accept version 4.

Even better to hear to this worked for you. Matt, I guess we can close the ticket then?

On Fri, Apr 9, 2021 at 11:36 PM Anastasia @.***> wrote:

Hi! I commented out : if @., 1, 1)!='4' && @., 1, 1)!='3') { stop("can only process Seurat2 or Seurat3 objects, version of rds is ", @.***) } in runSeurat which cbImportSeurat generates, and it worked for my Seurat 4 objects

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

matthewspeir commented 3 years ago

Sounds good! Let's close it. :)

RoganGrant commented 2 years ago

To clarify, are seurat4 objects supported in any release versions as of now?

matthewspeir commented 2 years ago

We run cbImportSeurat on seurat4 objects all the time.

RoganGrant commented 2 years ago

Thank you! I ended up answering my own question anyway in 1.2.1

matthewspeir commented 2 years ago

Awesome :)