stuart-lab / signac

R toolkit for the analysis of single-cell chromatin data
https://stuartlab.org/signac/
Other
316 stars 85 forks source link

RunSVD on Chromatin Assay producing dimensionality errir #1404

Closed carversh closed 1 year ago

carversh commented 1 year ago

Hi, I'm analyzing ATAC seq data and running into a dimensionality issue. Help would be greatly appreciated!:

peaks <- Read10X_h5(filename = "snATAC-seq_filtered_peak_bc_matrix.h5")
metadata <- read.csv(
  file = "cell_meta.csv",
  header = TRUE
)
atac <- CreateSeuratObject(
  counts = peaks,
  assay = "peaks",
  min.cells=1,
  min.features = 1,
  meta.data=metadata
)
atac <- RunTFIDF(atac
atac <- RunSVD(
  object = atac
))

When running RunSVD I get the following error:

Running SVD
Error in irlba(A = t(x = object), nv = n, work = irlba.work, tol = tol) : 
  max(nu, nv) must be strictly less than min(nrow(A), ncol(A))

The dimensionality of my data is:

@ Dim     : int [1:2] 217627 130418
  .. .. ..@ Dimnames:List of 2
  .. .. .. ..$ : chr [1:217627] "chr1-190849-191920" "chr1-629708-630559" "chr1-631640-631948" "chr1-632511-633105" ...
  .. .. .. ..$ : chr [1:130418] "AAACGAAAGAAACGCC-13" "AAACGAAAGAAATGGG-11" "AAACGAAAGAAATGGG-5" "AAACGAAAGAAATTCG-13" ...
carversh commented 1 year ago

The standard irlba function works on the data matrix when nv = 50, but it's hard to see what it is set to in Seurat.

timoast commented 1 year ago

By default, RunSVD uses the variable features for the assay. Since you haven't run FindTopFeatures() this would be an empty vector. You should run FindTopFeatures() or set the features parameter in RunSVD()