Skip to content

Commit

Permalink
Merge pull request #952 from drieslab/suite_dev
Browse files Browse the repository at this point in the history
v4.0.6
  • Loading branch information
jiajic authored May 13, 2024
2 parents af27e62 + 14faf9c commit 621cde5
Show file tree
Hide file tree
Showing 74 changed files with 947 additions and 358 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/main_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ on:
branches:
- 'suite'
- 'suite_dev'
# pull_request:
# branches:
# - 'suite'
# - 'suite_dev'

permissions:
contents: read
Expand Down
7 changes: 4 additions & 3 deletions 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.5
Version: 4.0.6
Authors@R: c(
person("Ruben", "Dries", email = "[email protected]",
role = c("aut", "cre")),
Expand Down Expand Up @@ -32,7 +32,7 @@ Depends:
utils (>= 3.5.0),
R (>= 3.5.0),
methods,
GiottoClass (>= 0.2.0)
GiottoClass (>= 0.3.0)
Imports:
BiocParallel,
BiocSingular,
Expand All @@ -43,7 +43,7 @@ Imports:
ggplot2 (>= 3.1.1),
ggrepel,
GiottoUtils (>= 0.1.6),
GiottoVisuals (>= 0.1.1),
GiottoVisuals (>= 0.2.0),
igraph (>= 1.2.4.1),
jsonlite,
limma,
Expand Down Expand Up @@ -148,6 +148,7 @@ Collate:
'suite_reexports.R'
'image_registration.R'
'interactivity.R'
'kriging.R'
'package_imports.R'
'poly_influence.R'
'python_hmrf.R'
Expand Down
9 changes: 8 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ export(detectSpatialPatterns)
export(dimCellPlot)
export(dimCellPlot2D)
export(dimFeatPlot2D)
export(dimFeatPlot3D)
export(dimGenePlot3D)
export(dimPlot)
export(dimPlot2D)
Expand Down Expand Up @@ -429,12 +430,14 @@ export(spatDeconvPlot)
export(spatDimCellPlot)
export(spatDimCellPlot2D)
export(spatDimFeatPlot2D)
export(spatDimFeatPlot3D)
export(spatDimGenePlot3D)
export(spatDimPlot)
export(spatDimPlot2D)
export(spatDimPlot3D)
export(spatFeatPlot2D)
export(spatFeatPlot2D_single)
export(spatFeatPlot3D)
export(spatGenePlot3D)
export(spatIDs)
export(spatInSituPlotDensity)
Expand Down Expand Up @@ -484,12 +487,13 @@ export(violinPlot)
export(wrap)
export(writeGiottoLargeImage)
export(writeHMRFresults)
exportMethods(interpolateFeature)
import(GiottoClass)
import(GiottoUtils)
import(GiottoVisuals)
import(ggplot2)
import(methods)
import(stats)
import(stats, except = density)
import(utils)
importClassesFrom(data.table,data.table)
importFrom(GiottoClass,"activeFeatType<-")
Expand Down Expand Up @@ -716,6 +720,7 @@ importFrom(GiottoVisuals,addGiottoImageToSpatPlot)
importFrom(GiottoVisuals,dimCellPlot)
importFrom(GiottoVisuals,dimCellPlot2D)
importFrom(GiottoVisuals,dimFeatPlot2D)
importFrom(GiottoVisuals,dimFeatPlot3D)
importFrom(GiottoVisuals,dimGenePlot3D)
importFrom(GiottoVisuals,dimPlot)
importFrom(GiottoVisuals,dimPlot2D)
Expand Down Expand Up @@ -750,12 +755,14 @@ importFrom(GiottoVisuals,spatDeconvPlot)
importFrom(GiottoVisuals,spatDimCellPlot)
importFrom(GiottoVisuals,spatDimCellPlot2D)
importFrom(GiottoVisuals,spatDimFeatPlot2D)
importFrom(GiottoVisuals,spatDimFeatPlot3D)
importFrom(GiottoVisuals,spatDimGenePlot3D)
importFrom(GiottoVisuals,spatDimPlot)
importFrom(GiottoVisuals,spatDimPlot2D)
importFrom(GiottoVisuals,spatDimPlot3D)
importFrom(GiottoVisuals,spatFeatPlot2D)
importFrom(GiottoVisuals,spatFeatPlot2D_single)
importFrom(GiottoVisuals,spatFeatPlot3D)
importFrom(GiottoVisuals,spatGenePlot3D)
importFrom(GiottoVisuals,spatInSituPlotDensity)
importFrom(GiottoVisuals,spatInSituPlotHex)
Expand Down
10 changes: 10 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@

# Giotto 4.0.6 (2024/05/13)

## Enhancements
* New `interpolateFeature()` for kriging interpolation of values





# Giotto 4.0.5 (2024/03/12)

## Bug fixes
Expand Down
84 changes: 51 additions & 33 deletions R/auxiliary_giotto.R
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ filterDistributions <- function(gobject,
fill_color = 'lightblue',
scale_axis = 'identity',
axis_offset = 0,
show_plot = NA,
return_plot = NA,
save_plot = NA,
show_plot = NULL,
return_plot = NULL,
save_plot = NULL,
save_param = list(),
default_save_name = 'filterDistributions') {

Expand Down Expand Up @@ -281,7 +281,7 @@ filterCombinations <- function(gobject,
y_axis_offset = 0,
show_plot = TRUE,
return_plot = FALSE,
save_plot = NA,
save_plot = NULL,
save_param = list(),
default_save_name = 'filterCombinations') {

Expand Down Expand Up @@ -526,18 +526,22 @@ filterGiotto = function(gobject,

# update cell metadata
if(isTRUE(tag_cells)) {
cell_meta = get_cell_metadata(gobject = gobject, copy_obj = TRUE)
cell_meta = getCellMetadata(gobject = gobject, copy_obj = TRUE)
cell_meta[][, c(tag_cell_name) := ifelse(cell_ID %in% selected_cell_ids, 0, 1)]
gobject = set_cell_metadata(gobject = gobject, metadata = cell_meta)
gobject = setCellMetadata(
gobject = gobject, x = cell_meta, initialize = FALSE
)

# set selected cells back to all cells
selected_cell_ids = names(filter_index_cells)
}

if(isTRUE(tag_feats)) {
feat_meta = get_feature_metadata(gobject = gobject, copy_obj = TRUE)
feat_meta = getFeatureMetadata(gobject = gobject, copy_obj = TRUE)
feat_meta[][, c(tag_feats_name) := ifelse(feat_ID %in% selected_feat_ids, 0, 1)]
gobject = set_feature_metadata(gobject = gobject, metadata = feat_meta)
gobject = setFeatureMetadata(
gobject = gobject, x = feat_meta, initialize = FALSE
)

# set selected feats back to all feats
selected_feat_ids = names(filter_index_feats)
Expand Down Expand Up @@ -1053,11 +1057,13 @@ adjustGiottoMatrix <- function(gobject,
feat_type = feat_type)

# metadata
cell_metadata = get_cell_metadata(gobject,
feat_type = feat_type,
spat_unit = spat_unit,
output = 'data.table',
copy_obj = TRUE)
cell_metadata = getCellMetadata(
gobject,
feat_type = feat_type,
spat_unit = spat_unit,
output = 'data.table',
copy_obj = TRUE
)

if(!is.null(batch_columns)) {
if(!all(batch_columns %in% colnames(cell_metadata))) {
Expand Down Expand Up @@ -1254,11 +1260,14 @@ addFeatStatistics <- function(gobject,

# expression values to be used
expression_values = match.arg(expression_values, unique(c('normalized', 'scaled', 'custom', expression_values)))
expr_data = get_expression_values(gobject = gobject,
spat_unit = spat_unit,
feat_type = feat_type,
values = expression_values,
output = 'exprObj')
expr_data <- getExpression(
gobject = gobject,
spat_unit = spat_unit,
feat_type = feat_type,
values = expression_values,
output = 'exprObj',
set_defaults = FALSE
)

# calculate stats
feat_stats = data.table::data.table(feats = rownames(expr_data[]),
Expand All @@ -1277,11 +1286,14 @@ addFeatStatistics <- function(gobject,
if(return_gobject == TRUE) {

# remove previous statistics
feat_metadata = get_feature_metadata(gobject,
spat_unit = spat_unit,
feat_type = feat_type,
output = 'featMetaObj',
copy_obj = TRUE)
feat_metadata <- getFeatureMetadata(
gobject,
spat_unit = spat_unit,
feat_type = feat_type,
output = 'featMetaObj',
copy_obj = TRUE,
set_defaults = FALSE
)

if(isS4(expr_data)) {
if(!identical(expr_data@provenance, feat_metadata@provenance)) {
Expand Down Expand Up @@ -1384,11 +1396,14 @@ addCellStatistics <- function(gobject,

# expression values to be used
expression_values = match.arg(expression_values, unique(c('normalized', 'scaled', 'custom', expression_values)))
expr_data = get_expression_values(gobject = gobject,
spat_unit = spat_unit,
feat_type = feat_type,
values = expression_values,
output = 'exprObj')
expr_data <- getExpression(
gobject = gobject,
spat_unit = spat_unit,
feat_type = feat_type,
values = expression_values,
output = 'exprObj',
set_defaults = FALSE
)

# calculate stats

Expand All @@ -1400,11 +1415,14 @@ addCellStatistics <- function(gobject,
if(return_gobject == TRUE) {

# remove previous statistics
cell_metadata = get_cell_metadata(gobject,
spat_unit = spat_unit,
feat_type = feat_type,
output = 'cellMetaObj',
copy_obj = TRUE)
cell_metadata = getCellMetadata(
gobject,
spat_unit = spat_unit,
feat_type = feat_type,
output = 'cellMetaObj',
copy_obj = TRUE,
set_defaults = FALSE
)

if(isS4(expr_data)) {
if(!identical(expr_data@provenance, cell_metadata@provenance)) {
Expand Down
Loading

0 comments on commit 621cde5

Please sign in to comment.