Skip to content

Commit

Permalink
update negative method
Browse files Browse the repository at this point in the history
  • Loading branch information
littlecabiria committed Nov 18, 2024
1 parent c0cbd55 commit 1ee2de4
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/control_methods/negative/script.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## VIASH START
par <- list(
input = "resources_test/datasets/MOBNEW/dataset_sp.h5ad",
input = "resources_test/spatialsimbench_mobnew/dataset_sp.h5ad",
output = "simulated_dataset.h5ad"
)
meta <- list(
Expand All @@ -13,17 +13,15 @@ input <- anndata::read_h5ad(par$input)

count_matrix <- as.matrix(input$layers[['counts']])

shuffled_values <- sample(as.vector(count_matrix))

n_rows <- nrow(count_matrix)
n_cols <- ncol(count_matrix)
shuffled_matrix <- matrix(shuffled_values, nrow = nrow(count_matrix), ncol = ncol(count_matrix))

random_matrix_uniform <- matrix(runif(n_rows * n_cols), nrow = n_rows, ncol = n_cols)
rownames(random_matrix_uniform) <- rownames(count_matrix)

cat("Generate outoput file\n")
output <- anndata::AnnData(
layers = list(
counts = random_matrix_uniform
counts = shuffled_matrix
),
obs = input$obs[c("row", "col")],
var = input$var,
Expand Down

0 comments on commit 1ee2de4

Please sign in to comment.