Thank you so much!
Hi,
Please bear with me as I am a beginner with single cell RNAseq.
I am interested in downloading specific NSCLC patient samples with known KRAS mutations under GEO accession GSE136246. To my understanding, because I am only interested in specific patients from this study, the gene counts under the supplementary data wouldn't be of interest to me because they contain samples that I do not want.
I tried downloading the specific count files for each sample under each sample's supplementary file links, which are supplied as count.tsv files. My understanding is that as long as the count matrix contains the barcodes and cell names as columns and features/genes as rows. This is what the tsv file looks like
I also shared the file here: link to file
My question is that is this even the correct file I can use to create a Seurat object for this specific patient? And if so, is it in the right format? I just did:
TestSeurat = CreateSeuratObject(counts = "file")
My overall goal is to create individual Seurat objects and merge them together under specific conditions to visualize DE between groups.
1 answer
Seurat expects cell barcodes as columns, and features (genes) as rows. This means you need to transpose the data once you load it. It's also important to convert it to a sparse matrix.
library("data.table")
library("Matrix")
library("Seurat")
# Use data.table to load the count matrix as a data.frame.
mat <- fread("GSM4043245_NSC015.t1.counts.tsv")
setDF(mat)
# Set the barcodes as the row names.
rownames(mat) <- mat[[1]]
mat[[1]] <- NULL
# Transpose the data and convert to sparse matrix.
mat <- as(t(as.matrix(mat)), "sparseMatrix")
# Create the Seurat object.
seu <- CreateSeuratObject(counts=mat)
And the result.
> seu
An object of class Seurat
41861 features across 2215 samples within 1 assay
Active assay: RNA (41861 features, 0 variable features)
Log in to answer this question.