# HG changeset patch # User ebi-gxa # Date 1620216947 0 # Node ID 53a251c6d991046912452b2832a905841f8ec001 # Parent e4bb4666449e77bd15af28f3ae7ed45667b6608d "planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/tree/develop/tools/tertiary-analysis/scanpy commit ebe77c8718ec65277f4dc0d71fa5f4c5677df62d-dirty" diff -r e4bb4666449e -r 53a251c6d991 anndata_operations.xml --- a/anndata_operations.xml Mon Apr 12 14:40:23 2021 +0000 +++ b/anndata_operations.xml Wed May 05 12:15:47 2021 +0000 @@ -8,6 +8,22 @@ 0: +#for $i, $x_s in enumerate($copy_x.xlayers): +ad_s = sc.read('x_source_${i}.h5') +if adata.n_obs == ad_s.n_obs and all(adata.obs_names == ad_s.obs_names): + #set xs=$copy_x.xlayers[$i] + if "${xs.dest}" == '': + logging.error("%sth destination layer for %sth X source not specified" % ("${i}", "${i}")) + sys.exit(1) + adata.layers["${xs.dest}"] = ad_s.X +else: + logging.error("X source ${i} AnnData file is not compatible to be merged to main AnnData file, different cell names.") + sys.exit(1) +del ad_s +#end for +#end if + +#if $copy_l.default and len($copy_l.layers) > 0: +#for $i, $layer_s in enumerate($copy_l.layer_sources): +ad_s = sc.read('layer_source_${i}.h5') +if adata.n_obs == ad_s.n_obs and all(adata.obs_names == ad_s.obs_names): + #for $j, $l_key in enumerate($copy_l.layers): + layers_to_copy = (k for k in ad_s.layers.keys() if "${l_key.contains}" in k) + for l_to_copy in layers_to_copy: + suffix='' + if l_to_copy in adata.layers: + suffix = "_${i}" + + adata.layers[l_to_copy+suffix] = ad_s.layers[l_to_copy] + #end for +else: + logging.error("Layer source ${i} AnnData file is not compatible to be merged to main AnnData file, different cell names.") + sys.exit(1) +del ad_s +#end for +#end if + #if $copy_o.default and len($copy_o.obs_keys) > 0: #for $i, $obs_s in enumerate($copy_o.obs_sources): ad_s = sc.read('obs_source_${i}.h5') @@ -77,7 +139,9 @@ adata.uns[k_to_copy+suffix] = ad_s.uns[k_to_copy] #end for else: - logging.warning("Observation source ${i} AnnData file is not compatible to be merged to main AnnData file, different cell names.") + logging.error("Observation source ${i} AnnData file is not compatible to be merged to main AnnData file, different cell names.") + sys.exit(1) +del ad_s #end for #end if @@ -95,7 +159,9 @@ adata.obsm[k_to_copy+suffix] = ad_s.obsm[k_to_copy] #end for else: - logging.warning("Embedding source ${i} AnnData file is not compatible to be merged to main AnnData file, different cell names.") + logging.error("Embedding source ${i} AnnData file is not compatible to be merged to main AnnData file, different cell names.") + sys.exit(1) +del ad_s #end for #end if @@ -112,7 +178,9 @@ adata.uns[k_to_copy+suffix] = ad_s.uns[k_to_copy] #end for else: - logging.warning("Uns source ${i} AnnData file is not compatible to be merged to main AnnData file, different cell names.") + logging.error("Uns source ${i} AnnData file is not compatible to be merged to main AnnData file, different cell names.") + sys.exit(1) +del ad_s #end for #end if @@ -158,6 +226,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -203,6 +298,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + --input-format '${input_format}' input.h5 + + #if $save_raw + --save-raw + #end if + #if $save_layer + --save-layer ${settings.save_layer} + #end if + #if str($output_format).startswith('anndata') --show-obj stdout --output-format anndata output.h5 @@ -51,7 +59,7 @@ - scanpy-scripts + scanpy-scripts @@ -122,6 +130,13 @@ + + + + +