Skip to content

Commit

Permalink
Merge pull request drieslab#929 from drieslab/suite_dev
Browse files Browse the repository at this point in the history
v4.0.5
  • Loading branch information
jiajic authored Mar 12, 2024
2 parents 7c6471c + 67a4d08 commit af27e62
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 15 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: Giotto
Title: Spatial Single-Cell Transcriptomics Toolbox
Version: 4.0.4
Version: 4.0.5
Authors@R: c(
person("Ruben", "Dries", email = "rubendries@gmail.com",
role = c("aut", "cre")),
Expand Down
9 changes: 8 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Giotto 4.0.5 (2024/03/12)

# Giotto 4.0.4
## Bug fixes
* Fix Error "cannot coerce class ‘structure("spatLocsObj", package = "Giotto")’ to a data.frame" in `spatialDE()`

## Enhancements
* `readPolygonVizgenParquet()` now has `calc_centroids = TRUE` by default

# Giotto 4.0.4 (2024/02/28)

## Breaking changes
* Remove `do_manual_adj` and image adjustment params from `createGiottoVisiumObject()`
Expand Down
17 changes: 13 additions & 4 deletions R/general_help.R
Original file line number Diff line number Diff line change
Expand Up @@ -1149,12 +1149,15 @@ readPolygonFilesVizgenHDF5 = function(boundaries_path,
#' can be selected.
#' @param file parquet file to load
#' @param z_index either 'all' or a numeric vector of z_indices to get polygons for
#' @param calc_centroids calculate centroids for the polygons (default = TRUE)
#' @param verbose be verbose
#' @keywords internal
#' @export
readPolygonVizgenParquet = function(file,
z_index = 'all',
verbose = TRUE) {
readPolygonVizgenParquet = function(
file,
z_index = 'all',
calc_centroids = TRUE,
verbose = TRUE
) {

# package checks
package_check('arrow')
Expand Down Expand Up @@ -1223,6 +1226,12 @@ readPolygonVizgenParquet = function(file,
spatVector = sv,
unique_ID_cache = poly_table$EntityID
)

if(isTRUE(calc_centroids)) {
# NOTE: will not recalculate if centroids are already attached
gpoly = GiottoClass::centroids(x = gpoly, append_gpolygon = TRUE)
}

})

return(out)
Expand Down
19 changes: 12 additions & 7 deletions R/spatial_genes.R
Original file line number Diff line number Diff line change
Expand Up @@ -2026,10 +2026,11 @@ spatialDE <- function(gobject = NULL,

# expression
values = match.arg(expression_values, c('raw', 'normalized', 'scaled', 'custom'))
expr_values = get_expression_values(gobject = gobject,
spat_unit = spat_unit,
feat_type = feat_type,
values = values)
expr_values = getExpression(gobject = gobject,
spat_unit = spat_unit,
feat_type = feat_type,
values = values,
output = "matrix")

## python path
if(is.null(python_path)) {
Expand All @@ -2042,9 +2043,10 @@ spatialDE <- function(gobject = NULL,
reticulate::source_python(file = reader_path)

## get spatial locations
spatial_locs = get_spatial_locations(gobject,
spat_unit = spat_unit,
spat_loc_name = spat_loc_name)
spatial_locs = getSpatialLocations(gobject,
spat_unit = spat_unit,
name = spat_loc_name,
output = "data.table")
spatial_locs <- as.data.frame(spatial_locs)
rownames(spatial_locs) <- spatial_locs$cell_ID
spatial_locs <- subset(spatial_locs, select = -cell_ID)
Expand Down Expand Up @@ -3810,6 +3812,9 @@ heatmSpatialCorFeats = function(gobject,
stop('\n spatCorObject needs to be the output from detectSpatialCorFeats() \n')
}

## package check for ComplexHeatmap
package_check(pkg_name = 'ComplexHeatmap', repository = 'CRAN')

## create correlation matrix
cor_DT = spatCorObject[['cor_DT']]
cor_DT_dc = data.table::dcast.data.table(cor_DT, formula = feat_ID~variable, value.var = 'spat_cor')
Expand Down
10 changes: 8 additions & 2 deletions man/readPolygonVizgenParquet.Rd

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

0 comments on commit af27e62

Please # to comment.