# HG changeset patch # User ebi-gxa # Date 1749803323 0 # Node ID 7ef2403a250d52540c027db8e3970deb4242bea9 # Parent a4774b7b2e85982c25eac454263fbb35998b498e planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/tree/develop/tools/tertiary-analysis/scanpy commit ff5af28e52e68eafbf29d0f92fcc1cecc784dfb5-dirty diff -r a4774b7b2e85 -r 7ef2403a250d anndata_operations.xml --- a/anndata_operations.xml Tue Feb 27 16:42:14 2024 +0000 +++ b/anndata_operations.xml Fri Jun 13 08:28:43 2025 +0000 @@ -1,5 +1,5 @@ - + is a Swiss army knife for AnnData files scanpy_macros2.xml @@ -42,8 +42,8 @@ #end for #end if -#if $add_cell_metadata.default: - ln -s ${add_cell_metadata.file} cell_metadata.tsv && +#if $cell_metadata: + ln -s '${cell_metadata}' cell_metadata.tsv && #end if python $operations ]]> @@ -65,7 +65,7 @@ adata = sc.read('input.h5') -#if $add_cell_metadata.default: +#if $cell_metadata: import pandas as pd def add_cell_metadata(ad, metadata_file="cell_metadata.tsv", drop_duplicates=True): @@ -304,8 +304,9 @@ res_dir = "output_split" makedirs(res_dir, exist_ok=True) for field_value in adata.obs["${split_on_obs.key}"].unique(): - ad_s = adata[adata.obs.${split_on_obs.key} == field_value] - ad_s.write(f"{res_dir}/${split_on_obs.key}_{s}.h5", compression='gzip') + ad_s = adata[adata.obs["${split_on_obs.key}"] == field_value] + field_value_san = str(field_value).replace(" ", "_").replace("/", "_") + ad_s.write(f"{res_dir}/${split_on_obs.key}_{field_value_san}.h5", compression='gzip') if s > 0: gc.collect() s += 1 @@ -326,13 +327,7 @@ - - - - - - - + @@ -477,10 +472,7 @@ - - - - + @@ -595,6 +587,8 @@ History ------- +1.9.5+galaxy1: Makes cell metadata optional for workflow optional steps. + 1.8.1+galaxy10: Adds field to be made unique in obs or var. 1.6.0+galaxy0: Moves to Scanpy Scripts 0.3.0 (Scanpy 1.6.0), versioning switched to track Scanpy as other tools.