Skip to content

Commit

Permalink
fix order of logic
Browse files Browse the repository at this point in the history
  • Loading branch information
sjspielman committed Oct 31, 2024
1 parent a0d3a3a commit c2eda32
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions analyses/cell-type-wilms-tumor-06/scripts/06_infercnv.R
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,17 @@ stopifnot("Incorrect reference provided" = opts$reference %in% c("none", "immune


if (opts$reference %in% c("both", "endothelium", "immune")) {
# the total count of normal cells needs to be greater than 1
total_normal <- sum(srat@meta.data$fetal_kidney_predicted.compartment %in% normal_cells)
stopifnot("There must be more than 1 normal cell to use a reference." = length(normal_cells) > 1)

if (opts$reference == "both") {
normal_cells <- c("endothelium", "immune")

# keep only the labels actually present in the annotations to avoid infercnv error
normal_cells <- normal_cells[normal_cells %in% unique(srat@meta.data$fetal_kidney_predicted.compartment)]
} else {
normal_cells <- opts$reference
}
# the total count of normal cells needs to be greater than 1
total_normal <- sum(srat@meta.data$fetal_kidney_predicted.compartment %in% normal_cells)
stopifnot("There must be more than 1 normal cell to use a reference." = length(normal_cells) > 1)
} else if (opts$reference == "none") {
normal_cells <- NULL
} else if (opts$reference == "pull") {
Expand Down

0 comments on commit c2eda32

Please sign in to comment.