This is a test version of Biostars. For the public version, visit https://www.biostars.org.
What to do with Seurat metadata and counts in separate text files?

I am trying to learn some single-cell methods, and wanted to work with this dataset: https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE190772

However, the data has already been through QC and pre-processing, and I can't figure out how to create a Seurat Object from a normalized count matrix and a metadata file instead of the expected barcodes, genes, and matrix files.

single-cell seurat

1 answer

Have a look at how CreateSeuratObject works: ?CreateSeuratObject.

CreateSeuratObject( counts, project = "SeuratProject", assay = "RNA",  meta.data = NULL)
  • counts is the normalised matrix ;
  • assay is the seurat slot. As you already have a normalised matrix, you need to set it to data.
  • meta.data is the table containing the metadata

You can then skip the first steps and proceed with the scaling, PCA, ....

Thanks for your reply - I actually tried something very similar, which I thought worked until I tried to complete scaling and dimension reduction:

logCounts <- data.table::fread("GSE190772_BoM_logCounts.txt")
BMmetaData <- data.table::fread("GSE190772_BoM_MetaData.txt")

bonemets <- CreateSeuratObject(counts = logCounts, assay = "data", meta.data = BMmetaData)'

all.genes <- rownames(bonemets)
bonemets <- ScaleData(bonemets, features = all.genes)
bonemets <- RunPCA(bonemets, features = VariableFeatures(object = bonemets))

Did I do this correctly? If so, it seems like there is some disagreement between the metadata and count matrix, or something is formatted weirdly...

Console looked like this:

> bonemets <- CreateSeuratObject(counts = logCounts, project = "SeuratProject", assay = "data", meta.data = BMmetaData)

Warning messages:

1: In CreateSeuratObject.default(counts = logCounts, project = "SeuratProject", : Some cells in meta.data not present in provided counts matrix

2: In storage.mode(from) <- "double" : NAs introduced by coercion

all.genes <- rownames(bonemets)
bonemets <- ScaleData(bonemets, features = all.genes)

Centering and scaling data matrix |==========================================================================================| 100%

bonemets <- RunPCA(bonemets, features = VariableFeatures(object = bonemets))

Error in irlba(A = t(x = object), nv = npcs, ...) : max(nu, nv) must be positive

Log in to answer this question.