# HG changeset patch # User ebi-gxa # Date 1591895253 14400 # Node ID 54f1212d26acb9bd2bd1c3306e028b5287c66514 # Parent b8eb50bd397c97478a8a7110176d94c81ad74efb "planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/tree/develop/tools/tertiary-analysis/scanpy commit 6806d147bfbb52c61d2a15281b69144fad87250a" diff -r b8eb50bd397c -r 54f1212d26ac anndata_operations.xml --- a/anndata_operations.xml Mon Jun 08 05:08:44 2020 -0400 +++ b/anndata_operations.xml Thu Jun 11 13:07:33 2020 -0400 @@ -1,5 +1,5 @@ - + modifies metadata and flags genes scanpy_macros2.xml @@ -19,6 +19,12 @@ ln -s '${es}' embedding_source_${i}.h5 && #end for #end if + +#if $copy_u.default: +#for $i, $us in enumerate($copy_u.uns_sources): + ln -s '${us}' uns_source_${i}.h5 && +#end for +#end if python $operations ]]> @@ -35,6 +41,9 @@ #for $i, $s in enumerate($modifications) adata.obs['${s.to_obs}'] = adata.obs['${s.from_obs}'] +#if not $s.keep_original: +del adata.obs['${s.from_obs}'] +#end if #end for gene_names = getattr(adata.var, gene_name) @@ -79,6 +88,20 @@ #end for #end if +#if $copy_u.default and len($copy_u.uns_keys) > 0: +#for $i, $uns_s in enumerate($copy_u.uns_sources): +ad_s = sc.read('uns_source_${i}.h5') +if adata.n_obs == ad_s.n_obs and all(adata.obs_names == ad_s.obs_names): + #for $j, $u_key in enumerate($copy_u.uns_keys): + keys_to_copy = (k for k in ad_s.uns.keys() if "${u_key.contains}" in k) + for k_to_copy in keys_to_copy: + adata.uns[k_to_copy+"_${i}"] = 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.") +#end for +#end if + #if $sanitize_varm: if hasattr(adata, 'raw') and hasattr(adata.raw, 'X') and hasattr(adata.raw, 'var'): new_ad = anndata.AnnData(X=adata.raw.X, obs=adata.obs, var=adata.raw.var) @@ -112,6 +135,7 @@ + @@ -122,7 +146,7 @@ - + @@ -141,6 +165,15 @@ + + + + + + + + + @@ -169,6 +202,10 @@ * For the flags created, calculates qc metrics (pct__counts). * Calculates `n_genes`, `n_counts` for cells and `n_cells`, `n_counts` for genes. * For top genes specified, calculate qc metrics (pct_counts_in_top__genes). +* Copy from a set of compatible AnnData objects (same cells and genes): + * Observations, such as clustering results. + * Embeddings, such as tSNE or UMAPs. + * Unstructure annotations, like gene markers. This functionality will probably be added in the future to a larger package. ]]>