From f2c7004aa1abf43759a07e0d35c18693d99457dc Mon Sep 17 00:00:00 2001 From: KevinBastianYang Date: Wed, 8 Nov 2023 22:26:54 -0500 Subject: [PATCH] systemToCell metadata fix: add prefix --- R/RunCellToSystem.R | 7 ++++++- R/RunSystemToCell.R | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/R/RunCellToSystem.R b/R/RunCellToSystem.R index 9e5d273..e5f1e04 100644 --- a/R/RunCellToSystem.R +++ b/R/RunCellToSystem.R @@ -87,7 +87,12 @@ RunCellToSystem <- function(sys.small, meta.data.to.add <- data.frame(as.character(colnames(lig.map))) rownames(meta.data.to.add) <- paste(colnames(lig.map),"System",sep = '—') demo <- Seurat::AddMetaData(demo,metadata = meta.data.to.add,col.name = 'SendingCell') - demo <- Seurat::AddMetaData(demo,metadata = Seurat::Idents(sys.small),col.name = 'SendingType') + + # bug fix: add the system - prefix + sending_type.meta <- data.frame(Seurat::Idents(sys.small)) + rownames(sending_type.meta) <- paste(rownames(sending_type.meta),"System",sep = '—') + + demo <- Seurat::AddMetaData(demo,metadata = sending_type.meta,col.name = 'SendingType') # Gather and assemble additional metadata if (!is.null(meta.data.to.map)){ diff --git a/R/RunSystemToCell.R b/R/RunSystemToCell.R index bdd1dab..6b08145 100644 --- a/R/RunSystemToCell.R +++ b/R/RunSystemToCell.R @@ -85,7 +85,12 @@ RunSystemToCell <- function(sys.small, meta.data.to.add <- data.frame(as.character(colnames(rec.map))) rownames(meta.data.to.add) <- paste("System",colnames(rec.map),sep = '—') demo <- Seurat::AddMetaData(demo,metadata = meta.data.to.add,col.name = 'ReceivingCell') - demo <- Seurat::AddMetaData(demo,metadata = Seurat::Idents(sys.small),col.name = 'ReceivingType') + + # bug fix: add the system - prefix + receiving_type.meta <- data.frame(Seurat::Idents(sys.small)) + rownames(receiving_type.meta) <- paste("System",rownames(receiving_type.meta),sep = '—') + + demo <- Seurat::AddMetaData(demo,metadata = receiving_type.meta,col.name = 'ReceivingType') # Gather and assemble additional metadata if (!is.null(meta.data.to.map)){