Skip to content
Merged
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
13 changes: 6 additions & 7 deletions src/data_processors/process_dataset/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@
# Load the spatial data
sdata = sd.read_zarr(par["input_sp"])

# Subset the single-cell data to spatial genes
genes_sp = []
for key in sdata.tables.keys():
# todo: var column names need to be updated to match the rest of openproblems
genes_sp = genes_sp + sdata.tables[key].var_names.tolist()
genes_sp = list(np.unique(genes_sp))
adata = adata[:,adata.var["feature_name"].isin(genes_sp)].copy()
# Subset single-cell and spatial data to shared genes
sp_genes = sdata['transcripts']['feature_name'].unique().compute().tolist()
sc_genes = adata.var["feature_name"].unique().tolist()
shared_genes = list(set(sp_genes) & set(sc_genes))
sdata['transcripts'] = sdata['transcripts'].loc[sdata['transcripts']['feature_name'].isin(shared_genes)]
adata = adata[:,adata.var["feature_name"].isin(shared_genes)].copy()

# Use feature names for adata instead of feature ids. convert to str
adata.var.reset_index(inplace=True, drop=True)
Expand Down
4 changes: 4 additions & 0 deletions src/workflows/process_datasets/test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/bin/bash

# NOTE: For local testing you might need to reduce the memory in src/data_processors/process_dataset/config.vsh.yaml
# Don't forget to rebuild that dependency of the workflow:
# viash ns build src/data_processors/process_dataset/config.vsh.yaml --setup cachedbuild

nextflow run . \
-main-script target/nextflow/workflows/process_datasets/main.nf \
-profile docker \
Expand Down