To generate an scRNA counts file using barcodes.tsv, genes.tsv and matrix.mtx file
2
0
Entering edit mode
4.7 years ago

Hi,

I have barcodes.tsv, genes.tsv and matrix.mtx file from my RNA seq data and I want to generate a scRNA counts files using R. When I tried using readMM function, It gives me the following error: Error: cannot allocate vector of size 185.1 Gb. This happens even when I run it as a job. How can I generate a combined csv file using R?

Thank you.

RNA-Seq R • 6.0k views
ADD COMMENT
1
Entering edit mode
4.7 years ago

You should use a package meant to coerce your files into a format that's easier to work with, such as a SingleCellExperiment object via DropletUtils or a Seurat object.

These formats are designed to work with other R packages meant for scRNA analysis (like scater, scran, Seurat, etc).

ADD COMMENT
0
Entering edit mode

Hi, I am running it with Seurat. But when I create it as a seurat object using the mtx file, my Rstudio crashes when I try to make clusters from my RNA Seq data. The script requires the seurat object to be created using csv file and that what I am trying to generate.

ADD REPLY
3
Entering edit mode

No, Seurat does not require the data to be in csv. Use Read10X to import your 10X data for object creation.

ADD REPLY
0
Entering edit mode
4.7 years ago
piyushjo ▴ 700

You can follow the instruction on the following webpage with the heading "Loading matrices into R".

https://support.10xgenomics.com/single-cell-gene-expression/software/pipelines/latest/output/matrices

It will generate what is called a "sparse-matrix". Then you convert the sparse-matrix (SM) into normal matrix (NM) with following command in R.

NM<-as.matrix(SM)

Cautionary word: the matrix would be huge depending upon the number of cells. Also the following code is for V3 output that gives "features.tsz.gz" file instead of old "genes.tsz.gz".

You have to put all the three output files form one experiment into the same folder.

ADD COMMENT

Login before adding your answer.

Traffic: 1505 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6