Juhee
Juhee

Reputation: 13

R) Counts.csv.gz file to Seurat object

I usually import filtered feature bc matrix including barcodes.tsv.gz, features.tsv.gz, and matrix.mtx.gz files to R environment by Read10X function, and convert the data to Seurat object by CreateSeuratObject function.

However, I found out that some publicly available processed scRNA-seq data was shared only in the format of counts.csv.gz file. So, I tried to convert the counts.csv.gz files to Seurat object via following commands;

countsData<-read.delim(file = "~path/TUMOR1_counts.csv.gz", header = TRUE, sep = ",") Tumor2 <- CreateSeuratObject(counts = countsData, project = "Tumor2", min.cells = 3, min.features = 200)

However, the following error occured.

Error in CreateAssayObject(counts = counts, min.cells = min.cells, min.features = min.features) : No feature names (rownames) names present in the input matrix

Here is the counts.csv file that looks like this. How can I solve this problem?

enter image description here

Upvotes: 1

Views: 6063

Answers (2)

Mohammad ALKADI
Mohammad ALKADI

Reputation: 31

I think you have empty cells. You should fill them with zeros.

Upvotes: 0

Ilkyun Im
Ilkyun Im

Reputation: 129

At first, count matrix as an input for CreateSeuratObject() should have the cells in column and features in row. It seems like that you should use t() to convert your imported counts with the rownames.

I recommend you do like this:

countsData <- read.csv(file = "~path/TUMOR1_counts.csv", header = TRUE, row.names = 1)
Tumor2 <- CreateSeuratObject(counts = t(countsData), project = "Tumor2", min.cells = 3, min.features = 200)

Upvotes: 0

Related Questions