dviraran / SingleR

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

Using Seurat Clusters to Annotate Cells based on Clusters #99

Closed MediciPrime closed 5 years ago

MediciPrime commented 5 years ago

Thank you for the awesome tool!

I was wondering if its possible to ask SingleR to use Seurat clusters (from an already present Seurat object) in order to annotate the cells? For example, I want to use Seurat clusters to annotate the cells based on clusters (not single cells).

I wasn't able to find this information in any of the other issue however if this is a repeat question, please point me to the issue containing the answer. Thank you!

dviraran commented 5 years ago

Of course. I am guessing you are referring to case 2 in this page. Just use clusters= the Seurat clusters identities.

MediciPrime commented 5 years ago

Thank you for your reply. I am running into the following error when I try using that command with the clusters parameter:

singler = CreateSinglerSeuratObject(counts, annot = NULL, "Efferocytosis", min.genes = 0, technology = "10X", species = "Mouse", citation = "", ref.list = list(), normalize.gene.length = F, variable.genes = "de", fine.tune = T, do.signatures = T, clusters = NULL, do.main.types = T, reduce.file.size = T, numCores = SingleR.numCores)

Error:Error in CreateSinglerSeuratObject(counts, annot = NULL, "Efferocytosis", : unused argument (clusters = NULL)

The command will only work if I leave the clusters parameter completely out. Now assuming that the error isn't present, what part of the Seurat v3 object would I include for the 'cluster' parameter? I think that I should be using the 'seurat_object@active.ident' attribute seeing as that contains the cluster information however I am not too sure.

Lastly, I don't see the use of the 'method' parameter for the CreateSinglerSeuratObject function (its there for the 'SingleR' function). Is it safe to assume that SingleR will identify cell types by clusters without having to add the 'method=cluster' parameter?

Thank you!

dviraran commented 5 years ago

The command will only work if I leave the clusters parameter completely out. Now assuming that the error isn't present, what part of the Seurat v3 object would I include for the 'cluster' parameter? I think that I should be using the 'seurat_object@active.ident' attribute seeing as that contains the cluster information however I am not too sure.

You are using the CreateSinglerSeuratObject. This creates a Seurat object first and uses the clusters derived with it as input for SingleR. There is no clusters parameter in this function. Please refer to case 2 in the link I sent above.

Lastly, I don't see the use of the 'method' parameter for the CreateSinglerSeuratObject function (its there for the 'SingleR' function). Is it safe to assume that SingleR will identify cell types by clusters without having to add the 'method=cluster' parameter?

Those functions are wrapper functions and they run SingleR 8 times - for 2 different references, using a broad and limited definition of cell types, each of those for single-cells and for clusters.

MediciPrime commented 5 years ago

Wow I was thinking of one function while writing another, I feel embarrassed! Thank you for your help, I was able to get my cells analyzed.