# HG changeset patch # User ebi-gxa # Date 1574186414 18000 # Node ID 086d850271a2bb694d372554faae60830303788a planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/tree/develop/tools/tertiary-analysis/scanpy commit 39b0809db1e17c2a24930fe8fb8ceaf3ea454a7d diff -r 000000000000 -r 086d850271a2 anndata_operations.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/anndata_operations.xml Tue Nov 19 13:00:14 2019 -0500 @@ -0,0 +1,102 @@ + + + modifies metadata and flags genes + + scanpy_macros2.xml + + + + + +import scanpy as sc +import logging + +adata = sc.read('input.h5') + +gene_name = '${gene_symbols_field}' +qc_vars = list() + +#for $i, $s in enumerate($modifications) +adata.obs['${s.to_obs}'] = adata.obs['${s.from_obs}'] +#end for + +gene_names = getattr(adata.var, gene_name) + +#for $i, $flag in enumerate($gene_flags) +k_cat = gene_names.str.startswith('${flag.startswith}') +if k_cat.sum() > 0: + adata.var['${flag.flag}'] = k_cat + qc_vars.append('${flag.flag}') +else: + logging.warning('No genes starting with {} found, skip calculating expression of {} genes'.format('${flag.startswith}', '${flag.flag}')) +#end for + + +if len(qc_vars) > 0: + pct_top = [${top_genes}] + sc.pp.calculate_qc_metrics(adata, qc_vars=qc_vars, percent_top=pct_top, inplace=True) + +if 'n_genes' not in adata.obs.columns: + sc.pp.filter_cells(adata, min_genes=0) +if 'n_counts' not in adata.obs.columns: + sc.pp.filter_cells(adata, min_counts=0) +if 'n_cells' not in adata.var.columns: + sc.pp.filter_genes(adata, min_cells=0) +if 'n_counts' not in adata.var.columns: + sc.pp.filter_genes(adata, min_counts=0) + +adata.write('output.h5', compression='gzip') + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _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). + +This functionality will probably be added in the future to a larger package. +]]> + + diff -r 000000000000 -r 086d850271a2 scanpy_macros.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scanpy_macros.xml Tue Nov 19 13:00:14 2019 -0500 @@ -0,0 +1,109 @@ + + 1.3.2 + More information can be found at https://scanpy.readthedocs.io + +#if $do_plotting.plot + -P output.png + --projectio $do_plotting.projection + --components $do_plotting.components + #if $do_plotting.color_by + --color-by $do_plotting.color_by + #end if + #if $do_plotting.groups + --group $do_plotting.groups + #end if + #if $do_plotting.use_raw + --use-raw + #end if + #if $do_plotting.palette + --palette $do_plotting.palette + #end if + #if $do_plotting.edges + --edges + #end if + #if $do_plotting.arrows + --arrows + #end if + #if not $do_plotting.sort_order + --no-sort-order + #end if + #if $do_plotting.frameoff + --frameoff + #end if +#end if + + + + scanpy-scripts + + + + + ${export_mtx} + + + + + 10.1186/s13059-017-1382-0 + + @misc{githubscanpy-scripts, + author = {Ni Huang, EBI Gene Expression Team}, + year = {2018}, + title = {Scanpy-scripts: command line interface for Scanpy}, + publisher = {GitHub}, + journal = {GitHub repository}, + url = {https://github.com/ebi-gene-expression-group/scanpy-scripts}, + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + export_mtx + + + export_mtx + + + export_mtx + + + diff -r 000000000000 -r 086d850271a2 scanpy_macros2.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scanpy_macros2.xml Tue Nov 19 13:00:14 2019 -0500 @@ -0,0 +1,96 @@ + + 1.4.3 + More information can be found at https://scanpy.readthedocs.io + =1.4.2). + +1.3.2+galaxy1: Normalise-data and filter-genes: Exposes ability to output 10x files. + +1.3.2+galaxy0: Initial contribution. Ni Huang and Pablo Moreno, Expression Atlas team https://www.ebi.ac.uk/gxa/home at +EMBL-EBI https://www.ebi.ac.uk/ and Teichmann Lab at Wellcome Sanger Institute. + ]]> + + --input-format '${input_format}' input.h5 + + + --show-obj stdout --output-format '${output_format}' output.h5 + + +#if $fig_title + --title '${fig_title}' +#end if + --fig-size '${fig_size}' + --fig-dpi ${fig_dpi} + --fig-fontsize ${fig_fontsize} + ${fig_frame} + ./output.png + + ${export_mtx} + + + + scanpy-scripts + + + + + + + + 10.1186/s13059-017-1382-0 + + @misc{githubscanpy-scripts, + author = {Ni Huang, EBI Gene Expression Team}, + year = {2018}, + title = {Scanpy-scripts: command line interface for Scanpy}, + publisher = {GitHub}, + journal = {GitHub repository}, + url = {https://github.com/ebi-gene-expression-group/scanpy-scripts}, + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + export_mtx + + + export_mtx + + + export_mtx + + +