Skip to content

Commit

Permalink
Update .HasNormalizationBeenPerformed for Assay5 inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
bbimber committed Jan 30, 2024
1 parent 67687f0 commit 9296b60
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion R/Phenotyping.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 10 additions & 3 deletions R/Utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down

0 comments on commit 9296b60

Please sign in to comment.