how to combine barcodes features matrix files into combined matrix
1
0
Entering edit mode
24 months ago
Emily ▴ 70

I have 3 files (barcodes.tsv, features.tsv and matrix.mtx) which I want to make them into one matrix. rows will be features columns will be barcodes and the counts (matrix) being the data points.

How can I do this on R?

R data • 1.3k views
ADD COMMENT
1
Entering edit mode
24 months ago
ATpoint 82k

Read the mtx file with readMM() from the Matrix package. Then load the other two with something like read.delim(). From there it's standard R operations, so use colnames() to assign the content of the barcode file as colnames and rownames() to assign the gene information from the feature file as rownames. You might consider using container formats such as a Seurat objects or SingleCellExperiments to store the data as this allows to keep everything in sync. If this is single-cell data you might follow a good guide such as https://bioconductor.org/books/release/OSCA/

ADD COMMENT

Login before adding your answer.

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