Skip to content

Commit 69e6b4d

Browse files
committed
Change adata loading in spanorm from zellkonverter to anndataR
1 parent ca3a1d6 commit 69e6b4d

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

src/methods_normalization/spanorm/config.vsh.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ engines:
1818
- type: docker
1919
image: openproblems/base_r:1
2020
setup:
21+
#- type: docker
22+
# run: |
23+
# apt-get update && apt-get install -y wget
2124
- type: r
22-
bioc: [SpaNorm, zellkonverter]
25+
bioc: [SpaNorm, anndataR, rhdf5]
2326
#- type: r
2427
# bioc: [SummarizedExperiment,SingleCellExperiment,SpatialExperiment]
2528
# bioc_force_install: true

src/methods_normalization/spanorm/script.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
library(SpaNorm)
22
library(SingleCellExperiment)
33
library(SpatialExperiment)
4-
library(zellkonverter)
4+
library(anndataR)
55

66
## VIASH START
77
par <- list(
@@ -11,7 +11,7 @@ par <- list(
1111
## VIASH END
1212

1313
# Read the input h5ad file and convert to SingleCellExperiment
14-
sce <- readH5AD(par$input_spatial_aggregated_counts)
14+
sce <- read_h5ad(par$input_spatial_aggregated_counts, as = "SingleCellExperiment")
1515
# Convert to SpatialExperiment for SpaNorm
1616
sce <- as(sce, "SpatialExperiment")
1717

@@ -52,4 +52,5 @@ final_sce <- SingleCellExperiment(
5252
assay(final_sce, "normalized") <- normalized_matrix
5353

5454
# Write the final object to h5ad format
55-
zellkonverter::writeH5AD(final_sce, par$output)
55+
dir.create(dirname(par$output), showWarnings = FALSE, recursive = TRUE)
56+
write_h5ad(final_sce, par$output)

0 commit comments

Comments
 (0)