Skip to content

Commit

Permalink
Merge pull request #1020 from jiajic/suite_dev
Browse files Browse the repository at this point in the history
chore: move some deps to suggests
  • Loading branch information
jiajic authored Sep 3, 2024
2 parents 523103d + 225124c commit eeefba8
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 16 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,11 @@ Imports:
GiottoVisuals (>= 0.2.4),
igraph (>= 1.2.4.1),
jsonlite,
limma,
Matrix (>= 1.6-2),
MatrixGenerics,
plotly,
progressr,
reshape2,
reticulate (>= 1.25),
Rtsne (>= 0.15),
scales (>= 1.0.0),
sparseMatrixStats,
stats,
Expand Down Expand Up @@ -86,11 +83,13 @@ Suggests:
jackstraw,
kableExtra,
knitr,
limma,
MAST,
miniUI,
multinet (>= 3.0.2),
networkD3,
pheatmap,
plotly,
quadprog,
harmony,
R.utils,
Expand All @@ -99,6 +98,7 @@ Suggests:
rlang,
rhdf5,
RTriangle (>= 1.6-0.10),
Rtsne (>= 0.15),
Rvision,
scater,
scran (>= 1.10.1),
Expand Down
26 changes: 14 additions & 12 deletions R/auxiliary_giotto.R
Original file line number Diff line number Diff line change
Expand Up @@ -756,33 +756,33 @@ filterGiotto <- function(
if(!inherits(dbMatrix, 'dbMatrix')) {
stop('dbMatrix must be of class dbMatrix')
}

if(!is.character(name)) {
stop('name must be a character')
}

# TODO: update with dbData generic
con = dbMatrix:::get_con(dbMatrix)

# overwrite table by default
if(name %in% DBI::dbListTables(con)) {
DBI::dbRemoveTable(con, name)
}

if(verbose){
msg <- glue::glue('Computing {name} expression matrix on disk...')
cat(msg)
cat(msg)
}

dbMatrix[] |>
dplyr::compute(temporary=F, name = name)

# TODO: update below with proper setters from dbMatrix
dbMatrix[] <- dplyr::tbl(con, name) # reassign to computed mat
dbMatrix@name <- name

if(verbose) cat('done \n')

return(dbMatrix)
}

Expand Down Expand Up @@ -902,7 +902,7 @@ filterGiotto <- function(
dbMatrix = norm_expr,
name = 'normalized',
verbose = verbose
)
)
}

norm_expr <- create_expr_obj(
Expand All @@ -913,14 +913,14 @@ filterGiotto <- function(
provenance = provenance,
misc = NULL
)

# Save dbMatrix to db
if(compute_mat && !is.null(norm_scaled_expr)){
norm_scaled_expr = .compute_dbMatrix(
dbMatrix = norm_scaled_expr,
name = 'scaled',
verbose = verbose
)
)
}

norm_scaled_expr <- create_expr_obj(
Expand Down Expand Up @@ -1297,6 +1297,8 @@ adjustGiottoMatrix <- function(
provided.")
}

package_check("limma")

# Set feat_type and spat_unit
spat_unit <- set_default_spat_unit(
gobject = gobject,
Expand Down
6 changes: 6 additions & 0 deletions R/cross_section.R
Original file line number Diff line number Diff line change
Expand Up @@ -1119,6 +1119,9 @@ insertCrossSectionSpatPlot3D <- function(
custom_ratio = NULL,
default_save_name = "spat3D_with_cross_section",
...) {

package_check("plotly", repository = "CRAN:plotly")

spat_unit <- set_default_spat_unit(
gobject = gobject, spat_unit = spat_unit
)
Expand Down Expand Up @@ -1253,6 +1256,9 @@ insertCrossSectionFeatPlot3D <- function(gobject,
save_param = list(),
default_save_name = "spatGenePlot3D_with_cross_section",
...) {

package_check("plotly", repository = "CRAN:plotly")

spat_unit <- set_default_spat_unit(
gobject = gobject, spat_unit = spat_unit
)
Expand Down
3 changes: 3 additions & 0 deletions R/dimension_reduction.R
Original file line number Diff line number Diff line change
Expand Up @@ -2634,6 +2634,9 @@ runtSNE <- function(
seed_number = 1234,
verbose = TRUE,
...) {

package_check("Rtsne")

# Set feat_type and spat_unit
spat_unit <- set_default_spat_unit(
gobject = gobject,
Expand Down
8 changes: 7 additions & 1 deletion R/interactivity.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ plotInteractivePolygons <- function(
geom_polygon(
data = clicklist(),
aes(x, y, color = name),
alpha = 0,
alpha = 0,
show.legend = FALSE,
...
) +
Expand Down Expand Up @@ -649,6 +649,12 @@ plotInteractive3D <- function(
cell_color = "leiden_clus",
cell_color_code = NULL, point_size = 0.5,
width = "100%", height = "400px") {

package_check(
c("plotly", "miniUI", "shiny"),
repository = c("CRAN:plotly", "CRAN:miniUI", "CRAN:shiny")
)

# NSE vars
sdimx <- sdimy <- sdimz <- cell_ID <- NULL

Expand Down
3 changes: 3 additions & 0 deletions R/spatial_genes.R
Original file line number Diff line number Diff line change
Expand Up @@ -2924,6 +2924,9 @@ showPattern3D <- function(
save_plot = NULL,
save_param = list(),
default_save_name = "showPattern3D") {

package_check("plotly", repository = "CRAN:plotly")

# data.table variables
center_x <- x_start <- x_end <- center_y <- y_start <- y_end <-
center_z <- z_start <- z_end <- NULL
Expand Down
2 changes: 2 additions & 0 deletions R/spatial_interaction.R
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,8 @@ NULL
offset = 0.1) {
vmsg(.is_debug = TRUE, ".do_limmatest")

package_check("limma")

# data.table variables
sel <- other <- feats <- P.Value <- adj.P.Val <- p.adj <- NULL

Expand Down
7 changes: 7 additions & 0 deletions R/spatial_interaction_visuals.R
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,9 @@ NULL
x_ticks = NULL,
y_ticks = NULL,
...) {

package_check("plotly")

# data.table variables
cell_ID <- unified_int <- NULL

Expand Down Expand Up @@ -984,6 +987,9 @@ NULL
y_ticks = NULL,
z_ticks = NULL,
...) {

package_check("plotly")

# data.table variables
cell_ID <- unified_int <- NULL

Expand Down Expand Up @@ -3677,6 +3683,7 @@ cellProximitySpatPlot3D <- function(
save_param = list(),
default_save_name = "cellProximitySpatPlot3D",
...) {

if (is.null(sdimz)) {
pl <- .cellProximityVisPlot_2D_plotly(
gobject = gobject,
Expand Down

0 comments on commit eeefba8

Please sign in to comment.