text: user4307: 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.
  
  user5077: 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)
  
  
original_text: 4307: <p>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?</p>
  <p>Below is the code I am using:</p>
  <pre><code>epithelial = Read10X(data.dir=&quot;/projects/b1025/sdi0596/Covid19_Single_Cell_RNASeq_project/filtered_matrices_count/epithelial/filtered_feature_bc_matrix/&quot;,gene.column=1,cell.column=1)
  habermann = Read10X(data.dir=&quot;/projects/b1025/sdi0596/Covid19_Single_Cell_RNASeq_project/filtered_matrices_count/Habermann_Single_Cell_Data/&quot;,gene.column=1,cell.column=1)
  
  data.list=c(epithelial,habermann)
  
  normalize and identify variable features for each dataset independently
  ifnb.list &lt;- lapply(X = data.list, FUN = function(x) {
  x &lt;- NormalizeData(x)
  x &lt;- FindVariableFeatures(x, selection.method = &quot;vst&quot;, 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).
  </code></pre>
  <p>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.</p>
  <p>Thank you.</p>
   5077: <p>There's a few problems with your code, first, when you do <code>Read10X()</code> it returns you a sparse matrix, and you need to put this into a <code>Seurat</code> object with meta data, before doing the integration.</p>
  <p>So for example, i create some example data that is similar to your output from <code>Read10X()</code> :</p>
  <p>library(Matrix)</p>
  <pre><code>epithelial = Matrix(matrix(rnbinom(100000,mu=200,size=1),ncol=50),sparse=TRUE)
  rownames(epithelial) = paste0(&quot;gene&quot;,1:2000)
  colnames(epithelial) = paste0(&quot;e&quot;,1:50)
  
  habermann = epithelial + rnbinom(100000,mu=20,size=1)
  colnames(habermann) = paste0(&quot;h&quot;,1:50)
  </code></pre>
  <p>Then convert to a seurat object:</p>
  <pre><code>data.list=c(epithelial = CreateSeuratObject(epithelial),
              habermann = CreateSeuratObject(habermann))
  </code></pre>
  <p>Then find variable features:</p>
  <pre><code>data.list &lt;- lapply(data.list, FUN = function(x) {
  x &lt;- NormalizeData(x)
  x &lt;- FindVariableFeatures(x, selection.method = &quot;vst&quot;, nfeatures = 2000)
  })
  </code></pre>
  <p>Should look like this:</p>
  <pre><code>$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)
  </code></pre>
  <p>Now perform integration, below I have to reduce <code>k.filter</code> because I have very little cells in this example. In your case, you can simply use the default settings.</p>
  <pre><code>features &lt;- SelectIntegrationFeatures(object.list = data.list)
  anchors= FindIntegrationAnchors( data.list,max.features = 200,
  k.filter=50,k.anchor = 3,verbose = TRUE)
  </code></pre>
  