Skip to content

Commit 0d06363

Browse files
authored
move to v0.2.6 (#280)
move to v0.2.6
2 parents 0380b1d + 227f5c3 commit 0d06363

8 files changed

Lines changed: 52 additions & 48 deletions

File tree

.github/workflows/check.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ jobs:
2121
fail-fast: false
2222
matrix:
2323
config:
24+
- {os: macos-latest, r: 'devel'}
2425
- {os: macos-latest, r: 'release'}
25-
- {os: windows-latest, r: 'release', rtools-version: '44'}
26-
- {os: ubuntu-latest, r: 'release'}
27-
- {os: ubuntu-24.04, r: 'release'}
26+
- {os: windows-latest, r: 'devel', rtools-version: '45'}
27+
- {os: ubuntu-latest, r: 'devel'}
28+
- {os: ubuntu-24.04, r: 'devel'}
2829

2930
steps:
3031

DESCRIPTION

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Package: VoltRon
22
Type: Package
33
Title: VoltRon for Spatial Omics Data Integration and Analysis
4-
Version: 0.2.5
5-
Depends: R (>= 4.4.0)
4+
Version: 0.2.6
5+
Depends: R (>= 4.6.0)
66
Author@R:
77
person("Artür", "Manukyan",
88
role=c("aut", "cre"),
@@ -69,6 +69,7 @@ Suggests:
6969
BiocParallel,
7070
rhdf5,
7171
Rarr,
72+
ZarrArray,
7273
basilisk,
7374
reticulate,
7475
RBioFormats,
@@ -104,13 +105,12 @@ Suggests:
104105
anndata,
105106
SimpleITK
106107
Remotes:
107-
stla/RCDT,
108+
stla/RCDT,
108109
BIMSBbioinfo/VoltRonStore,
109110
bnprks/BPCells/r@v0.3.0,
110111
BIMSBbioinfo/VoltRon,
111112
BIMSBbioinfo/HDF5DataFrame,
112-
BIMSBbioinfo/ZarrDataFrame,
113-
Artur-man/ImageArray
113+
BIMSBbioinfo/ZarrDataFrame
114114
Config/testthat/edition: 3
115115
LazyData: true
116116
LazyDataCompression: gzip

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ RUN R -e "install.packages(c('shiny', 'devtools', 'BiocManager'), repos='http://
1414

1515
# Install VoltRon dependencies
1616
RUN R -e "install.packages(c('grDevices', 'data.table', 'RcppAnnoy', 'RANN', 'Matrix', 'dplyr', 'ggplot2', 'ggrepel', 'igraph', 'rjson', 'magick', 'ids', 'sp', 'reshape2', 'rlang', 'ggpubr', 'shinyjs'), repos='http://cran.rstudio.com/')"
17-
RUN R -e "install.packages(c('stringr', 'uwot'), repos='http://cran.rstudio.com/')"
17+
RUN R -e "install.packages(c('remotes', 'stringr', 'uwot'), repos='http://cran.rstudio.com/')"
1818
RUN R -e "BiocManager::install(c('EBImage', 'S4Arrays', 'BiocSingular'))"
1919

2020
# set up java

R/image.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ subsetvrImage <- function(x, subset, spatialpoints = NULL, image = NULL) {
177177
img_data <- ImageArray::crop(
178178
img_data,
179179
ind = list(
180-
crop_info_int[3]:(crop_info_int[3] + crop_info_int[1]),
181-
crop_info_int[4]:(crop_info_int[4] + crop_info_int[2])
180+
x = crop_info_int[3]:(crop_info_int[3] + crop_info_int[1]),
181+
y = crop_info_int[4]:(crop_info_int[4] + crop_info_int[2])
182182
)
183183
)
184184
object@image[[img]] <- img_data

R/ondisk.R

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -747,9 +747,9 @@ writeHDF5ArrayInImage <- function(
747747
img <-
748748
ImageArray::writeImageArray(
749749
img,
750-
output = gsub(".h5$", "", h5_path),
750+
output = h5_path,
751751
name = paste0(name, "/spat_", spat, "/", ch),
752-
format = "HDF5ImageArray",
752+
format = "hdf5",
753753
replace = FALSE,
754754
chunkdim = chunkdim,
755755
level = level,
@@ -784,16 +784,18 @@ writeHDF5ArrayInImage <- function(
784784
remotes::install_github('bnprks/BPCells/r')"
785785
)
786786
}
787-
# if (!inherits(object, "dgCMatrix")) {
788-
if (!inherits(object, "Matrix")) {
787+
if (!inherits(object, "CsparseMatrix")) {
789788
object <- as(object, "dgCMatrix")
790789
}
791-
object <- BPCells::write_matrix_hdf5(
792-
object,
793-
path = h5_path,
794-
group = name,
795-
overwrite = TRUE
796-
)
790+
# save only when the data is non zero length
791+
if(nrow(object) > 0){
792+
object <- BPCells::write_matrix_hdf5(
793+
object,
794+
path = h5_path,
795+
group = name,
796+
overwrite = TRUE
797+
)
798+
}
797799
} else if (feature.vs.obs.engine == "DelayedArray") {
798800
if (!requireNamespace('HDF5Array')) {
799801
stop(
@@ -1001,13 +1003,13 @@ writeZarrArrayInMetadata <- function(
10011003
}
10021004
cur_column <- as.array(cur_column)
10031005
meta.data_list[["id"]] <-
1004-
Rarr::writeZarrArray(
1006+
ZarrArray::writeZarrArray(
10051007
cur_column,
1006-
zarr_array_path = file.path(
1008+
zarr_path = file.path(
10071009
zarr_path,
10081010
paste0(name, "/", sn, "/id")
10091011
),
1010-
chunk_dim = min(length(cur_column), 2000),
1012+
chunkdim = min(length(cur_column), 2000),
10111013
nchar = nchar
10121014
)
10131015
}
@@ -1028,13 +1030,13 @@ writeZarrArrayInMetadata <- function(
10281030
}
10291031
cur_column <- as.array(cur_column)
10301032
meta.data_list[[colnames(meta.data)[i]]] <-
1031-
Rarr::writeZarrArray(
1033+
ZarrArray::writeZarrArray(
10321034
cur_column,
1033-
zarr_array_path = file.path(
1035+
zarr_path = file.path(
10341036
zarr_path,
10351037
paste0(name, "/", sn, "/", colnames(meta.data)[i])
10361038
),
1037-
chunk_dim = min(length(cur_column), 2000),
1039+
chunkdim = min(length(cur_column), 2000),
10381040
nchar = nchar
10391041
)
10401042
}
@@ -1092,10 +1094,10 @@ writeZarrArrayInVrData <- function(
10921094
if (!is.array(a)) {
10931095
a <- as.array(a)
10941096
}
1095-
a <- Rarr::writeZarrArray(
1097+
a <- ZarrArray::writeZarrArray(
10961098
a,
1097-
zarr_array_path = file.path(zarr_path, paste0(name, "/", feat)),
1098-
chunk_dim = chunkdim
1099+
zarr_path = file.path(zarr_path, paste0(name, "/", feat)),
1100+
chunkdim = chunkdim
10991101
)
11001102
} else {
11011103
a <- DelayedArray::DelayedArray(a)
@@ -1121,13 +1123,13 @@ writeZarrArrayInVrData <- function(
11211123
if (!is.array(a)) {
11221124
a <- as.array(a)
11231125
}
1124-
a <- Rarr::writeZarrArray(
1126+
a <- ZarrArray::writeZarrArray(
11251127
a,
1126-
zarr_array_path = file.path(
1128+
zarr_path = file.path(
11271129
zarr_path,
11281130
paste0(name, "/", feat, "_norm")
11291131
),
1130-
chunk_dim = chunkdim
1132+
chunkdim = chunkdim
11311133
)
11321134
} else {
11331135
a <- DelayedArray::DelayedArray(a)
@@ -1157,10 +1159,10 @@ writeZarrArrayInVrData <- function(
11571159
if (!is.array(a)) {
11581160
a <- as.array(a)
11591161
}
1160-
a <- Rarr::writeZarrArray(
1162+
a <- ZarrArray::writeZarrArray(
11611163
a,
1162-
zarr_array_path = file.path(zarr_path, paste0(name, "/rawdata")),
1163-
chunk_dim = chunkdim
1164+
zarr_path = file.path(zarr_path, paste0(name, "/rawdata")),
1165+
chunkdim = chunkdim
11641166
)
11651167
} else {
11661168
a <- DelayedArray::DelayedArray(a)
@@ -1186,10 +1188,10 @@ writeZarrArrayInVrData <- function(
11861188
if (!is.array(a)) {
11871189
a <- as.array(a)
11881190
}
1189-
a <- Rarr::writeZarrArray(
1191+
a <- ZarrArray::writeZarrArray(
11901192
a,
1191-
zarr_array_path = file.path(zarr_path, paste0(name, "/normdata")),
1192-
chunk_dim = chunkdim
1193+
zarr_path = file.path(zarr_path, paste0(name, "/normdata")),
1194+
chunkdim = chunkdim
11931195
)
11941196
} else {
11951197
a <- DelayedArray::DelayedArray(a)
@@ -1248,13 +1250,13 @@ writeZarrArrayInImage <- function(
12481250
if (is.null(chunkdim)) {
12491251
chunkdim <- vapply(dim(coords), function(x) min(x, 1000), numeric(1))
12501252
}
1251-
coords <- Rarr::writeZarrArray(
1253+
coords <- ZarrArray::writeZarrArray(
12521254
coords,
1253-
zarr_array_path = file.path(
1255+
zarr_path = file.path(
12541256
zarr_path,
12551257
paste0(name, "/spat_", spat, "/coords")
12561258
),
1257-
chunk_dim = chunkdim
1259+
chunkdim = chunkdim
12581260
)
12591261

12601262
# Rarr::ZarrArray doesnt have rownames
@@ -1285,9 +1287,9 @@ writeZarrArrayInImage <- function(
12851287
}
12861288
img <- ImageArray::writeImageArray(
12871289
img,
1288-
output = gsub(".zarr$", "", zarr_path),
1290+
output = zarr_path,
12891291
name = paste0(name, "/spat_", spat, "/", ch),
1290-
format = "ZarrImageArray",
1292+
format = "zarr",
12911293
replace = FALSE,
12921294
chunkdim = chunkdim,
12931295
level = level,

R/registration.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2250,7 +2250,7 @@ plotImage <- function(image, max.pixel.size = NULL) {
22502250
}
22512251
imgggplot <- magick::image_ggplot(image)
22522252
} else if (inherits(image, "ImageArray")) {
2253-
img_raster <- ImageArray::as.raster(image, max.pixel.size = max.pixel.size)
2253+
img_raster <- as.raster(image, max.pixel.size = max.pixel.size)
22542254
info <- list(width = dim(img_raster)[2], height = dim(img_raster)[1])
22552255
imgggplot <- ggplot2::ggplot(
22562256
data.frame(x = 0, y = 0),
@@ -2398,8 +2398,8 @@ cropImage <- function(image, geometry) {
23982398
image <- ImageArray::crop(
23992399
image,
24002400
ind = list(
2401-
crop_info_int[3]:(crop_info_int[3] + crop_info_int[1]),
2402-
crop_info_int[4]:(crop_info_int[4] + crop_info_int[2])
2401+
x = crop_info_int[3]:(crop_info_int[3] + crop_info_int[1]),
2402+
y = crop_info_int[4]:(crop_info_int[4] + crop_info_int[2])
24032403
)
24042404
)
24052405
}

R/visualization.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2421,7 +2421,7 @@ vrSpatialPlotImage <- function(
24212421

24222422
# TODO: is this necessary ?
24232423
if (inherits(image, "ImageArray")) {
2424-
image <- ImageArray::as.raster(image)
2424+
image <- as.raster(image)
24252425
}
24262426

24272427
# annotation raster

tests/testthat/test-ondisk.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ skip_if_not_installed("HDF5DataFrame")
66
skip_if_not_installed("ZarrDataFrame")
77
skip_if_not_installed("ImageArray")
88
skip_if_not_installed("BPCells")
9+
skip_if_not_installed("DelayedMatrixStats")
910

1011
# create dir
1112
dir.create(td <- tempfile())

0 commit comments

Comments
 (0)