Skip to content

Commit 44d560d

Browse files
spanorm is runable
1 parent 778f2b8 commit 44d560d

File tree

4 files changed

+141
-0
lines changed

4 files changed

+141
-0
lines changed

.RData

2.53 KB
Binary file not shown.

.Rhistory

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
library(SpaNorm)
2+
devtools::install_github("bhuvad/SpaNorm")
3+
install.packages(""\\wsl.localhost\Ubuntu\home\astat17\task_ist_preprocessing\SpaNorm"", repos = NULL, type = "source")
4+
install.packages(""wsl.localhost\Ubuntu\home\astat17\task_ist_preprocessing\SpaNorm"", repos = NULL, type = "source")
5+
install.packages("wsl.localhost\Ubuntu\home\astat17\task_ist_preprocessing\SpaNorm", repos = NULL, type = "source")
6+
install.packages("wsl.localhost/Ubuntu/home/astat17/task_ist_preprocessing/SpaNorm", repos = NULL, type = "source")
7+
if (!requireNamespace("BiocManager", quietly = TRUE))
8+
install.packages("BiocManager")
9+
BiocManager::install("SpaNorm")
10+
library(SpaNorm)
11+
installed.packages()[, "Package"]
12+
install.packages("textshaping", type = "source", configure.vars = "INCLUDE_DIR=/path/to/include LIB_DIR=/path/to/lib")
13+
if (!requireNamespace("BiocManager", quietly = TRUE))
14+
install.packages("BiocManager")
15+
BiocManager::install("SpaNorm")
16+
library(SpaNorm)
17+
install.packages("textshaping")
18+
install.packages("SpaNorm")
19+
if (!require("BiocManager", quietly = TRUE))
20+
install.packages("BiocManager")
21+
BiocManager::install("SpaNorm")
22+
if (!require("BiocManager", quietly = TRUE))
23+
install.packages("BiocManager")
24+
BiocManager::install(version = "3.19")
25+
BiocManager::version()
26+
BiocManager::install(version = "3.19")
27+
BiocManager::version()
28+
BiocManager::install(c(
29+
"SummarizedExperiment",
30+
"GenomicRanges",
31+
"DelayedArray",
32+
"SingleCellExperiment",
33+
"scuttle",
34+
"SpatialExperiment",
35+
"scran",
36+
"beachmat",
37+
"BiocSingular",
38+
"SparseArray"
39+
))
40+
if (!requireNamespace("devtools", quietly = TRUE)) {
41+
install.packages("devtools")
42+
}
43+
library(devtools)
44+
if (!requireNamespace("BiocManager", quietly = TRUE))
45+
install.packages("BiocManager")
46+
BiocManager::install(version = "3.18")
47+
BiocManager::version()
48+
BiocManager::install("SpaNorm", dependencies = TRUE)
49+
BiocManager::install(c( "DelayedArray", "ScaledMatrix", "beachmat", "GenomicRanges", "SummarizedExperiment", "SingleCellExperiment", "BiocSingular", "scuttle", "scran","SpatialExperiment" ))
50+
if (!requireNamespace("BiocManager", quietly = TRUE))
51+
install.packages("BiocManager")
52+
BiocManager::install(c( "DelayedArray", "ScaledMatrix", "beachmat", "GenomicRanges", "SummarizedExperiment", "SingleCellExperiment", "BiocSingular", "scuttle", "scran","SpatialExperiment" ))
53+
install.packages("wsl.localhost/Ubuntu/home/astat17/task_ist_preprocessing/SpaNorm", repos = NULL, type = "source")
54+
install.packages("\\\\wsl$\\Ubuntu\\home\\astat17\\task_ist_preprocessing\\SpaNorm", repos = NULL, type = "source")
55+
install.packages("/home/astat17/task_ist_preprocessing/SpaNorm", repos = NULL, type = "source")
56+
install.packages(c('edgeR', 'ggplot2', 'Matrix', 'matrixStats', 'rlang',
57+
'scran', 'SeuratObject', 'SingleCellExperiment',
58+
'SpatialExperiment', 'SummarizedExperiment', 'S4Vectors'))
59+
library(scran)
60+
.libPaths(c("C:/Program Files/R/R-4.4.1/library", .libPaths()))
61+
library(SpaNorm)
62+
library(spanorm)
63+
.libPaths()
64+
install.packages("matrixStats")
65+
install.packages("S4Vectors")
66+
install.packages("S4Vectors")
67+
if (.Platform$OS.type == "windows") {
68+
utils::winMenuAddItem("MyMenu", "MyItem")
69+
}
70+
if (!requireNamespace("BiocManager", quietly = TRUE))
71+
install.packages("BiocManager")
72+
BiocManager::install("SpaNorm")
73+
library(SpaNorm)
74+
assign(".Platform", list(OS.type = "windows"), envir = baseenv())
75+
if (.Platform$OS.type == "windows") {
76+
utils::winMenuAddItem("MyMenu", "MyItem")
77+
}
78+
library(SpaNorm)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
__merge__: /src/api/comp_method_normalization.yaml
2+
3+
name: spanorm
4+
label: "Spatially-aware normalisation for spatial transcriptomics data"
5+
summary: "Spatially-aware normalisation for spatial transcriptomics data"
6+
description: "Spatially-aware normalisation for spatial transcriptomics data"
7+
links:
8+
documentation: "https://github.com/openproblems-bio/task_ist_preprocessing"
9+
repository: "https://github.com/bhuvad/SpaNorm/tree/master"
10+
references:
11+
doi: "https://doi.org/10.1101/2024.05.31.596908"
12+
13+
resources:
14+
- type: r_script
15+
path: script.R
16+
17+
engines:
18+
- type: docker
19+
image: openproblems/base_python:1.0.0
20+
__merge__:
21+
- /src/base/setup_txsim_partial.yaml
22+
- type: native
23+
24+
runners:
25+
- type: executable
26+
- type: nextflow
27+
directives:
28+
label: [ midtime, lowcpu, lowmem ]
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
library(SpaNorm)
2+
library(SingleCellExperiment)
3+
library(SpatialExperiment)
4+
library(zellkonverter)
5+
6+
par <- list(
7+
"input" = 'resources_test/task_ist_preprocessing/mouse_brain_combined/spatial_aggregated_counts.h5ad',
8+
"output" = 'tmp/spatial_spanormed_counts.h5ad'
9+
)
10+
11+
sce <- readH5AD(par$input)
12+
sce <- as(sce, "SpatialExperiment")
13+
14+
centroid_x <- colData(sce)$centroid_x
15+
centroid_y <- colData(sce)$centroid_y
16+
17+
spatial_coords <- matrix(c(centroid_x, centroid_y), ncol = 2)
18+
19+
spatialCoords(sce) <- spatial_coords
20+
21+
keep = filterGenes(sce, 0.05)
22+
sce <- sce[keep, ]
23+
result <- SpaNorm(sce)
24+
25+
main_assay <- assay(result, "X")
26+
row_data <- rowData(result)
27+
col_data <- colData(result)
28+
29+
final_sce <- SingleCellExperiment(
30+
assays = list(X = main_assay),
31+
rowData = row_data,
32+
colData = col_data
33+
)
34+
35+
zellkonverter::writeH5AD(final_sce, par$output)

0 commit comments

Comments
 (0)