Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove legacy RIRA columns #121

Merged
merged 1 commit into from
Aug 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions R/CellTypist.R
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ TrainCellTypist <- function(seuratObj, labelField, modelFile, minCellsPerClass =
#'
#' @export
Classify_TNK <- function(seuratObj, assayName = Seurat::DefaultAssay(seuratObj), columnPrefix = 'RIRA_TNK_v2.', maxAllowableClasses = 6, minFractionToInclude = 0.01, minCellsToRun = 200, maxBatchSize = 600000, retainProbabilityMatrix = FALSE) {
return(RunCellTypist(seuratObj = seuratObj,
seuratObj <- RunCellTypist(seuratObj = seuratObj,
modelName = "RIRA_TNK_v2",
# These are optimized for this model:
pThreshold = 0.5, minProp = 0, useMajorityVoting = FALSE, mode = "prob_match",
Expand All @@ -448,7 +448,14 @@ Classify_TNK <- function(seuratObj, assayName = Seurat::DefaultAssay(seuratObj),
minCellsToRun = minCellsToRun,
maxBatchSize = maxBatchSize,
retainProbabilityMatrix = retainProbabilityMatrix
))
)

# Limit the resulting calls to just RIRA T/NK cells:
if ('RIRA_Immune_v2.majority_voting' %in% names([email protected])) {
seuratObj$RIRA_TNK_v2.cellclass[seuratObj$RIRA_Immune_v2.majority_voting != 'T_NK'] <- 'Other'
}

return(seuratObj)
}


Expand Down Expand Up @@ -510,6 +517,14 @@ Classify_Myeloid <- function(seuratObj, assayName = Seurat::DefaultAssay(seuratO
#'
#' @export
Classify_ImmuneCells <- function(seuratObj, assayName = Seurat::DefaultAssay(seuratObj), columnPrefix = 'RIRA_Immune_v2.', maxAllowableClasses = 6, minFractionToInclude = 0.01, minCellsToRun = 200, maxBatchSize = 600000, retainProbabilityMatrix = FALSE, filterDisallowedClasses = TRUE) {
if ('RIRA_Immune_v1.cellclass' %in% names([email protected])) {
print('Dropping legacy RIRA_Immune_v1 columns')
toDrop <- grep(names([email protected]), pattern = 'RIRA_Immune_v1', value = TRUE)
for (fn in toDrop) {
seuratObj[[fn]] <- NULL
}
}

seuratObj <- RunCellTypist(seuratObj = seuratObj,
modelName = 'RIRA_Immune_v2',

Expand Down