0
$\begingroup$

I am working on integrating a labelled single cell RNA seq cell atlas with an unlabelled one. I am wondering how do I determine the value of max.features when integrating two single cell RNA seq datasets?

Below is the code I am using:

epithelial = Read10X(data.dir="/projects/b1025/sdi0596/Covid19_Single_Cell_RNASeq_project/filtered_matrices_count/epithelial/filtered_feature_bc_matrix/",gene.column=1,cell.column=1)
habermann = Read10X(data.dir="/projects/b1025/sdi0596/Covid19_Single_Cell_RNASeq_project/filtered_matrices_count/Habermann_Single_Cell_Data/",gene.column=1,cell.column=1)

data.list=c(epithelial,habermann)

normalize and identify variable features for each dataset independently
ifnb.list <- lapply(X = data.list, FUN = function(x) {
x <- NormalizeData(x)
x <- FindVariableFeatures(x, selection.method = "vst", nfeatures = 2000)
})

Perform integration
immune.achors= FindIntegrationAnchors(object.list = ifnb.list,max.features = 200,verbose = TRUE)

Error in FindIntegrationAnchors(object.list = ifnb.list, max.features = 200, :
Max dimension too large: objects 1, 2 contain fewer than 30 cells.
Please specify a maximum dimensions that is less than the number of cells in any object (4).

Regarding the dimension of these objects, the epithelial one is 33538 x 49109 and the habermann is 33694 x 220213. Any insights would be highly helpful.

Thank you.

$\endgroup$
1
$\begingroup$

There's a few problems with your code, first, when you do Read10X() it returns you a sparse matrix, and you need to put this into a Seurat object with meta data, before doing the integration.

So for example, i create some example data that is similar to your output from Read10X() :

library(Matrix)

epithelial = Matrix(matrix(rnbinom(100000,mu=200,size=1),ncol=50),sparse=TRUE)
rownames(epithelial) = paste0("gene",1:2000)
colnames(epithelial) = paste0("e",1:50)

habermann = epithelial + rnbinom(100000,mu=20,size=1)
colnames(habermann) = paste0("h",1:50)

Then convert to a seurat object:

data.list=c(epithelial = CreateSeuratObject(epithelial),
            habermann = CreateSeuratObject(habermann))

Then find variable features:

data.list <- lapply(data.list, FUN = function(x) {
x <- NormalizeData(x)
x <- FindVariableFeatures(x, selection.method = "vst", nfeatures = 2000)
})

Should look like this:

$epithelial
An object of class Seurat 
2000 features across 50 samples within 1 assay 
Active assay: RNA (2000 features, 2000 variable features)

$habermann
An object of class Seurat 
2000 features across 50 samples within 1 assay 
Active assay: RNA (2000 features, 2000 variable features)

Now perform integration, below I have to reduce k.filter because I have very little cells in this example. In your case, you can simply use the default settings.

features <- SelectIntegrationFeatures(object.list = data.list)
anchors= FindIntegrationAnchors( data.list,max.features = 200,
k.filter=50,k.anchor = 3,verbose = TRUE)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.