Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spanorm is runable #14

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
29 changes: 29 additions & 0 deletions src/methods_normalization/spanorm/config.vsh.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
__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_r:1.0.0
setup:
- type: r
bioc: SpaNorm, zellkonverter
- 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)
Loading