view plotting.xml @ 6:1ac4a5f05f33 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/snapatac2 commit e0f59fae19e57f54ae0c351a16dd1805d12aba1d
author iuc
date Tue, 25 Nov 2025 16:41:12 +0000
parents 05bd4db20227
children
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>
    <expand macro="xrefs"/>
    <requirements>
        <expand macro="requirements"/>
    </requirements>
    <command detect_errors="exit_code"><![CDATA[
@CMD_PREP_ADATA@
@CMD@
    ]]></command>
    <configfiles>
        <configfile name="script_file"><![CDATA[
@CONF_IMPORTS@
@CONF_READ_INPUTS@

#if $method.method == 'pl.frag_size_distr'
    #if $method.log_scale
fig = snap.pl.frag_size_distr(adata, show=False)
fig.update_yaxes(type="log")
snap.pl.render_plot(fig, @CONF_PARAMS_RENDER_PLOT@)
    #else
snap.pl.frag_size_distr(adata, @CONF_PARAMS_RENDER_PLOT@)
    #end if

#else if $method.method == 'pl.tsse'
snap.pl.tsse(
    adata,
    min_fragment = $method.min_fragment,
    @CONF_PARAMS_RENDER_PLOT@
)
#else if $method.method == 'pl.umap'
snap.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
    @CONF_PARAMS_RENDER_PLOT@
)

#else if $method.method == 'pl.spectral_eigenvalues'
snap.pl.spectral_eigenvalues(
    adata,
    @CONF_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="param_inputs_anndata"/>
                <param argument="use_rep" type="text" value="frag_size_distr" label="Use the indicated representation in .obsm"/>
                <param name="log_scale" type="boolean" checked="False" label="Change the y-axis (fragment counts) to log scale"/>
                <expand macro="param_render_plot"/>
            </when>
            <when value="pl.tsse">
                <expand macro="param_inputs_anndata"/>
                <param argument="min_fragment" type="integer" value="500" label="Minimum number of unique fragments"/>
                <expand macro="param_render_plot"/>
            </when>
            <when value="pl.umap">
                <expand macro="param_inputs_anndata"/>
                <param argument="color" type="text" value="" optional="true" label="Color" help="Color to use for the points. retrieved from .obs"/>
                <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="Opacity of the dots"/>
                <param argument="sample_size" type="integer" value="" optional="true" label="Number of cells to use"/>
                <expand macro="param_render_plot"/>
            </when>
            <when value="pl.spectral_eigenvalues">
                <expand macro="param_inputs_anndata"/>
                <expand macro="param_render_plot"/>
            </when>
        </conditional>
        <expand macro="param_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="out_html" format="html" from_work_dir="plot.html" label="HTML plot from ${tool.name} (${method.method}) on ${on_string}">
            <filter>method['out_file'] == 'html'</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/17512085/files/pp.import_data.pbmc_500_chr21.h5ad"/>
                <param name="log_scale" value="True"/>
                <param name="out_file" value="pdf"/>
                <expand macro="test_param_render_plot"/>
            </conditional>
            <section name="advanced_common">
                <param name="show_log" value="true"/>
            </section>
            <output name="out_pdf" location="https://zenodo.org/records/17512085/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="snap.pl.frag_size_distr"/>
                    <has_text_matching expression="fig.update_yaxes"/>
                    <expand macro="test_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/17512085/files/metrics.tsse.pbmc_500_chr21.h5ad"/>
                <param name="min_fragment" value="500"/>
                <param name="out_file" value="png"/>
                <expand macro="test_param_render_plot"/>
            </conditional>
            <section name="advanced_common">
                <param name="show_log" value="true"/>
            </section>
            <output name="hidden_output">
                <assert_contents>
                    <has_text_matching expression="snap.pl.tsse"/>
                    <has_text_matching expression="min_fragment = 500"/>
                    <expand macro="test_render_plot_matching_text"/>
                </assert_contents>
            </output>
            <output name="out_png">
                <assert_contents>
                    <has_image_center_of_mass center_of_mass="325,223" eps="30"/>
                    <has_image_channels channels="4"/>
                    <has_image_height height="450"/>
                    <has_image_width width="650"/>
                </assert_contents>
            </output>
        </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/17512085/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="test_param_render_plot"/>
                <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="snap.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="test_render_plot_matching_text"/>
                </assert_contents>
            </output>
            <output name="out_svg" location="https://zenodo.org/records/17512085/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/17512085/files/tl.spectral.pbmc_500_chr21.h5ad"/>
                <expand macro="test_param_render_plot"/>
                <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="snap.pl.spectral_eigenvalues"/>
                    <expand macro="test_render_plot_matching_text"/>
                </assert_contents>
            </output>
            <output name="out_pdf" location="https://zenodo.org/records/17512085/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://scverse.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://scverse.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://scverse.org/SnapATAC2/api/_autosummary/snapatac2.pl.spectral_eigenvalues.html>`__
    ]]></help>
    <expand macro="citations"/>
</tool>