diff --git a/src/metrics/cell_cycle_conservation/config.vsh.yaml b/src/metrics/cell_cycle_conservation/config.vsh.yaml index 27b6111a..ae42175b 100644 --- a/src/metrics/cell_cycle_conservation/config.vsh.yaml +++ b/src/metrics/cell_cycle_conservation/config.vsh.yaml @@ -43,7 +43,7 @@ engines: setup: - type: python pypi: - - git+https://github.com/theislab/scib.git@extend_cell_cycle_genes + - scib==1.1.7 runners: - type: executable - type: nextflow diff --git a/src/metrics/cell_cycle_conservation/script.py b/src/metrics/cell_cycle_conservation/script.py index b254f4f8..7407025b 100644 --- a/src/metrics/cell_cycle_conservation/script.py +++ b/src/metrics/cell_cycle_conservation/script.py @@ -1,22 +1,21 @@ import sys import anndata as ad from scib.metrics import cell_cycle -import numpy as np ## VIASH START par = { 'input_integrated': 'resources_test/task_batch_integration/cxg_immune_cell_atlas/integrated_full.h5ad', + "input_solution": "resources_test/task_batch_integration/cxg_immune_cell_atlas/output_solution.h5ad", 'output': 'output.h5ad' } - meta = { - 'name': 'foo' + "resources_dir": "target/executable/metrics/cell_cycle_conservation", } ## VIASH END + sys.path.append(meta["resources_dir"]) from read_anndata_partial import read_anndata - print('Read input', flush=True) adata_solution = read_anndata( par['input_solution'], @@ -25,12 +24,15 @@ var='var', uns='uns' ) +print(f"adata_solution: {adata_solution}", flush=True) + adata_integrated = read_anndata( par['input_integrated'], obs='obs', obsm='obsm', uns='uns' ) +print(f"adata_integrated: {adata_integrated}", flush=True) print("Copy batch information", flush=True) adata_integrated.obs['batch'] = adata_solution.obs['batch'] @@ -38,21 +40,13 @@ print('Use gene symbols for features', flush=True) adata_solution.var_names = adata_solution.var['feature_name'] -dataset_organism = adata_solution.uns['dataset_organism'] -translator = { - "homo_sapiens": "human", - "mus_musculus": "mouse", -} -assert dataset_organism in translator, \ - f"dataset organism ({dataset_organism}) not in translator!" - print('Compute score', flush=True) score = cell_cycle( adata_solution, adata_integrated, batch_key='batch', embed='X_emb', - organism=translator[dataset_organism], + organism=adata_solution.uns['dataset_organism'], ) print('Create output AnnData object', flush=True) @@ -65,7 +59,7 @@ 'metric_values': [ score ] } ) - +print(f"output: {output}", flush=True) print('Write data to file', flush=True) output.write_h5ad(par['output'], compression='gzip')