Skip to content

Commit

Permalink
Merge pull request #8180 from samuel-marsh/dimplot_stroke
Browse files Browse the repository at this point in the history
Add stroke.size parameter DimPlot
  • Loading branch information
dcollins15 authored Dec 20, 2024
2 parents 2a70a24 + b814066 commit 0c2b035
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: Seurat
Version: 5.1.0.9014
Version: 5.1.0.9015
Title: Tools for Single Cell Genomics
Description: A toolkit for quality control, analysis, and exploration of single cell RNA sequencing data. 'Seurat' aims to enable users to identify and interpret sources of heterogeneity from single cell transcriptomic measurements, and to integrate diverse types of single cell data. See Satija R, Farrell J, Gennert D, et al (2015) <doi:10.1038/nbt.3192>, Macosko E, Basu A, Satija R, et al (2015) <doi:10.1016/j.cell.2015.05.002>, Stuart T, Butler A, et al (2019) <doi:10.1016/j.cell.2019.05.031>, and Hao, Hao, et al (2020) <doi:10.1101/2020.10.12.335331> for more details.
Authors@R: c(
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Unreleased

## Changes
- Added `stroke.size` parameter to `DimPlot` ([#8180](https://github.com/satijalab/seurat/pull/8180))
- Updated `RunLeiden` to use the `leidenbase` package instead of `leiden`; deprecated the `method` parameter for `RunLeiden` and `FindClusters`; updated `RunLeiden` to reset `random.seed` to 1 if the value is 0 or less ([#6792](https://github.com/satijalab/seurat/pull/6792))
- Updated `RunUMAP` to support `umap-learn` version >= 0.5.0 ([#9559](https://github.com/satijalab/seurat/pull/9559))
- Surfaced more fine-grained control over what parts of a Xenium experiment are loaded in `LoadXenium`
Expand Down
2 changes: 1 addition & 1 deletion R/preprocessing.R
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ LoadCurioSeeker <- function(data.dir, assay = "Spatial") {
#' @export
#' @concept preprocessing
#'
#' @references \url{https://www.biorxiv.org/content/10.1101/387241v1}
#' @references \url{https://doi.org/10.1038/s41592-019-0433-8}
#'
#' @examples
#' \dontrun{
Expand Down
12 changes: 11 additions & 1 deletion R/visualization.R
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,7 @@ ColorDimSplit <- function(
#' geom_label)
#' @param alpha Alpha value for plotting (default is 1)
#' @param repel Repel labels
#' @param stroke.size Adjust stroke (outline) size of points
#' @param cells.highlight A list of character or numeric vectors of cells to
#' highlight. If only one group of cells desired, can simply
#' pass a vector instead of a list. If set, colors selected cells to the color(s)
Expand Down Expand Up @@ -875,6 +876,7 @@ DimPlot <- function(
label.box = FALSE,
repel = FALSE,
alpha = 1,
stroke.size = NULL,
cells.highlight = NULL,
cols.highlight = '#DE2D26',
sizes.highlight = 1,
Expand Down Expand Up @@ -941,6 +943,7 @@ DimPlot <- function(
shape.by = shape.by,
order = order,
alpha = alpha,
stroke.size = stroke.size,
label = FALSE,
cells.highlight = cells.highlight,
cols.highlight = cols.highlight,
Expand Down Expand Up @@ -8182,6 +8185,7 @@ SingleCorPlot <- function(
#' allowing for both different colors and different shapes on cells.
#' @param alpha Alpha value for plotting (default is 1)
#' @param alpha.by Mapping variable for the point alpha value
#' @param stroke.size Adjust stroke (outline) size of points
#' @param order Specify the order of plotting for the idents. This can be
#' useful for crowded plots if points of interest are being buried. Provide
#' either a full list of valid idents or a subset to be plotted last (on top).
Expand Down Expand Up @@ -8224,6 +8228,7 @@ SingleDimPlot <- function(
shape.by = NULL,
alpha = 1,
alpha.by = NULL,
stroke.size = NULL,
order = NULL,
label = FALSE,
repel = FALSE,
Expand All @@ -8242,6 +8247,10 @@ SingleDimPlot <- function(
raster <- raster %||% (nrow(x = data) > 1e5)
pt.size <- pt.size %||% AutoPointSize(data = data, raster = raster)

if (is.null(x = stroke.size)) {
stroke.size <- 0.600075815011372
}

if (!is.null(x = cells.highlight) && pt.size != AutoPointSize(data = data, raster = raster) && sizes.highlight != pt.size && isTRUE(x = raster)) {
warning("When `raster = TRUE` highlighted and non-highlighted cells must be the same size. Plot will use the value provided to 'sizes.highlight'.")
}
Expand Down Expand Up @@ -8352,7 +8361,8 @@ SingleDimPlot <- function(
alpha = alpha.by
),
size = pt.size,
alpha = alpha
alpha = alpha,
stroke = stroke.size
)
}
plot <- plot +
Expand Down
1 change: 1 addition & 0 deletions man/ColorDimSplit.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/DimPlot.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/MULTIseqDemux.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/SingleDimPlot.Rd

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

0 comments on commit 0c2b035

Please sign in to comment.