From b61a726045367f38cb7c92a8ea5920a9fdb97f11 Mon Sep 17 00:00:00 2001 From: bbimber Date: Fri, 31 Jan 2025 14:23:52 -0800 Subject: [PATCH] Improve default nimble append --- R/NimbleAPI.R | 2 ++ R/NimbleAppend.R | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/R/NimbleAPI.R b/R/NimbleAPI.R index a6e0037..6468c28 100644 --- a/R/NimbleAPI.R +++ b/R/NimbleAPI.R @@ -460,6 +460,8 @@ PerformDefaultNimbleAppend <- function(seuratObj, isotypeFilterThreshold = 0.1, } .GroupMhcData <- function(seuratObj, targetAssay, sourceAssay = 'MHC', prefix = 'Mamu-', assayForLibrarySize = 'RNA') { + seuratObj <- .AssignLocusToMhcFeatures(seuratObj, sourceAssayName = sourceAssay) + ad <- Seurat::GetAssay(seuratObj, assay = sourceAssay) groupedMHC <- .RegroupCountMatrix(Seurat::GetAssayData(seuratObj, assay = sourceAssay, layer = 'counts'), featureTransform = function(x){ return(ad@meta.features$locus[rownames(ad) == x]) diff --git a/R/NimbleAppend.R b/R/NimbleAppend.R index 9365d45..0e4c7a9 100644 --- a/R/NimbleAppend.R +++ b/R/NimbleAppend.R @@ -111,7 +111,7 @@ AppendNimbleCounts <- function(seuratObject, nimbleFile, targetAssayName, maxAmb x <- sort(table(x), decreasing = T) x <- data.frame(Feature = names(x), Total = as.numeric(unname(x))) - x$Fraction <- x$Total / totalUMI + x$Total <- paste0(x$Total, ' (', scales::percent(x$Total / totalUMI, accuracy = 0.001), ')') print(x) df <- df[!ambigFeatRows, , drop = F]