From 9296b607597950ee3a346bc7560ec40cb979ec38 Mon Sep 17 00:00:00 2001 From: bbimber Date: Tue, 30 Jan 2024 11:15:15 -0800 Subject: [PATCH] Update .HasNormalizationBeenPerformed for Assay5 inputs --- R/Phenotyping.R | 2 +- R/Utils.R | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/R/Phenotyping.R b/R/Phenotyping.R index 4e0523c..f60115a 100644 --- a/R/Phenotyping.R +++ b/R/Phenotyping.R @@ -91,7 +91,7 @@ PlotImmuneMarkers <- function(seuratObj, reductions = c('tsne', 'umap')) { PlotMarkerSeries(seuratObj, reductions = reductions, features = c('HAVCR2'), 'Th1') # ZBTB16 = PLZF - PlotMarkerSeries(seuratObj, reductions = reductions, features = c('KLRB1', 'NCR3', 'ZBTB16', 'RORC', 'SLC4A10', 'DPP4'), 'MAIT') + PlotMarkerSeries(seuratObj, reductions = reductions, features = c('KLRB1', 'CEPBD', 'NCR3', 'ZBTB16', 'RORC', 'SLC4A10', 'DPP4'), 'MAIT') # ZNF683 = HOBIT # LOC100423131 = XCL1, ENSMMUG00000013779, Lymphotactin diff --git a/R/Utils.R b/R/Utils.R index 3a9cc79..4a76b2c 100644 --- a/R/Utils.R +++ b/R/Utils.R @@ -92,11 +92,18 @@ SeuratToMatrix <- function(seuratObj, outDir, assayName, slot = 'counts'){ } .HasNormalizationBeenPerformed <- function(seuratObj, assayName = Seurat::DefaultAssay(seuratObj)){ - if (!assayName %in% names(seuratObj@assays)) { - stop(paste0('Assay not found: ', assayName)) - } + if (!assayName %in% names(seuratObj@assays)) { + stop(paste0('Assay not found: ', assayName)) + } + assayObj <- Seurat::GetAssay(seuratObj, assay = assayName) + if (class(assayObj)[1] == 'Assay') { return(!identical(Seurat::GetAssayData(seuratObj, assay = assayName, slot = 'counts'), Seurat::GetAssayData(seuratObj, assay = assayName, slot = 'data'))) + } else if (class(assayData)[1] == 'Assay5') { + return('data' %in% names(assayObj@layers)) + } else { + stop(paste0('Unknown assay class: ', class(assayData)[1])) + } } .FilterLowCalls <- function(seuratObj, label, minFraction, returnAsFactor = TRUE, labelToAssign = 'Unknown') {