I am analyzing some single-cell data and I have the output of the GSE131907 (normalized log2TPM_matrix). I am trying to retrieve the samples ID stored in the .csv file and I want to add them to the Seurat object to be able to use group.by parameter downstream but I keep having problems with that.
GSE131907.genes<- readRDS("Raw/GSE131907_Lung_Cancer_normalized_log2TPM_matrix.rds/GSE131907_Lung_Cancer_normalized_log2TPM_matrix.rds")
dim(GSE131907.genes)
head(GSE131907.genes)
head(x = rownames(x = GSE131907.genes))
head(x = colnames(x = GSE131907.genes))
GSE131907.seurat <- Seurat::CreateSeuratObject(counts = GSE131907.genes, min.cells = 10, min.features = 200)
# add metadata
sample_metadata <- read.csv(file = "cellinfor.csv")
rownames(sample_metadata) <- sample_metadata$UniqueCell_ID
cell_metadata <- sample_metadata[GSE131907.seurat $orig.ident,]
for(meta in names(cell_metadata)){
cur_seurat[[meta]] <- cell_metadata[[meta]]
However, if I try to use the table(GSE131907.seurat@meta.data$patientid) doesn't seem to be added to the metadata. I would appreciate any suggestion! Thanks!
basically, I would like to add columname such as (Patient id,Samples, Tissue origins, Histology, Smoking, Pathology, EGFR, Stages) from the cell info file to match the cellID) Manually adding so hassle
Have you looked at the
meta.data
argument ? https://www.rdocumentation.org/packages/Seurat/versions/3.0.1/topics/CreateSeuratObject