Entering edit mode
23 months ago
cdeantoneo31
▴
20
I am trying to analyze the data from a paper, and was presented with an mtx file, barcode.tsv, and genes.tsv. i can successfully add these into R as a seurat object, but instead of doing clustering myself I would like to use a txt file that was uploaded along with these other files, which seems to include their clustering and the coordinates for a umap
the txt is below
cluster CellType condition HashAssignment UMAP_1 UMAP_2
AAACCCAAGAGCAAGA-1_1 3 Fibroblast WT B0308 -1.40413515808334 4.42566178583769
AAACCCACATCTGCGG-1_1 1 Immune WT B0308 3.24737412688981 -8.88317419743868
AAACCCATCGATGCAT-1_1 0 Fibroblast WT B0309 -2.68064873459091 3.80931518816618
AAACGAACAACTCCAA-1_1 3 Fibroblast WT B0310 2.87252790687333 5.71203921579984
AAACGAACAGCTGGTC-1_1 5 Fibroblast WT B0306 -4.88596980812301 3.06808994555143
AAACGAATCAGCGGAA-1_1 0 Fibroblast WT B0307 -3.71260421516647 8.08994601511625
AAACGAATCCTGGGAC-1_1 0 Fibroblast WT B0307 -3.86652391197433 7.87874720835355
However, I cannot figure out how to do this. It seems like the best way would be to add the information to the mtx meta. Am I on the right track, and if so how would I go about doing this?
The only thing I can think of is to add the cluster
You can use
obj@meta.data
to reference the metadata data frame directly, soobj@meta.data$myclust <- read.csv('myclust.csv')$cluster
may do the trick -- so long as the file has exactly the same number of cells in exactly the same order as the barcode.tsv file.