extracting count matrix from default cell ranger files
1
0
Entering edit mode
4.1 years ago
kanwarjag ★ 1.2k

I am looking for a non programmatic method or additional software that can make count matrix of genes from three file: barcode.tsv feature.tsv matrix.mtx

Is there any tool or software? Thanks

RNA-Seq • 1.6k views
ADD COMMENT
0
Entering edit mode

Ask whoever used cellranger to make those files to use celllranger to make the full non-sparse matrix.

ADD REPLY
0
Entering edit mode
4.1 years ago
ATpoint 85k

Non-programatical does not exist afaik.

Follow the cellranger manual:

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

library(Matrix)
matrix_dir = "/opt/sample345/outs/filtered_feature_bc_matrix/"
barcode.path <- paste0(matrix_dir, "barcodes.tsv.gz")
features.path <- paste0(matrix_dir, "features.tsv.gz")
matrix.path <- paste0(matrix_dir, "matrix.mtx.gz")
mat <- readMM(file = matrix.path)
feature.names = read.delim(features.path, 
                           header = FALSE,
                           stringsAsFactors = FALSE)
barcode.names = read.delim(barcode.path, 
                           header = FALSE,
                           stringsAsFactors = FALSE)
colnames(mat) = barcode.names$V1
rownames(mat) = feature.names$V1

If you really want a plain matrix then use as.matrix(mat) but I wonder what that would be good for. Single-cell matrices are in compressed formats for a reason (size, not feasble for manual inspection).

ADD COMMENT

Login before adding your answer.

Traffic: 2078 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