converting a sc-RNA matrix from .txt to MatrixMarket .mtx file.
2
1
Entering edit mode
2.6 years ago
rtrujillo123 ▴ 10

Hello, this is my first post on biostars! Thank you in advance for any help.

I'm having trouble converting a RNA-seq gene count sparse matrix from .txt to MatrixMarket .mtx file. I'm working with the gene count sparse matrix from this dataset.

And wanted to load the matrix in R so that I can filter cells by barcode out of the dataset. The first line of the .txt file is:

%%MatrixMarket matrix coordinate integer general

So I figured I'd be able to use the readMM() function however doing this gave me the error message:

Error in readMM(file = "~/scratch/rtrujillo/RNA-seq/sci-seq/gene_count.txt") : file is not a MatrixMarket file

How can I load this file in R?

MatrixMarket RNA-seq sc-RNA-seq • 2.3k views
ADD COMMENT
2
Entering edit mode
2.6 years ago
ATpoint 82k

It works on my machine:

#/ download
wget -O - https://shendure-web.gs.washington.edu/content/members/cao1025/public/mouse_embryo_atlas/gene_count.txt | head > data.txt

#/ read in R:
library(Matrix)
Matrix::readMM("data.txt")
26183 x 2058652 sparse Matrix of class "dgTMatrix"
(...)
ADD COMMENT
0
Entering edit mode
2.6 years ago
rtrujillo123 ▴ 10

Weird, I removed gene_count.txt and ran the script successfully after redownloading it with wget. I had used curl before:

curl "https://shendure-web.gs.washington.edu/content/members/cao1025/public/mouse_embryo_atlas/gene_count.txt"

and never did anything after to manipulate the file. Is it possible the curl command altered gene_count.txt in some way wget didn't?

ADD COMMENT

Login before adding your answer.

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