Mercurial > repos > iuc > scanpy_cluster_reduce_dimension
changeset 6:77b91b9bdf52 draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/scanpy/ commit 5a90fd345b43ca12366f4475f4cfd88ef197e452"
author | iuc |
---|---|
date | Thu, 20 Feb 2020 08:23:29 -0500 |
parents | 6f2d2c7f77ee |
children | b2df381a6004 |
files | cluster_reduce_dimension.xml macros.xml |
diffstat | 2 files changed, 163 insertions(+), 95 deletions(-) [+] |
line wrap: on
line diff
--- a/cluster_reduce_dimension.xml Mon Feb 10 05:27:02 2020 -0500 +++ b/cluster_reduce_dimension.xml Thu Feb 20 08:23:29 2020 -0500 @@ -276,13 +276,14 @@ </param> </when> </conditional> + <expand macro="inputs_common_advanced"/> </inputs> <outputs> <expand macro="anndata_outputs"/> </outputs> <tests> <test> - <!-- test 1 --> + <!-- test 0 --> <param name="adata" value="pp.neighbors_gauss_braycurtis.recipe_weinreb17.paul15_subsample.h5ad" /> <conditional name="method"> <param name="method" value="tl.louvain"/> @@ -295,20 +296,25 @@ <param name="directed" value="true"/> <param name="use_weights" value="false"/> </conditional> - <assert_stdout> - <has_text_matching expression="sc.tl.louvain"/> - <has_text_matching expression="adata=adata"/> - <has_text_matching expression="flavor = 'vtraag'"/> - <has_text_matching expression="resolution=1.0"/> - <has_text_matching expression="random_state=10"/> - <has_text_matching expression="key_added='louvain'"/> - <has_text_matching expression="directed=True"/> - <has_text_matching expression="use_weights=False"/> - </assert_stdout> + <section name="advanced_common"> + <param name="show_log" value="true" /> + </section> + <output name="hidden_output"> + <assert_contents> + <has_text_matching expression="sc.tl.louvain"/> + <has_text_matching expression="adata=adata"/> + <has_text_matching expression="flavor = 'vtraag'"/> + <has_text_matching expression="resolution=1.0"/> + <has_text_matching expression="random_state=10"/> + <has_text_matching expression="key_added='louvain'"/> + <has_text_matching expression="directed=True"/> + <has_text_matching expression="use_weights=False"/> + </assert_contents> + </output> <output name="anndata_out" file="tl.louvain.neighbors_gauss_braycurtis.recipe_weinreb17.paul15_subsample.h5ad" ftype="h5ad" compare="sim_size"/> </test> <test> - <!-- test 2 --> + <!-- test 1 --> <param name="adata" value="pp.neighbors_gauss_braycurtis.recipe_weinreb17.paul15_subsample.h5ad" /> <conditional name="method"> <param name="method" value="tl.leiden"/> @@ -318,18 +324,23 @@ <param name="use_weights" value="false"/> <param name="n_iterations" value="-1"/> </conditional> - <assert_stdout> - <has_text_matching expression="sc.tl.leiden"/> - <has_text_matching expression="resolution=1"/> - <has_text_matching expression="random_state=10"/> - <has_text_matching expression="key_added='leiden'"/> - <has_text_matching expression="use_weights=False"/> - <has_text_matching expression="n_iterations=-1"/> - </assert_stdout> + <section name="advanced_common"> + <param name="show_log" value="true" /> + </section> + <output name="hidden_output"> + <assert_contents> + <has_text_matching expression="sc.tl.leiden"/> + <has_text_matching expression="resolution=1"/> + <has_text_matching expression="random_state=10"/> + <has_text_matching expression="key_added='leiden'"/> + <has_text_matching expression="use_weights=False"/> + <has_text_matching expression="n_iterations=-1"/> + </assert_contents> + </output> <output name="anndata_out" file="tl.leiden.neighbors_gauss_braycurtis.recipe_weinreb17.paul15_subsample.h5ad" ftype="h5ad" compare="sim_size"/> </test> <test> - <!-- test 2 --> + <!-- test 1 --> <param name="adata" value="krumsiek11.h5ad" /> <conditional name="method"> <param name="method" value="pp.pca"/> @@ -343,17 +354,22 @@ </conditional> <param name="use_highly_variable" value="false"/> </conditional> - <assert_stdout> - <has_text_matching expression="sc.pp.pca"/> - <has_text_matching expression="n_comps=50"/> - <has_text_matching expression="dtype='float32'"/> - <has_text_matching expression="copy=False"/> - <has_text_matching expression="chunked=False"/> - <has_text_matching expression="zero_center=True"/> - <has_text_matching expression="svd_solver='auto'"/> - <has_text_matching expression="random_state=0"/> - <has_text_matching expression="use_highly_variable=False"/> - </assert_stdout> + <section name="advanced_common"> + <param name="show_log" value="true" /> + </section> + <output name="hidden_output"> + <assert_contents> + <has_text_matching expression="sc.pp.pca"/> + <has_text_matching expression="n_comps=50"/> + <has_text_matching expression="dtype='float32'"/> + <has_text_matching expression="copy=False"/> + <has_text_matching expression="chunked=False"/> + <has_text_matching expression="zero_center=True"/> + <has_text_matching expression="svd_solver='auto'"/> + <has_text_matching expression="random_state=0"/> + <has_text_matching expression="use_highly_variable=False"/> + </assert_contents> + </output> <output name="anndata_out" file="pp.pca.krumsiek11.h5ad" ftype="h5ad" compare="sim_size"/> </test> <!--<test> @@ -383,7 +399,7 @@ </test> --> <test> - <!-- test 3 --> + <!-- test 2 --> <param name="adata" value="krumsiek11.h5ad" /> <conditional name="method"> <param name="method" value="tl.pca"/> @@ -397,33 +413,43 @@ </conditional> <param name="use_highly_variable" value="false"/> </conditional> - <assert_stdout> - <has_text_matching expression="sc.tl.pca"/> - <has_text_matching expression="n_comps=50"/> - <has_text_matching expression="dtype='float32'"/> - <has_text_matching expression="copy=False"/> - <has_text_matching expression="chunked=False"/> - <has_text_matching expression="zero_center=True"/> - <has_text_matching expression="svd_solver='auto'"/> - <has_text_matching expression="use_highly_variable=False"/> - </assert_stdout> + <section name="advanced_common"> + <param name="show_log" value="true" /> + </section> + <output name="hidden_output"> + <assert_contents> + <has_text_matching expression="sc.tl.pca"/> + <has_text_matching expression="n_comps=50"/> + <has_text_matching expression="dtype='float32'"/> + <has_text_matching expression="copy=False"/> + <has_text_matching expression="chunked=False"/> + <has_text_matching expression="zero_center=True"/> + <has_text_matching expression="svd_solver='auto'"/> + <has_text_matching expression="use_highly_variable=False"/> + </assert_contents> + </output> <output name="anndata_out" file="tl.pca.krumsiek11.h5ad" ftype="h5ad" compare="sim_size"/> </test> <test> - <!-- test 4 --> + <!-- test 3 --> <param name="adata" value="pp.neighbors_gauss_braycurtis.recipe_weinreb17.paul15_subsample.h5ad" /> <conditional name="method"> <param name="method" value="tl.diffmap"/> <param name="n_comps" value="15"/> </conditional> - <assert_stdout> - <has_text_matching expression="sc.tl.diffmap"/> - <has_text_matching expression="n_comps=15"/> - </assert_stdout> + <section name="advanced_common"> + <param name="show_log" value="true" /> + </section> + <output name="hidden_output"> + <assert_contents> + <has_text_matching expression="sc.tl.diffmap"/> + <has_text_matching expression="n_comps=15"/> + </assert_contents> + </output> <output name="anndata_out" file="tl.diffmap.neighbors_gauss_braycurtis.recipe_weinreb17.paul15_subsample.h5ad" ftype="h5ad" compare="sim_size"/> </test> <test> - <!-- test 5 --> + <!-- test 4 --> <param name="adata" value="krumsiek11.h5ad" /> <conditional name="method"> <param name="method" value="tl.tsne"/> @@ -434,19 +460,24 @@ <param name="random_state" value="0"/> <param name="use_fast_tsne" value="true"/> </conditional> - <assert_stdout> - <has_text_matching expression="sc.tl.tsne"/> - <has_text_matching expression="n_pcs=10"/> - <has_text_matching expression="perplexity=30.0"/> - <has_text_matching expression="early_exaggeration=12.0"/> - <has_text_matching expression="learning_rate=1000.0"/> - <has_text_matching expression="random_state=0"/> - <has_text_matching expression="use_fast_tsne=True"/> - </assert_stdout> + <section name="advanced_common"> + <param name="show_log" value="true" /> + </section> + <output name="hidden_output"> + <assert_contents> + <has_text_matching expression="sc.tl.tsne"/> + <has_text_matching expression="n_pcs=10"/> + <has_text_matching expression="perplexity=30.0"/> + <has_text_matching expression="early_exaggeration=12.0"/> + <has_text_matching expression="learning_rate=1000.0"/> + <has_text_matching expression="random_state=0"/> + <has_text_matching expression="use_fast_tsne=True"/> + </assert_contents> + </output> <output name="anndata_out" file="tl.tsne.krumsiek11.h5ad" ftype="h5ad" compare="sim_size"/> </test> <test> - <!-- test 6 --> + <!-- test 5 --> <param name="adata" value="pp.neighbors_umap_euclidean.recipe_weinreb17.paul15_subsample.h5ad" /> <conditional name="method"> <param name="method" value="tl.umap"/> @@ -460,18 +491,23 @@ <param name="init_pos" value="spectral"/> <param name="random_state" value="0"/> </conditional> - <assert_stdout> - <has_text_matching expression="sc.tl.umap"/> - <has_text_matching expression="min_dist=0.5"/> - <has_text_matching expression="spread=1.0"/> - <has_text_matching expression="n_components=2"/> - <has_text_matching expression="maxiter=2"/> - <has_text_matching expression="alpha=1.0"/> - <has_text_matching expression="gamma=1.0"/> - <has_text_matching expression="negative_sample_rate=5"/> - <has_text_matching expression="init_pos='spectral'"/> - <has_text_matching expression="random_state=0"/> - </assert_stdout> + <section name="advanced_common"> + <param name="show_log" value="true" /> + </section> + <output name="hidden_output"> + <assert_contents> + <has_text_matching expression="sc.tl.umap"/> + <has_text_matching expression="min_dist=0.5"/> + <has_text_matching expression="spread=1.0"/> + <has_text_matching expression="n_components=2"/> + <has_text_matching expression="maxiter=2"/> + <has_text_matching expression="alpha=1.0"/> + <has_text_matching expression="gamma=1.0"/> + <has_text_matching expression="negative_sample_rate=5"/> + <has_text_matching expression="init_pos='spectral'"/> + <has_text_matching expression="random_state=0"/> + </assert_contents> + </output> <output name="anndata_out" file="tl.umap.neighbors_umap_euclidean.recipe_weinreb17.paul15_subsample.h5ad" ftype="h5ad" compare="sim_size"> <assert_contents> <has_h5_keys keys="X, obs, obsm, uns, var" /> @@ -479,22 +515,27 @@ </output> </test> <test> - <!-- test 7 --> + <!-- test 6 --> <param name="adata" value="pp.neighbors_umap_euclidean.recipe_weinreb17.paul15_subsample.h5ad"/> <conditional name="method"> <param name="method" value="tl.draw_graph"/> <param name="layout" value="fa"/> <param name="random_state" value="0"/> </conditional> - <assert_stdout> - <has_text_matching expression="sc.tl.draw_graph"/> - <has_text_matching expression="layout='fa'"/> - <has_text_matching expression="random_state=0"/> - </assert_stdout> + <section name="advanced_common"> + <param name="show_log" value="true" /> + </section> + <output name="hidden_output"> + <assert_contents> + <has_text_matching expression="sc.tl.draw_graph"/> + <has_text_matching expression="layout='fa'"/> + <has_text_matching expression="random_state=0"/> + </assert_contents> + </output> <output name="anndata_out" file="tl.draw_graph.pp.neighbors_umap_euclidean.recipe_weinreb17.paul15_subsample.h5ad" ftype="h5ad" compare="sim_size"/> </test> <test> - <!-- test 8 --> + <!-- test 7 --> <param name="adata" value="pp.neighbors_gauss_braycurtis.recipe_weinreb17.paul15_subsample.h5ad"/> <conditional name="method"> <param name="method" value="tl.paga"/> @@ -502,16 +543,21 @@ <param name="use_rna_velocity" value="False"/> <param name="model" value="v1.2"/> </conditional> - <assert_stdout> - <has_text_matching expression="sc.tl.paga"/> - <has_text_matching expression="groups='paul15_clusters'"/> - <has_text_matching expression="use_rna_velocity=False"/> - <has_text_matching expression="model='v1.2'"/> - </assert_stdout> + <section name="advanced_common"> + <param name="show_log" value="true" /> + </section> + <output name="hidden_output"> + <assert_contents> + <has_text_matching expression="sc.tl.paga"/> + <has_text_matching expression="groups='paul15_clusters'"/> + <has_text_matching expression="use_rna_velocity=False"/> + <has_text_matching expression="model='v1.2'"/> + </assert_contents> + </output> <output name="anndata_out" file="tl.paga.neighbors_gauss_braycurtis.recipe_weinreb17.paul15_subsample.h5ad" ftype="h5ad" compare="sim_size"/> </test> <test> - <!-- test 9 --> + <!-- test 8 --> <param name="adata" value="tl.diffmap.neighbors_gauss_braycurtis.recipe_weinreb17.paul15_subsample.h5ad" /> <conditional name="method"> <param name="method" value="tl.dpt"/> @@ -520,13 +566,18 @@ <param name="min_group_size" value="0.01"/> <param name="allow_kendall_tau_shift" value="True"/> </conditional> - <assert_stdout> - <has_text_matching expression="sc.tl.dpt"/> - <has_text_matching expression="n_dcs=15"/> - <has_text_matching expression="n_branchings=1"/> - <has_text_matching expression="min_group_size=0.01"/> - <has_text_matching expression="allow_kendall_tau_shift=True"/> - </assert_stdout> + <section name="advanced_common"> + <param name="show_log" value="true" /> + </section> + <output name="hidden_output"> + <assert_contents> + <has_text_matching expression="sc.tl.dpt"/> + <has_text_matching expression="n_dcs=15"/> + <has_text_matching expression="n_branchings=1"/> + <has_text_matching expression="min_group_size=0.01"/> + <has_text_matching expression="allow_kendall_tau_shift=True"/> + </assert_contents> + </output> <output name="anndata_out" file="tl.dpt.diffmap.neighbors_gauss_braycurtis.recipe_weinreb17.paul15_subsample.h5ad" ftype="h5ad" compare="sim_size"/> </test> </tests>
--- a/macros.xml Mon Feb 10 05:27:02 2020 -0500 +++ b/macros.xml Thu Feb 20 08:23:29 2020 -0500 @@ -21,12 +21,17 @@ </xml> <token name="@CMD@"><![CDATA[ cp '$adata' 'anndata.h5ad' && -cat '$script_file' && -python '$script_file' && -ls . +cat '$script_file' > '$hidden_output' && +python '$script_file' >> '$hidden_output' && +ls . >> '$hidden_output' && +touch 'anndata_info.txt' && +cat 'anndata_info.txt' @CMD_prettify_stdout@ ]]> </token> <token name="@CMD_imports@"><![CDATA[ +import sys +sys.stderr = open('$hidden_output', 'a') + import scanpy as sc import pandas as pd import numpy as np @@ -39,13 +44,25 @@ adata = sc.read('anndata.h5ad') ]]> </token> + <xml name="inputs_common_advanced"> + <section name="advanced_common" title="Advanced Options" expanded="false"> + <param name="show_log" type="boolean" checked="false" label="Output Log?" /> + </section> + </xml> <xml name="anndata_outputs"> <data name="anndata_out" format="h5ad" from_work_dir="anndata.h5ad" label="${tool.name} (${method.method}) on ${on_string}: Annotated data matrix"/> + <data name="hidden_output" format="txt" label="Log file" > + <filter>advanced_common['show_log']</filter> + </data> </xml> <token name="@CMD_anndata_write_outputs@"><![CDATA[ adata.write('anndata.h5ad') +with open('anndata_info.txt','w', encoding='utf-8') as ainfo: + print(adata, file=ainfo) ]]> </token> + <token name="@CMD_prettify_stdout@"><![CDATA[ | sed -r '1 s|AnnData object with (.+) = (.*)\s*|\1: \2|g' | sed "s|'||g" | sed -r 's|^\s*(.*):\s(.*)|[\1]\n- \2|g' | sed 's|, |\n- |g' + ]]></token> <xml name="svd_solver"> <param name="svd_solver" type="select" label="SVD solver to use" help=""> <option value="auto">Automatically chosen depending on the size of the problem</option>