Skip to content

Commit

Permalink
fix issues in scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
rcannood committed Sep 19, 2024
1 parent d54a1cb commit ef03f1b
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 10 deletions.
8 changes: 7 additions & 1 deletion scripts/test_resources/test_pipeline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ viash run src/methods_normalization/normalize_by_volume/config.vsh.yaml -- \
# run a cell type annotation method
viash run src/methods_cell_type_annotation/ssam/config.vsh.yaml -- \
--input_spatial_normalized_counts $OUT_DIR/spatial_normalized_counts.h5ad \
--input_transcripts $OUT_DIR/transcript_assignments.zarr \
--input_transcript_assignments $OUT_DIR/transcript_assignments.zarr \
--input_scrnaseq_reference $OUT_DIR/scrnaseq_reference.h5ad \
--output $OUT_DIR/spatial_with_cell_types.h5ad

Expand All @@ -53,3 +53,9 @@ viash run src/methods_expression_correction/gene_efficiency_correction/config.vs
--input_spatial_with_cell_types $OUT_DIR/spatial_with_cell_types.h5ad \
--input_scrnaseq_reference $OUT_DIR/scrnaseq_reference.h5ad \
--output $OUT_DIR/spatial_corrected_counts.h5ad

# sync test resources
aws s3 sync --profile op \
"resources_test/task_ist_preprocessing/mouse_brain_combined" \
"s3://openproblems-data/resources_test/task_ist_preprocessing/mouse_brain_combined" \
--delete --dryrun
4 changes: 3 additions & 1 deletion src/methods_calculate_cell_volume/alpha_shapes/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
sdata = sd.read_zarr(par['input'])

print('Determine cell ids', flush=True)
cell_ids = sdata.tables["table"].obs_names
cell_ids = sorted(sdata["transcripts"]["cell_id"].unique())
if cell_ids[0] == 0:
cell_ids = cell_ids[1:]

print('Init AnnData object', flush=True)
adata = ad.AnnData(
Expand Down
5 changes: 4 additions & 1 deletion src/methods_cell_type_annotation/ssam/config.vsh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ engines:
image: openproblems/base_python:1.0.0
setup:
- type: python
pypi: [planktonspace]
github: [theislab/txsim@dev]
- type: python
pypi: [squidpy, rasterio]
- type: python
pypi: [planktonspace]
- type: native

runners:
Expand Down
14 changes: 7 additions & 7 deletions src/methods_cell_type_annotation/ssam/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

## VIASH START
par = {
'input': 'spatial_norm_counts.h5ad',
'input_transcripts': 'spatial_assigned.zarr',
'input_sc': 'sc_norm_counts.h5ad',
'input_spatial_normalized_counts': 'spatial_norm_counts.h5ad',
'input_transcript_assignments': 'spatial_assigned.zarr',
'input_scrnaseq_reference': 'sc_norm_counts.h5ad',
'um_per_pixel': 0.5,
'output': 'spatial_with_celltypes.h5ad',
'celltype_key': 'celltype',
Expand All @@ -16,14 +16,14 @@
}
## VIASH END

# Optional parameter check: For this specific annotation method the par['input_transcripts'] and par['input_sc'] are required
assert par['input_transcripts'] is not None, 'Transcripts input is required for this annotation method.'
assert par['input_sc'] is not None, 'Single cell input is required for this annotation method.'
# Optional parameter check: For this specific annotation method the par['input_transcript_assignments'] and par['input_sc'] are required
assert par['input_transcript_assignments'] is not None, 'Transcripts input is required for this annotation method.'
assert par['input_scrnaseq_reference'] is not None, 'Single cell input is required for this annotation method.'

# Read input
print('Reading input files', flush=True)
adata_sp = ad.read_h5ad(par['input_spatial_normalized_counts'])
transcripts = sd.SpatialData.read(par['input_transcripts'])['transcripts']
transcripts = sd.SpatialData.read(par['input_transcript_assignments'])['transcripts']
adata_sc = ad.read_h5ad(par['input_scrnaseq_reference'])
adata_sp = adata_sp[:,adata_sc.var_names] #TODO: do we want to do this earlier? Maybe not, thinking about transcripts related quality metrics

Expand Down
2 changes: 2 additions & 0 deletions src/methods_normalization/normalize_by_volume/config.vsh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ engines:
setup:
- type: python
github: [theislab/txsim@dev]
- type: python
pypi: [squidpy, rasterio]
- type: native

runners:
Expand Down

0 comments on commit ef03f1b

Please sign in to comment.