Entering edit mode
9 months ago
mnx0723
•
0
I want to make Seurat Object because I need gene expression matrix. My data form is cell.tsv, feature.tsv and .mtx
This is my code and error.
barcodes <- read.table("4861STDY7387182_cells.tsv", header = TRUE, sep = "\t")[,1]
feature <- read.table("4861STDY7387182_features.tsv",header = FALSE)
matrix <- Matrix::readMM("4861STDY7387182.mtx")
seurat_obj <- CreateSeuratObject(counts = matrix, meta.data = data.frame(Barcode = barcodes), features = feature)
Error: Not enough features for the counts matrices provided
And this is my data structure
> head(barcodes)
[1] "4861STDY7387182_AAACCTGAGCCAGTAG" "4861STDY7387182_AAACCTGAGCGATAGC" "4861STDY7387182_AAACCTGAGGGTGTTG" "4861STDY7387182_AAACCTGCACACTGCG" "4861STDY7387182_AAACCTGCAGGTCCAC" "4861STDY7387182_AAACCTGCATACAGCT"
> head(feature)
V1
1 RP11-34P13.3
2 FAM138A
3 RP11-34P13.7
4 RP11-34P13.8
5 RP11-34P13.9
6 FO538757.2
> str(feature)
'data.frame': 28614 obs. of 1 variable:
$ V1: chr "RP11-34P13.3" "FAM138A" "RP11-34P13.7" "RP11-34P13.8" ...
> str(matrix)
Formal class 'dgTMatrix' [package "Matrix"] with 6 slots
..@ i : int [1:18607530] 22 27 28 33 40 41 49 55 56 72 ...
..@ j : int [1:18607530] 0 0 0 0 0 0 0 0 0 0 ...
..@ Dim : int [1:2] 28614 6356
..@ Dimnames:List of 2
.. ..$ : NULL
.. ..$ : NULL
..@ x : num [1:18607530] 1 1 3 1 5 1 1 1 1 1 ...
..@ factors : list()
I think each data have same row, how can I solve this matter? I tried it for a few days.
Oh, Thank you!! It helps me