Skip to content

Commit

Permalink
spanorm is runable
Browse files Browse the repository at this point in the history
  • Loading branch information
1 parent 778f2b8 commit 44d560d
Show file tree
Hide file tree
Showing 4 changed files with 141 additions and 0 deletions.
Binary file added .RData
Binary file not shown.
78 changes: 78 additions & 0 deletions .Rhistory
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
library(SpaNorm)
devtools::install_github("bhuvad/SpaNorm")
install.packages(""\\wsl.localhost\Ubuntu\home\astat17\task_ist_preprocessing\SpaNorm"", repos = NULL, type = "source")
install.packages(""wsl.localhost\Ubuntu\home\astat17\task_ist_preprocessing\SpaNorm"", repos = NULL, type = "source")
install.packages("wsl.localhost\Ubuntu\home\astat17\task_ist_preprocessing\SpaNorm", repos = NULL, type = "source")
install.packages("wsl.localhost/Ubuntu/home/astat17/task_ist_preprocessing/SpaNorm", repos = NULL, type = "source")
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("SpaNorm")
library(SpaNorm)
installed.packages()[, "Package"]
install.packages("textshaping", type = "source", configure.vars = "INCLUDE_DIR=/path/to/include LIB_DIR=/path/to/lib")
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("SpaNorm")
library(SpaNorm)
install.packages("textshaping")
install.packages("SpaNorm")
if (!require("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("SpaNorm")
if (!require("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install(version = "3.19")
BiocManager::version()
BiocManager::install(version = "3.19")
BiocManager::version()
BiocManager::install(c(
"SummarizedExperiment",
"GenomicRanges",
"DelayedArray",
"SingleCellExperiment",
"scuttle",
"SpatialExperiment",
"scran",
"beachmat",
"BiocSingular",
"SparseArray"
))
if (!requireNamespace("devtools", quietly = TRUE)) {
install.packages("devtools")
}
library(devtools)
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install(version = "3.18")
BiocManager::version()
BiocManager::install("SpaNorm", dependencies = TRUE)
BiocManager::install(c( "DelayedArray", "ScaledMatrix", "beachmat", "GenomicRanges", "SummarizedExperiment", "SingleCellExperiment", "BiocSingular", "scuttle", "scran","SpatialExperiment" ))
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install(c( "DelayedArray", "ScaledMatrix", "beachmat", "GenomicRanges", "SummarizedExperiment", "SingleCellExperiment", "BiocSingular", "scuttle", "scran","SpatialExperiment" ))
install.packages("wsl.localhost/Ubuntu/home/astat17/task_ist_preprocessing/SpaNorm", repos = NULL, type = "source")
install.packages("\\\\wsl$\\Ubuntu\\home\\astat17\\task_ist_preprocessing\\SpaNorm", repos = NULL, type = "source")
install.packages("/home/astat17/task_ist_preprocessing/SpaNorm", repos = NULL, type = "source")
install.packages(c('edgeR', 'ggplot2', 'Matrix', 'matrixStats', 'rlang',
'scran', 'SeuratObject', 'SingleCellExperiment',
'SpatialExperiment', 'SummarizedExperiment', 'S4Vectors'))
library(scran)
.libPaths(c("C:/Program Files/R/R-4.4.1/library", .libPaths()))
library(SpaNorm)
library(spanorm)
.libPaths()
install.packages("matrixStats")
install.packages("S4Vectors")
install.packages("S4Vectors")
if (.Platform$OS.type == "windows") {
utils::winMenuAddItem("MyMenu", "MyItem")
}
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("SpaNorm")
library(SpaNorm)
assign(".Platform", list(OS.type = "windows"), envir = baseenv())
if (.Platform$OS.type == "windows") {
utils::winMenuAddItem("MyMenu", "MyItem")
}
library(SpaNorm)
28 changes: 28 additions & 0 deletions src/methods_normalization/spanorm/config.vsh.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
__merge__: /src/api/comp_method_normalization.yaml

name: spanorm
label: "Spatially-aware normalisation for spatial transcriptomics data"
summary: "Spatially-aware normalisation for spatial transcriptomics data"
description: "Spatially-aware normalisation for spatial transcriptomics data"
links:
documentation: "https://github.com/openproblems-bio/task_ist_preprocessing"
repository: "https://github.com/bhuvad/SpaNorm/tree/master"
references:
doi: "https://doi.org/10.1101/2024.05.31.596908"

resources:
- type: r_script
path: script.R

engines:
- type: docker
image: openproblems/base_python:1.0.0
__merge__:
- /src/base/setup_txsim_partial.yaml
- type: native

runners:
- type: executable
- type: nextflow
directives:
label: [ midtime, lowcpu, lowmem ]
35 changes: 35 additions & 0 deletions src/methods_normalization/spanorm/script.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
library(SpaNorm)
library(SingleCellExperiment)
library(SpatialExperiment)
library(zellkonverter)

par <- list(
"input" = 'resources_test/task_ist_preprocessing/mouse_brain_combined/spatial_aggregated_counts.h5ad',
"output" = 'tmp/spatial_spanormed_counts.h5ad'
)

sce <- readH5AD(par$input)
sce <- as(sce, "SpatialExperiment")

centroid_x <- colData(sce)$centroid_x
centroid_y <- colData(sce)$centroid_y

spatial_coords <- matrix(c(centroid_x, centroid_y), ncol = 2)

spatialCoords(sce) <- spatial_coords

keep = filterGenes(sce, 0.05)
sce <- sce[keep, ]
result <- SpaNorm(sce)

main_assay <- assay(result, "X")
row_data <- rowData(result)
col_data <- colData(result)

final_sce <- SingleCellExperiment(
assays = list(X = main_assay),
rowData = row_data,
colData = col_data
)

zellkonverter::writeH5AD(final_sce, par$output)

0 comments on commit 44d560d

Please sign in to comment.