Skip to content

Commit

Permalink
fix component and script
Browse files Browse the repository at this point in the history
  • Loading branch information
rcannood committed Sep 4, 2024
1 parent 0100b5e commit fcc5d85
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
9 changes: 8 additions & 1 deletion scripts/create_datasets/resources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ output_state: "\$id/state.yaml"
publish_dir: resources/task_spatial_simulators/datasets/
EOF

# the datasets are in the local cache so we can't use seqera tower

# tw launch https://github.com/openproblems-bio/task_spatial_simulators.git \
# --revision build/main \
# --pull-latest \
Expand All @@ -202,4 +204,9 @@ EOF
nextflow run . \
-profile docker \
-main-script target/nextflow/workflows/process_datasets/main.nf \
-params-file /tmp/params.yaml
-params-file /tmp/params.yaml

aws s3 sync --profile op \
resources/task_spatial_simulators/datasets/ \
s3://openproblems-data/resources/task_spatial_simulators/datasets/ \
--delete --dryrun
16 changes: 12 additions & 4 deletions src/process_datasets/convert/script.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ par <- list(
)
## VIASH END

process_matrix <- function(obj, layer_name) {
if (!layer_name %in% assayNames(obj)) {
return(NULL)
}
assay(obj, layer_name) |>
as("CsparseMatrix") |>
Matrix::t()
}

cat("Read input files\n")
input_sc <- readRDS(par$input_sc)
input_sp <- readRDS(par$input_sp)
Expand All @@ -48,8 +57,7 @@ uns <- list(
cat("Transforming single cell into AnnData\n")
output_sc <- anndata::AnnData(
layers = list(
counts = Matrix::t(assay(input_sc, "counts")),
logcounts = Matrix::t(assay(input_sc, "logcounts"))
counts = process_matrix(input_sc, "counts")
),
obs = data.frame(
row.names = colnames(input_sc),
Expand Down Expand Up @@ -78,8 +86,8 @@ celltype_proportions <- as.data.frame(metadata(input_sp)[["celltype_prop"]])

output_sp <- anndata::AnnData(
layers = list(
counts = Matrix::t(assay(input_sp, "counts")),
logcounts = Matrix::t(assay(input_sp, "logcounts"))
counts = process_matrix(input_sp, "counts"),
logcounts = process_matrix(input_sp, "logcounts")
),
obs = data.frame(
row.names = colnames(input_sp),
Expand Down

0 comments on commit fcc5d85

Please sign in to comment.