Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
vertesy committed Oct 29, 2024
1 parent a1c8ff1 commit 34e005d
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 20 deletions.
16 changes: 8 additions & 8 deletions R/Seurat.Utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ AreTheseCellNamesTheSame <- function(
names = c("Cells in Targ.Ampl", "Cells in GEX"),
min.overlap = 0.33) {
Cellname.Overlap <- list(vec1, vec2)
names(Cellname.Overlap) <- if (!isFALSE(names)) names else c(substitute(vec1), substitute(vec2))
names(Cellname.Overlap) <- if (!isFALSE(names)) names else c(substitute_deparse(vec1), substitute_deparse(vec2))

cells.in.both <- intersect(vec1, vec2)
sbb <- percentage_formatter(length(cells.in.both) / length(vec2), suffix = "of cells (GEX) in have a UVI assigned")
Expand Down Expand Up @@ -865,9 +865,9 @@ AreTheseCellNamesTheSame <- function(
#' @export
addToMiscOrToolsSlot <- function(obj, pocket_name = "misc",
slot_value = NULL,
slot_name = deparse(substitute(slot_value)),
slot_name = substitute_deparse(slot_value),
sub_slot_value = NULL,
sub_slot_name = deparse(substitute(sub_slot_value)),
sub_slot_name = substitute_deparse(sub_slot_value),
overwrite = FALSE) {
message("Running addToMiscOrToolsSlot()...")

Expand Down Expand Up @@ -965,7 +965,7 @@ showMiscSlots <- function(obj = combined.obj, max.level = 1, subslot = NULL,

# Path to slot
msg <- paste0(substitute(obj), "@misc")
if (!is.null(subslot)) msg <- paste0(msg, "$", substitute(subslot))
if (!is.null(subslot)) msg <- paste0(msg, "$", substitute_deparse(subslot))
message(msg)
}

Expand Down Expand Up @@ -1015,7 +1015,7 @@ calc.q99.Expression.and.set.all.genes <- function(
assay = c("RNA", "integrated", "SCT")[1],
set.misc = TRUE,
assign_to_global_env = TRUE,
suffix = as.character(substitute(obj)),
suffix = substitute(obj),
plot = TRUE,
show = TRUE,
obj.version = obj@version
Expand Down Expand Up @@ -2127,7 +2127,7 @@ downsampleSeuObj.and.Save <- function(
obj_Xpc <- downsampleSeuObj(obj = obj, fractionCells = fraction, seed = seed)
nr.cells.kept <- ncol(obj_Xpc)

# Seurat.utils:::.saveRDS.compress.in.BG(obj = obj_Xpc, fname = ppp(paste0(dir, substitute(obj)),
# Seurat.utils:::.saveRDS.compress.in.BG(obj = obj_Xpc, fname = ppp(paste0(dir, substitute_deparse(obj),
# suffix, nr.cells.kept, 'cells.with.min.features', min.features,"Rds" ) )
xsave(obj_Xpc,
suffix = ppp(suffix, nr.cells.kept, "cells.with.min.features", min.features),
Expand Down Expand Up @@ -5508,8 +5508,8 @@ compareVarFeaturesAndRanks <- function(
stopifnot(!is.null(obj1), !is.null(obj2))
stopifnot(is(obj1, "Seurat"), is(obj2, "Seurat"))

name1 <- deparse(substitute(obj1))
name2 <- deparse(substitute(obj2))
name1 <- substitute_deparse(obj1)
name2 <- substitute_deparse(obj2)

var.genes1 <- Seurat::VariableFeatures(obj1)
var.genes2 <- Seurat::VariableFeatures(obj2)
Expand Down
12 changes: 6 additions & 6 deletions R/Seurat.Utils.Visualization.R
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ PctCellsAboveX <- function(obj = combined.obj,
feature = "TOP2A",
ident = GetNamedClusteringRuns(obj = obj, v = FALSE)[1],
threshold = 2,
suffix = ppp(substitute(obj), ncol(obj), "thr", threshold),
suffix = ppp(substitute_deparse(obj), ncol(obj), "thr", threshold),
box = FALSE,
ident.box = NULL,
subset_ident = NULL,
Expand Down Expand Up @@ -1311,7 +1311,7 @@ scBarplot.FractionAboveThr <- function(
subtitle = subtitle,
caption = paste(
"Overall average (black line):", iround(total_average), "% |",
substitute(obj)
substitute_deparse(obj),
),
xlab.angle = 45,
xlab = "Clusters",
Expand Down Expand Up @@ -2519,7 +2519,7 @@ multiFeaturePlot.A4 <- function(
list.of.genes,
obj = combined.obj,
subdir = TRUE,
foldername = substitute(list.of.genes),
foldername = substitute_deparse(list.of.genes),
subtitle.from.names = TRUE,
plot.reduction = "umap",
intersectionAssay = c("RNA", "integrated")[1],
Expand Down Expand Up @@ -2602,7 +2602,7 @@ multiFeaturePlot.A4 <- function(
if (subdir) MarkdownReports::create_set_OutDir(ParentDir, verbose = FALSE)
if (saveGeneList) {
if (is.null(obj@misc$gene.lists)) obj@misc$gene.lists <- list()
obj@misc$gene.lists[[substitute(list.of.genes)]] <- list.of.genes.found
obj@misc$gene.lists[[substitute_deparse(list.of.genes)]] <- list.of.genes.found
print("Genes saved under: obj@misc$gene.lists")
return(obj)
}
Expand Down Expand Up @@ -2915,7 +2915,7 @@ plotQUMAPsInAFolder <- function(genes, obj = combined.obj,
)

ParentDir <- OutDir
if (is.null(foldername)) foldername <- deparse(substitute(genes))
if (is.null(foldername)) foldername <- substitute_deparse(genes)

MarkdownReports::create_set_SubDir(paste0(foldername, "-", plot.reduction), "/")

Expand Down Expand Up @@ -4599,7 +4599,7 @@ suPlotVariableFeatures <- function(obj = combined.obj, NrVarGenes = 15,
is.numeric(plotWidth), is.numeric(plotHeight)
)

obj.name <- deparse(substitute(obj))
obj.name <- substitute_deparse(obj)

plot1 <- Seurat::VariableFeaturePlot(obj, assay = assay, ...) +
theme(panel.background = element_rect(fill = "white")) +
Expand Down
2 changes: 1 addition & 1 deletion man/PctCellsAboveX.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/PlotTopGenes.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/addToMiscOrToolsSlot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/addTranslatedMetadata.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/calc.q99.Expression.and.set.all.genes.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/multiFeaturePlot.A4.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 34e005d

Please sign in to comment.