view plotting.xml @ 2:c01f0a08ab43 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snapatac2 commit df9c285dddde7d901823c608c8d7dab971224b5b
author iuc
date Fri, 05 Jul 2024 11:05:58 +0000
parents fecf9664c885
children 05bd4db20227
line wrap: on
line source

<tool id="snapatac2_plotting" name="SnapATAC2 Plotting" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
    <macros>
        <import>macros.xml</import>
    </macros>
    <requirements>
        <expand macro="requirements"/>
    </requirements>
    <command detect_errors="exit_code"><![CDATA[
@PREP_ADATA@
@CMD@
    ]]></command>
    <configfiles>
        <configfile name="script_file"><![CDATA[
@CMD_imports@
@CMD_read_inputs@

#if $method.method == 'pl.frag_size_distr'
    #if $method.log_scale
fig = sa.pl.frag_size_distr(adata, show=False)
fig.update_yaxes(type="log")
sa.pl.render_plot(fig, @CMD_params_render_plot@)
    #else
sa.pl.frag_size_distr(adata, @CMD_params_render_plot@)
    #end if
#else if $method.method == 'pl.tsse'
sa.pl.tsse(
    adata,
    min_fragment = $method.min_fragment,
    @CMD_params_render_plot@
)
#else if $method.method == 'pl.umap'
sa.pl.umap(
    adata,
    color = '$method.color',
    use_rep = '$method.use_rep',
    #if $method.marker_size
    marker_size = $method.marker_size,
    #end if
    marker_opacity = $method.marker_opacity,
    #if $method.sample_size
    sample_size = $method.sample_size,
    #end if
    @CMD_params_render_plot@
)
#else if $method.method == 'pl.regions'
sa.pl.regions(
    adata,
    groupby = '$method.groupby',
    peaks = '$method.peaks',
    @CMD_params_render_plot@
)
#else if $method.method == 'pl.spectral_eigenvalues'
sa.pl.spectral_eigenvalues(
    adata,
    @CMD_params_render_plot@
)
#end if
    ]]></configfile>
    </configfiles>
    <inputs>
        <conditional name="method">
            <param name="method" type="select" label="Method used for plotting">
                <option value="pl.frag_size_distr">Plot fragment size distribution, using 'pl.frag_size_distr'</option>
                <option value="pl.tsse">Plot the TSS enrichment vs. number of fragments density figure, using 'pl.tsse'</option>
                <option value="pl.umap">Plot the UMAP embedding, using 'pl.umap'</option>
                <option value="pl.spectral_eigenvalues">Plot the eigenvalues of spectral embedding, using 'pl.spectral_eigenvalues'</option>
            </param>
            <when value="pl.frag_size_distr">
                <expand macro="inputs_anndata"/>
                <param name="log_scale" type="boolean" checked="False" label="Change the y-axis (fragment counts) to log scale"/>
                <expand macro="params_render_plot"/>
            </when>
            <when value="pl.tsse">
                <expand macro="inputs_anndata"/>
                <param argument="min_fragment" type="integer" value="500" label="Minimum number of unique fragments"/>
                <expand macro="params_render_plot"/>
            </when>
            <when value="pl.umap">
                <expand macro="inputs_anndata"/>
                <param argument="color" type="text" value="" optional="true" label="Color"/>
                <param argument="use_rep" type="text" value="X_umap" label="Use the indicated representation in .obsm"/>
                <param argument="marker_size" type="float" value="" optional="true" label="Size of the dots"/>
                <param argument="marker_opacity" type="float" value="1" label="Opactiy of the dots"/>
                <param argument="sample_size" type="integer" value="" optional="true" label="Number of cells to use"/>
                <expand macro="params_render_plot"/>
            </when>
            <when value="pl.spectral_eigenvalues">
                <expand macro="inputs_anndata"/>
                <expand macro="params_render_plot"/>
            </when>
        </conditional>
        <expand macro="inputs_common_advanced"/>
    </inputs>
    <outputs>
        <data name="out_png" format="png" from_work_dir="plot.png" label="PNG plot from ${tool.name} (${method.method}) on ${on_string}">
            <filter>method['out_file'] == 'png'</filter>
        </data>
        <data name="out_pdf" format="pdf" from_work_dir="plot.pdf" label="PDF plot from ${tool.name} (${method.method}) on ${on_string}">
            <filter>method['out_file'] == 'pdf'</filter>
        </data>
        <data name="out_svg" format="svg" from_work_dir="plot.svg" label="SVG plot from ${tool.name} (${method.method}) on ${on_string}">
            <filter>method['out_file'] == 'svg'</filter>
        </data>
        <data name="hidden_output" format="txt" label="Log file" hidden="true">
            <filter>advanced_common['show_log']</filter>
        </data>
    </outputs>
    <tests>
        <test expect_num_outputs="2">
            <!-- pl.frag_size_distr -->
            <conditional name="method">
                <param name="method" value="pl.frag_size_distr"/>
                <param name="adata" location="https://zenodo.org/records/11260316/files/pp.import_data.pbmc_500_chr21.h5ad"/>
                <param name="log_scale" value="True"/>
                <param name="out_file" value="pdf"/>
                <expand macro="render_plot_test"/>
            </conditional>
            <section name="advanced_common">
                <param name="show_log" value="true"/>
            </section>
            <output name="out_pdf" location="https://zenodo.org/records/11260316/files/pl.frag_size_distr.pdf" ftype="pdf" compare="sim_size" delta_frac="0.1"/>
            <output name="hidden_output">
                <assert_contents>
                    <has_text_matching expression="sa.pl.frag_size_distr"/>
                    <has_text_matching expression="fig.update_yaxes"/>
                    <expand macro="render_plot_matching_text"/>
                </assert_contents>
            </output>
        </test>
        <test expect_num_outputs="2">
            <!-- pl.tsse -->
            <conditional name="method">
                <param name="method" value="pl.tsse"/>
                <param name="adata" location="https://zenodo.org/records/11260316/files/metrics.tsse.pbmc_500_chr21.h5ad"/>
                <param name="min_fragment" value="500"/>
                <param name="out_file" value="png"/>
                <expand macro="render_plot_test"/>
            </conditional>
            <section name="advanced_common">
                <param name="show_log" value="true"/>
            </section>
            <output name="hidden_output">
                <assert_contents>
                    <has_text_matching expression="sa.pl.tsse"/>
                    <has_text_matching expression="min_fragment = 500"/>
                    <expand macro="render_plot_matching_text"/>
                </assert_contents>
            </output>
            <output name="out_png" location="https://zenodo.org/records/11260316/files/pl.tsse.png" ftype="png" compare="sim_size" delta_frac="0.1"/>
        </test>
        <test expect_num_outputs="2">
            <!-- pl.umap -->
            <conditional name="method">
                <param name="method" value="pl.umap"/>
                <param name="adata" ftype="h5ad" location="https://zenodo.org/records/11260316/files/tl.leiden.modularity.pbmc_500_chr21.h5ad"/>
                <param name="color" value="leiden"/>
                <param name="use_rep" value="X_umap"/>
                <param name="marker_size" value="1"/>
                <param name="marker_opacity" value="0.8"/>
                <param name="sample_size" value="100"/>
                <expand macro="render_plot_test"/>
                <param name="out_file" value="svg"/>
            </conditional>
            <section name="advanced_common">
                <param name="show_log" value="true"/>
            </section>
            <output name="hidden_output">
                <assert_contents>
                    <has_text_matching expression="sa.pl.umap"/>
                    <has_text_matching expression="color = 'leiden'"/>
                    <has_text_matching expression="use_rep = 'X_umap'"/>
                    <has_text_matching expression="marker_size = 1"/>
                    <has_text_matching expression="marker_opacity = 0.8"/>
                    <has_text_matching expression="sample_size = 100"/>
                    <expand macro="render_plot_matching_text"/>
                </assert_contents>
            </output>
            <output name="out_svg" location="https://zenodo.org/records/11260316/files/pl.umap.svg" ftype="svg" compare="sim_size" delta_frac="0.1"/>
        </test>
        <test expect_num_outputs="2">
            <!-- pl.spectral_eigenvalues -->
            <conditional name="method">
                <param name="method" value="pl.spectral_eigenvalues"/>
                <param name="adata" ftype="h5ad" location="https://zenodo.org/records/11260316/files/tl.spectral.pbmc_500_chr21.h5ad"/>
                <expand macro="render_plot_test"/>
                <param name="out_file" value="pdf"/>
            </conditional>
            <section name="advanced_common">
                <param name="show_log" value="true"/>
            </section>
            <output name="hidden_output">
                <assert_contents>
                    <has_text_matching expression="sa.pl.spectral_eigenvalues"/>
                    <expand macro="render_plot_matching_text"/>
                </assert_contents>
            </output>
            <output name="out_pdf" location="https://zenodo.org/records/11260316/files/pl.spectral_eigenvalues.pdf" ftype="pdf" compare="sim_size" delta_frac="0.1"/>
        </test>
    </tests>
    <help><![CDATA[
Plot fragment size distribution, using `pl.frag_size_distr`
===========================================================

Plot fragment size distribution.

`metrics.frag_size_distr` must be ran first in order to use this function.

Plot the TSS enrichment vs. number of fragments density figure, using `pl.tsse`
===============================================================================

Plot the TSS enrichment vs. number of fragments density figure.

More details on the `SnapATAC2 documentation
<https://kzhang.org/SnapATAC2/api/_autosummary/snapatac2.pl.tsse.html>`__

Plot the UMAP embedding, using `pl.umap`
========================================

Plot the UMAP embedding.

More details on the `SnapATAC2 documentation
<https://kzhang.org/SnapATAC2/api/_autosummary/snapatac2.pl.umap.html>`__

Plot the eigenvalues of spectral embedding, using `pl.spectral_eigenvalues`
===========================================================================

Plot the eigenvalues of spectral embedding.

More details on the `SnapATAC2 documentation
<https://kzhang.org/SnapATAC2/api/_autosummary/snapatac2.pl.spectral_eigenvalues.html>`__
    ]]></help>
    <expand macro="citations"/>
</tool>