view larch_lcf.xml @ 5:90a69f15ab92 draft default tip

planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_lcf commit 7f52c8654581d23a2acffc818e0c197cf8e04504
author muon-spectroscopy-computational-project
date Tue, 03 Sep 2024 11:51:40 +0000
parents c2d5bfef5b63
children
line wrap: on
line source

<tool id="larch_lcf" name="Larch LCF" version="@TOOL_VERSION@+galaxy@WRAPPER_VERSION@" python_template_version="3.5" profile="22.05" license="MIT">
    <description>perform linear combination fit on XAS data</description>
    <macros>
        <!-- version of underlying tool (PEP 440) -->
        <token name="@TOOL_VERSION@">0.9.80</token>
        <!-- version of this tool wrapper (integer) -->
        <token name="@WRAPPER_VERSION@">1</token>
        <!-- citation should be updated with every underlying tool version -->
        <!-- typical fields to update are version, month, year, and doi -->
        <token name="@TOOL_CITATION@">10.1088/1742-6596/430/1/012007</token>
        <import>macros.xml</import>
    </macros>
    <creator>
        <person givenName="Patrick" familyName="Austin" url="https://github.com/patrick-austin" identifier="https://orcid.org/0000-0002-6279-7823"/>
    </creator>
    <requirements>
        <requirement type="package" version="@TOOL_VERSION@">xraylarch</requirement>
        <requirement type="package" version="3.5.2">matplotlib</requirement>
    </requirements>
    <required_files>
        <include type="literal" path="larch_lcf.py"/>
        <include type="literal" path="common.py"/>
    </required_files>
    <command detect_errors="exit_code"><![CDATA[
        mkdir plot &&
        #if $execution.execution=="zipped":
            unzip '$execution.prj_file' &&
            python '${__tool_directory__}/larch_lcf.py' prj '$inputs'
        #else
            python '${__tool_directory__}/larch_lcf.py' '$execution.prj_file' '$inputs'
        #end if
    ]]></command>
    <configfiles>
        <inputs name="inputs" data_style="paths"/>
    </configfiles>
    <inputs>
        <param name="label" type="text" optional="true" label="Main data label" help="The label to use for the main data (target of the fit). If unset, the label will be taken from the Athena project metadata."/>
        <conditional name="execution" >
            <param name="execution" type="select" display="radio" label="Execution mode" help="Whether to execute: on individual Athena projects as parallel jobs, as one job with each project fit occurring in series, or as one job using a zipped input.">
                <option value="parallel" selected="true">Parallel</option>
                <option value="series">Series</option>
                <option value="zipped">Zipped</option>
            </param>
            <when value="parallel">
                <param name="prj_file" type="data" format="prj" label="Athena project file" help="Normalised X-ray Absorption Fine Structure (XAFS) data, in Athena project format. If a collection of files is provided, these will be submitted and executed in parallel."/>
            </when>
            <when value="series">
                <param name="prj_file" type="data" format="prj" multiple="true" label="Athena project files" help="Normalised X-ray Absorption Fine Structure (XAFS) data, in Athena project format. These will be submitted as a single job working in series, enabling transition search."/>
            </when>
            <when value="zipped">
                <param name="prj_file" type="data" format="zip" label="Zipped Athena outputs" help="Normalised X-ray Absorption Fine Structure (XAFS) data, in Athena project format, and zipped. These will be submitted as a single job working in series, enabling transition search."/>
            </when>
        </conditional>
        <repeat name="components" title="Fit components">
            <param name="label" type="text" optional="true" label="Component label" help="The label to use for this component. If unset, the label will be taken from the Athena project metadata."/>
            <param name="component_file" type="data" format="prj" label="Athena project to fit" help="Reference X-ray Absorption Fine Structure (XAFS) data, in Athena project format, to be used as components in the fit."/>
        </repeat>
        <!-- Energy range for LCF -->
        <param name="energy_min" type="float" label="Minimum fit energy (eV)" optional="true" help="If set, only data above this value will be used for the LCF."/>
        <param name="energy_max" type="float" label="Maximum fit energy (eV)" optional="true" help="If set, only data below this value will be used for the LCF."/>
        <!-- Plot limits -->
        <expand macro="plot_limits_energy"/>
    </inputs>
    <outputs>
        <data name="plot" format="png" from_work_dir="plot/plot.png">
            <filter>execution["execution"]=="parallel"</filter>
        </data>
        <collection name="plot_collection" format="png" type="list" label="Larch LCF on series data ${on_string}">
            <discover_datasets pattern="__name_and_ext__" directory="plot"/>
            <filter>execution["execution"]!="parallel"</filter>
        </collection>
    </outputs>
    <tests>
        <!-- 1 -->
        <test expect_num_outputs="1">
            <param name="prj_file" value="PtSn_OCO_Abu_1_29204.5.prj"/>
            <param name="component_file" value="Sn_foil_29200.prj"/>
            <param name="component_file" value="SnO2_29206.prj"/>
            <param name="energy_min" value="29190"/>
            <param name="energy_max" value="29230"/>
            <param name="x_limit_min" value="29190"/>
            <param name="x_limit_max" value="29230"/>
            <output name="plot">
                <assert_contents>
                    <has_size value="61000" delta="1000"/>
                </assert_contents>
            </output>
            <assert_stdout>
                <has_text text="Goodness of fit (rfactor): 0.658596%"/>
            </assert_stdout>
        </test>
        <!-- 2: series -->
        <test expect_num_outputs="1">
            <param name="execution" value="series"/>
            <param name="prj_file" value="PtSn_OCO_Abu_1_29204.5.prj"/>
            <param name="component_file" value="Sn_foil_29200.prj"/>
            <param name="component_file" value="SnO2_29206.prj"/>
            <param name="energy_min" value="29190"/>
            <param name="energy_max" value="29230"/>
            <param name="x_limit_min" value="29190"/>
            <param name="x_limit_max" value="29230"/>
            <output_collection name="plot_collection" type="list" count="1"/>
            <assert_stdout>
                <has_text text="Goodness of fit (rfactor): 0.658596%"/>
            </assert_stdout>
        </test>
        <!-- 3: zipped -->
        <test expect_num_outputs="1">
            <param name="execution" value="zipped"/>
            <param name="prj_file" value="lcf.zip"/>
            <param name="component_file" value="Sn_foil_29200.prj"/>
            <param name="component_file" value="SnO2_29206.prj"/>
            <param name="energy_min" value="29190"/>
            <param name="energy_max" value="29230"/>
            <param name="x_limit_min" value="29190"/>
            <param name="x_limit_max" value="29230"/>
            <output_collection name="plot_collection" type="list" count="2"/>
            <assert_stdout>
                <has_text text="Goodness of fit (rfactor): 0.658596%"/>
            </assert_stdout>
        </test>
    </tests>
    <help><![CDATA[
        Performs a Linear Combination Fit (LCF) on an Athena project, using a number of other projects as components to the fit.
        The extent to which each component contributes to the target is recorded in the output plot of the normalised absorption co-efficient.
    ]]></help>
    <citations>
        <citation type="doi">@TOOL_CITATION@</citation>
        <citation type="doi">10.1107/S0909049505012719</citation>
    </citations>
</tool>