dviraran / SingleR

SingleR: Single-cell RNA-seq cell types Recognition (legacy version)
GNU General Public License v3.0
263 stars 98 forks source link

Disconnected from the server. Unable to load file even the RDS file looks fine. #70

Open phoebee-h opened 5 years ago

phoebee-h commented 5 years ago

Hey, thanks for developing such a great annotation tool! I've followed the instruction as described on your website, as well as the S4 object transformation. All work fine except that some warnings pop up like this, but which I don't think affect much about my result (maybe?) image

My code: singler = CreateSinglerObject(pbmc_standard[['RNA']]@counts, annot = NULL, 'pbmc_standard', min.genes = 0, technology = "10X", species = "Human", citation = "", ref.list = list(), normalize.gene.length = F, variable.genes = "de", fine.tune = T, do.signatures = T, clusters = pbmc_standard@active.ident, do.main.types = T, reduce.file.size = T, numCores = SingleR.numCores)

singler$meta.data$xy = pbmc_standard@reductions$tsne@cell.embeddings singler$meta.data$clusters = pbmc_standard@active.ident singler.new = convertSingleR2Browser(singler) singler.new@expr <- pbmc_standard[['RNA']]@data saveRDS(singler.new,file=paste0(singler.new@project.name,'.rds'))

My questions:

  1. Am I wrong if I use the "pbmc_standard[['RNA']]@counts" directly from the previous Seurat object? (=> but it does generate the SingleR object?)

  2. What is necessary in the rds file to upload? The slots such as singler.new@xy, singler.new@labels... are well stored in the file, what else should I check?

dviraran commented 5 years ago

Thanks!

  1. No, you are correct. That is the way to do it.
  2. I really don't know. I will upload very soon a stand-alone version. Running it from your R will allow you to detect where it is failing.
dviraran commented 5 years ago

Deployed it. Download the files here, install all the required libraries and run the app (shiny::runApp('~/SingleRbrowseR-standalone'), or where ever you put the directory).

library(shiny) library(SingleR) library(dendextend) library(Matrix) library(canvasXpress) library(corrplot) library(ggplot2) library(matrixStats) library(plyr) library(reshape) library(dplyr) library(htmlwidgets) library(pheatmap) library(Seurat)

phoebee-h commented 5 years ago

Hey Dvir, It goes well on my computer (Left plot)! Thanks a lot! By the way, I would like to ask you if I understand SingleR correctly:

  1. SingleR is a tool that we can definitely plot the cluster/ heatmap locally (i.e. by "SingleR.PlotTsne"), once we got the results annotated by "CreateSinglerObject".
  2. The reference set mentioned in the Supplementary Note1 ("ImmGen" + "dataset of 358 mouse RNA-seq samples" + "HPCA" + "Blueprint+Encode") are all included in the SingleR package, so that's why we can have cell annotation (Right plot).

Thank you again, for such a quick reply and supporting solution.

image

dviraran commented 5 years ago

Great!

  1. Yes.

  2. Yes, all 4 are included (2 for mouse, 2 for human). You can change singler$singler[[1]] to 2 and you will see here the blueprint/encode based analysis.

phoebee-h commented 5 years ago

Hey Dvir, According to initial question, I think the problem might cause by "object of type 'closure' is not subsettable". This is the only plot that doesn't show up, but I couldn't figure out which part of the singler.new is wrong. Do you have any idea? What argument of "SingleR-class" may raise this error? image

dviraran commented 5 years ago

found the issue and fixed it. Download again app.R and helpers.R.

phoebee-h commented 5 years ago

I am sorry to bother you, but here's another error...

image

dviraran commented 5 years ago

That seems like a problem with your data for some reason. Can you look at the rownames of singler.new@xy and rownames of singler.new@scores[[1]]? they should be the same, if not something weird is happening.

phoebee-h commented 5 years ago

Hey Dvir,

Ok, the last problem has been solved and no problems to the RDS file, which I can eventually run both locally or upload to your website! Thank you. Indeed, the row names are different and it was caused by my manually edited (and of course, this is just a toy data). Because I found the "Proportions" plot was grouped by the "orig.ident", but my data are from a single experiment library, which is only annotated as "pbmc3k". Thus, I manually changed them as code described below; otherwise, the "Proportions" plot may raiseError: 'names' attribute [3] must be the same length as the vector[1]

levels(pbmc_standard[['orig.ident']]$orig.ident) <- c(levels(pbmc_standard[['orig.ident']]$orig.ident), "pbmc4k")
pbmc_standard[['orig.ident']]$orig.ident[1:250] <- 'pbmc4k'
colnames(pbmc_standard[['RNA']]@counts)[1:250] <- paste0(colnames(pbmc_standard[['RNA']]@counts)[1:250],'-1')
colnames(pbmc_standard[['RNA']]@counts)[251:521] <- paste0(colnames(pbmc_standard[['RNA']]@counts)[251:521],'-2')

image

Thanks again. Your friendly reply and kindness are very supportive for a newbie in single-cell RNA sequencing. We may close this session. :)