Skip to content

Commit

Permalink
Merge pull request #123 from mojaveazure/release/4.1.4
Browse files Browse the repository at this point in the history
Release 4.1.4
  • Loading branch information
mojaveazure committed Sep 27, 2023
2 parents 3c9e3df + 8ca9ab5 commit 9788970
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 34 deletions.
9 changes: 4 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
Package: SeuratObject
Type: Package
Title: Data Structures for Single Cell Data
Version: 4.1.3
Date: 2022-11-07
Version: 4.1.4
Authors@R: c(
person(given = 'Rahul', family = 'Satija', email = '[email protected]', role = 'aut', comment = c(ORCID = '0000-0001-9448-8833')),
person(given = 'Andrew', family = 'Butler', email = '[email protected]', role = 'aut', comment = c(ORCID = '0000-0003-3608-0463')),
Expand All @@ -29,7 +28,7 @@ BugReports:
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.2.1
RoxygenNote: 7.2.3
Depends:
R (>= 4.0.0),
sp (>= 1.5.0)
Expand All @@ -38,7 +37,7 @@ Imports:
future.apply,
grDevices,
grid,
Matrix (>= 1.5.0),
Matrix (>= 1.6.1),
methods,
progressr,
Rcpp (>= 1.0.5),
Expand All @@ -48,7 +47,7 @@ Imports:
utils
Suggests:
ggplot2,
rgeos,
sf,
testthat
Collate:
'RcppExports.R'
Expand Down
8 changes: 7 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# SeuratObject 4.1.4
## Changes
- Fixes for `CellsByIdentities` (#80)
- Remove {rgeos} from Suggests and replace with {sf} due to {rgeos} package retirement
- New check for potential binary breaks between dependencies and SeuratObject

# SeuratObject 4.1.3
## Changes
- Move {rgeos} to Suggests; segmentation simplification now requires {regos} to be installed manually
- Move {rgeos} to Suggests; segmentation simplification now requires {rgeos} to be installed manually
- Move {sp} to Depends

## Added
Expand Down
1 change: 0 additions & 1 deletion R/generics.R
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,6 @@ SetIdent <- function(object, ...) {

#' Simplify Geometry
#'
#' @inheritParams rgeos::gSimplify
#' @param coords ...
#'
#' @return ...
Expand Down
2 changes: 1 addition & 1 deletion R/seurat.R
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ CellsByIdentities <- function(
USE.NAMES = TRUE
)
if (any(is.na(x = Idents(object = object)[cells]))) {
cells.idents["NA"] <- names(x = which(x = is.na(x = Idents(object = object)[cells])))
cells.idents[["NA"]] <- names(x = which(x = is.na(x = Idents(object = object)[cells])))
}
return(cells.idents)
}
Expand Down
48 changes: 28 additions & 20 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -708,35 +708,43 @@ S4ToList.list <- function(object) {
return(object)
}

#' Simplify segmentations by reducing the number of vertices
#'
#' @param coords A `Segmentation` object
#' @param tol Numerical tolerance value to be used by the Douglas-Peuker algorithm
#' @param topologyPreserve Logical determining if the algorithm should attempt to preserve the topology of the original geometry
#'
#' @return A `Segmentation` object with simplified segmentation vertices
#'
#' @rdname Simplify
#' @method Simplify Spatial
#' @export
#'
Simplify.Spatial <- function(coords, tol, topologyPreserve = TRUE) {
if (!PackageCheck('rgeos', error = FALSE)) {
stop("'Simplify' requires rgeos to be installed", call. = FALSE)
if (!PackageCheck("sf", error = FALSE)) {
stop("'Simplify' requires sf to be installed", call. = FALSE)
}
class.orig <- class(x = coords)
coords.orig <- coords
dest <- ifelse(
test = grepl(pattern = '^Spatial', x = class.orig),
test = grepl(pattern = "^Spatial", x = class.orig),
yes = class.orig,
no = grep(
pattern = '^Spatial',
x = .Contains(object = coords),
value = TRUE
)[1L]
)
coords <- rgeos::gSimplify(
spgeom = as(object = coords, Class = dest),
tol = as.numeric(x = tol),
topologyPreserve = isTRUE(x = topologyPreserve)
)
coords <- tryCatch(
expr = as(object = coords, Class = class.orig),
error = function(...) {
return(coords)
}
)
no = grep(pattern = "^Spatial", x = .Contains(object = coords), value = TRUE)[1L])
x <- sf::st_as_sfc(as(object = coords, Class = dest))
coords <- sf::st_simplify(
x = x,
dTolerance = as.numeric(x = tol),
preserveTopology = isTRUE(x = topologyPreserve))
coords <- sf::st_sf(geometry = coords)
coords <- as(coords, Class = "Spatial")
coords <- as(coords, Class = "Segmentation")
slot(object = coords, name = "polygons") <- mapply(
FUN = function(x, y) {
slot(object = x, name = "ID") <- y
return(x)
},
slot(object = coords, name = "polygons"),
Cells(coords.orig))
return(coords)
}

Expand Down
37 changes: 36 additions & 1 deletion R/zzz.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' @importFrom sp bbox over
#' @importFrom Rcpp evalCpp
#' @importFrom utils head tail
#' @importFrom utils head tail packageVersion
#' @importFrom methods new setClass setClassUnion setMethod setOldClass
#' setValidity slot slot<- validObject
#' @importClassesFrom Matrix dgCMatrix
Expand All @@ -24,6 +24,15 @@ Seurat.options <- list(
progressr.clear = FALSE
)

#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# Built With
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

.BuiltWith <- c(
R = format(x = getRversion()),
Matrix = format(x = packageVersion(pkg = "Matrix"))
)

#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# Reexports
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand Down Expand Up @@ -460,6 +469,32 @@ NameIndex <- function(x, names, MARGIN) {
# Hooks
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

.onAttach <- function(libname, pkgname) {
for (i in names(x = .BuiltWith)) {
current <- switch(EXPR = i, R = getRversion(), packageVersion(pkg = i))
if (current > .BuiltWith[i]) {
msg <- paste(
sQuote(x = pkgname),
"was built",
switch(
EXPR = i,
R = "under R",
paste("with package", sQuote(x = i))
),
.BuiltWith[i],
"but the current version is",
paste0(current, ';'),
"it is recomended that you reinstall ",
sQuote(x = pkgname),
" as the ABI for",
switch(EXPR = i, R = i, sQuote(x = i)),
"may have changed"
)
packageStartupMessage(paste(strwrap(x = msg), collapse = '\n'))
}
}
}

.onLoad <- function(libname, pkgname) {
toset <- setdiff(x = names(x = Seurat.options), y = names(x = options()))
if (length(x = toset)) {
Expand Down
8 changes: 4 additions & 4 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SeuratObject v4.1.3
# SeuratObject v4.1.4

## Test environments
* local ubuntu 20.04 install, R 4.2.0
* local ubuntu 22.04 install, R 4.2.3
* win-builder (oldrelease, release, devel)

## R CMD check results
Expand All @@ -12,6 +12,6 @@ There were no ERRORs, WARNINGs, or NOTEs

There is one package that depends on SeuratObject: tidyseurat; this update does not impact its functionality

There are six packages that import SeuratObject: bbknnR, CAMML, Platypus, scpoisson, Seurat, and Signac; this update does not impact their functionality
There are six packages that import SeuratObject: bbknnR, CAMML, scCustomize, scpoisson, Seurat, and Signac; this update does not impact their functionality

There are five packages that suggest SeuratObject: cellpypes, scOntoMatch, singleCellHaystack, SPECK, and VAM; this update does not impact their functionality
There are seven packages that suggest SeuratObject: cellpypes, RESET, scOntoMatch, SCpubr, singleCellHaystack, SPECK, and VAM; this update does not impact their functionality
6 changes: 5 additions & 1 deletion man/Simplify.Rd

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

0 comments on commit 9788970

Please sign in to comment.