This is a test version of Biostars. For the public version, visit https://www.biostars.org.
extracting count matrix from default cell ranger files

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

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

1 answer

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).

Log in to answer this question.