Entering edit mode
2.5 years ago
Emily
▴
70
Trying to load the files and view the matrix as data table. This is what I have tried:
library(Matrix)
matrix_dir = "/Users/csb/Indexing/Exploratory data/data set/PIG/scRNA data/PBMC7_AllCells"
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
But in stead i get this this error message:
Error in open.connection(file) : cannot open the connection
In addition: Warning message:
In open.connection(file) :
cannot open file '/Users/csb/Indexing/Exploratory data/data set/PIG/scRNA data/PBMC7_AllCellsmatrix.mtx.gz': No such file or directory
Not sure where it went wrong, keeps failing when it tries to run at "mat <- readMM(file = matrix.path)"
Please do not use spaces in directory/file names. If you replace the space with an
_
this will work.You could try escaping the spaces as
/Users/csb/Indexing/Exploratory\ data/data\ set/PIG/scRNA\ data/PBMC7_AllCellsmatrix.mtx.gz
but above option will be better.you have a problem from these lines:
Your directory path doesn't end with "/". When you do
paste0
with directory and files, you will have an error like that (PBMC7_AllCellsmatrix.mtx.gz
). Either you append/
at the end of directory path or supply/
in paste0 (/features.tsv.gz
).Btw, as GenoMax mentioned, do not use spaces or reserved characters in file paths and names.