Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
vertesy committed Jan 3, 2024
1 parent 0699f44 commit 6732e3c
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 12 deletions.
2 changes: 1 addition & 1 deletion R/Seurat.Utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ parallel.computing.by.future <- function(cores = 4, maxMemSize = 4000 * 1024^2)
#'
#' @export
IntersectGeneLsWithObject <- function(genes, obj = combined.obj, n_genes_shown = 10, strict = TRUE) {
message("IntersectGeneLsWithObject()")
message(">>> Running IntersectGeneLsWithObject(), formerly IntersectWithExpressed()")

stopifnot(
is.character(genes),
Expand Down
17 changes: 11 additions & 6 deletions R/Seurat.Utils.Visualization.R
Original file line number Diff line number Diff line change
Expand Up @@ -707,29 +707,34 @@ qFeatureScatter <- function(


# _________________________________________________________________________________________________
#' qSeuViolin
#' @title qSeuViolin
#'
#' This function creates a violin plot of a single feature in a Seurat object, split by a grouping variable.
#' @description This function creates a violin plot of a single feature in a Seurat object,
#' split by a grouping variable.
#' @param object A Seurat object.
#' @param suffix A string to append to the title of the plot.
#' @param features The name of the feature to plot.
#' @param hline hline
#' @param caption caption
#' @param split.by The grouping variable to split the plot by.
#' @param logY Whether to plot the y-axis on a log scale.
#'
#' @return A ggplot object.
#'
#' @export

qSeuViolin <- function(
object = ls.Seurat[[1]], suffix = GEX_library,
features = "nFeature_RNA", split.by = "orig.ident", logY = TRUE) {
# Create a violin plot of the feature, split by the grouping variable.
p <- VlnPlot(object = object, features = features, split.by = split.by) +
features = "nFeature_RNA", split.by = "orig.ident", logY = TRUE, hline = FALSE, caption = FALSE
, ...) {

p <- VlnPlot(object = object, features = features, split.by = split.by, ...) +
ggtitle(label = features, subtitle = paste(suffix, "by", split.by)) +
theme(axis.title.x = element_blank()) + labs(y = "Top UVI's depth")

# If `logY` is TRUE, plot the y-axis on a log scale.
if (logY) p <- p + ggplot2::scale_y_log10()
if (hline) p <- p + ggplot2::geom_hline(yintercept = hline)
if (!isFALSE(caption)) p <- p + ggplot2::labs(caption = caption)

# Save the plot.
title_ <- ppp(as.character(features), suffix, flag.nameiftrue(logY))
Expand Down
2 changes: 1 addition & 1 deletion man/AutoLabelTop.logFC.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/plot.clust.size.distr.Rd

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

12 changes: 10 additions & 2 deletions man/qSeuViolin.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/remove.residual.small.clusters.Rd

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

0 comments on commit 6732e3c

Please sign in to comment.