view pm_muairss_write.xml @ 2:8e5dbded3070 draft default tip

planemo upload for repository https://github.com/muon-spectroscopy-computational-project/muon-galaxy-tools/main/pm_muairss_write commit 4f06b404d8b7fb83995f3052faa7e2ec7811f507
author muon-spectroscopy-computational-project
date Fri, 03 Feb 2023 15:39:39 +0000
parents 150301c057b0
children
line wrap: on
line source

<tool id="pm_muairss_write" name="PyMuonSuite AIRSS Generate" version="@TOOL_VERSION@+galaxy@WRAPPER_VERSION@" python_template_version="3.5" profile="22.05" license="MIT">
    <description>generate muonated structures</description>
    <macros>
        <!-- version of underlying tool (PEP 440) -->
        <token name="@TOOL_VERSION@">0.2.3</token>
        <!-- version of this tool wrapper (integer) -->
        <token name="@WRAPPER_VERSION@">0</token>
        <!-- citation should be updated with every underlying tool version -->
        <!-- typical fields to update are version, month, year, and doi -->
        <token name="@TOOL_CITATION@">
            @software{Sturniolo_pymuon-suite_2022,
                author = {Sturniolo, Simone and Liborio, Leandro and Chadwick, Eli and Murgatroyd, Laura and Laverack, Adam and Mudaraddi, Anish and {Muon Spectroscopy Computational Project}},
                license = {GPL-3.0},
                month = {8},
                title = {{pymuon-suite}},
                url = {https://github.com/muon-spectroscopy-computational-project/pymuon-suite},
                version = {v0.2.3},
                doi = {10.5281/zenodo.7025644},
                year = {2022}
            }
        </token>
    </macros>
    <creator>
        <person givenName="Eli" familyName="Chadwick" url="https://github.com/elichad" identifier="https://orcid.org/0000-0002-0035-6475"/>
        <person givenName="Jyothish" familyName="Thomas" identifier="https://orcid.org/0000-0003-4724-6924"/>
        <organization url="https://muon-spectroscopy-computational-project.github.io/index.html" name="The Muon Spectroscopy Computational Project"/>
    </creator>
    <requirements>
        <requirement type="package" version="@TOOL_VERSION@">pymuonsuite</requirement>
        <requirement type="package" version="3.0">zip</requirement>
    </requirements>
    <required_files>
        <include type="literal" path="get_out_folder.py"/>
    </required_files>
    <command detect_errors="exit_code"><![CDATA[
        structure_name_internal='input_structure.$structure.ext' &&
        ln -s '$structure' \$structure_name_internal &&
        ln -s '$params' params.yaml &&
        echo '$castep_param' &&
        #if $castep_param:
            castep_param_name=\$(sed 's/ //g' <<< '$castep_param.name') &&
            ln -s '$castep_param' \$castep_param_name &&
            sed -i '/^castep_param: /{h;s/:.*/: '"\$castep_param_name"'/};\${x;/^$/{s//castep_param: '"\$castep_param_name"'/;H};x}' params.yaml &&
            #if $script_file:
                script_file_name=\$(sed 's/ //g' <<< '$script_file.name') &&
                ln -s '$script_file' \$script_file_name &&
                sed -i '/^script_file: /{h;s/:.*/: '"\$script_file_name"'/};\${x;/^$/{s//script_file: '"\$script_file_name"'/;H};x}' params.yaml &&
            #end if
        #end if
        #if $allpos_ext!="none":
            sed -i '/^allpos_filename: /{h;s/:.*/: allpos.$allpos_ext/};\${x;/^$/{s//allpos_filename: allpos.$allpos_ext/;H};x}' params.yaml &&
        #end if
        pm-muairss -t w \$structure_name_internal params.yaml &&
        out_folder="`python '${__tool_directory__}/get_out_folder.py'`" &&
        #if $castep_param:
            zip -r out_zip.zip \$out_folder params.yaml \$structure_name_internal \$castep_param_name &&
        #else:
            zip -r out_zip.zip \$out_folder params.yaml \$structure_name_internal &&
        #end if
        #if $allpos_ext!="none":
            mv allpos.$allpos_ext allpos &&
        #end if
        #if $testing=="true" and $castep_param:
            grep "castep_param" params.yaml > tree.txt &&
        #end if
        find \$out_folder >> tree.txt

    ]]></command>
    <inputs>
        <param type="data" name="structure" label="Structure file" format="cell, cif, xyz, extxyz" help="The structure to add muons to. The original file will be preserved. Accepted file types: CELL, CIF, XYZ (standard or extended)."/>
        <param type="data" name="params" label="YAML parameter file" format="yaml" help="YAML parameters for this and subsequent tools. You can create this file using the [YAML config generator] tool."/>
        <param type="data" name="castep_param" optional="true" label="CASTEP parameter file" format="param" help="CASTEP parameters (.param file) for the optimisation stage. These parameters will be copied for each muonated structure. Only required when the 'calculator' parameter is set to 'castep' in your chosen YAML file."/>
        <param type="data" name="script_file" label="Submission script template (optional)" format="txt" help="Template script for submitting to an HPC job scheduler. Occurences of {seedname} will be replaced with the unique input directory for each job." optional="true"/>
        <param type="select" name="allpos_ext" value="none" label="Format for file containing all muon positions (optional)" help="If set, generates an extra output file containing all the muon positions using the specified file type.">
            <option value="none">Do not generate</option>
            <option value="cell">CELL</option>
            <option value="cif">CIF</option>
            <option value="xyz">XYZ</option>
        </param>
        <param type="hidden" name="testing" label="Test mode" value="false"/>
    </inputs>
    <outputs>
        <data label="Muonated $structure.name using $params.name" name="muonated_structures" format="zip" from_work_dir="out_zip.zip"/>
        <data label="File containing the positions of all muon sites" name="allpos_file" from_work_dir="allpos" auto_format="true">
            <filter>(allpos_ext != "none")</filter>
        </data>
        <data label="File tree (testing only)" name="file_tree" format="txt" from_work_dir="tree.txt" hidden="true">
            <filter>(testing == "true")</filter>
        </data>
    </outputs>
    <tests>
        <!-- CASTEP with out_folder and castep_param specified, param as txt -->
        <test expect_num_outputs="2">
            <param name="structure" value="Si.cell" ftype="cell"/>
            <param name="testing" value="true"/>
            <param name="params" value="configcastep_t_with_out_folder_and_castep_param.yaml" ftype="yaml"/>
            <param name="castep_param" value="Si.param" ftype="param"/>
            <output name="file_tree" file="tree_castep_t_with_out_folder_and_castep_param.txt" ftype="txt" sort="true" />
        </test>
        <!-- CASTEP with out_folder and castep_param specified, param as yaml -->
        <test expect_num_outputs="2">
            <param name="structure" value="Si.cell" ftype="cell"/>
            <param name="testing" value="true"/>
            <param name="params" value="configcastep_t_with_out_folder_and_castep_param.yaml" ftype="yaml"/>
            <param name="castep_param" value="Si.param" ftype="param"/>
            <output name="file_tree" file="tree_castep_t_with_out_folder_and_castep_param.txt" ftype="txt" sort="true" />
        </test>
        <!-- CASTEP with spaces in param name -->
        <test expect_num_outputs="2">
            <param name="structure" value="Si.cell" ftype="cell"/>
            <param name="testing" value="true"/>
            <param name="params" value="configcastep_t_with_out_folder_and_castep_param.yaml" ftype="yaml"/>
            <param name="castep_param" value="S i.param" ftype="param"/>
            <output name="file_tree" file="tree_castep_t_with_out_folder_and_castep_param.txt" ftype="txt" sort="true" />
        </test>
        <!-- CASTEP with no out_folder and no castep_param specified in yaml file -->
        <test expect_num_outputs="2">
            <param name="structure" value="Si.cell" ftype="cell"/>
            <param name="testing" value="true"/>
            <param name="params" value="configcastep_t_no_out_folder_no_castep_param.yaml" ftype="yaml"/>
            <param name="castep_param" value="Si.param" ftype="param"/>
            <output name="file_tree" file="tree_castep_t_no_outfolder_and_castep_param.txt" ftype="txt" sort="true" />
        </test>
        <!-- CASTEP with allpos_ext xyz -->
        <test expect_num_outputs="3">
            <param name="structure" value="Si.cell" ftype="cell"/>
            <param name="testing" value="true"/>
            <param name="params" value="configcastep_t_with_out_folder_and_castep_param.yaml" ftype="yaml"/>
            <param name="allpos_ext" value="xyz"/>
            <param name="castep_param" value="Si.param" ftype="param"/>
            <output name="file_tree" file="tree_castep_t_with_out_folder_and_castep_param.txt" ftype="txt" sort="true" />
            <output name="allpos_file" file="allpos.xyz" />
        </test>
        <!-- CASTEP with allpos_ext cell -->
        <test expect_num_outputs="3">
            <param name="structure" value="Si.cell" ftype="cell"/>
            <param name="testing" value="true"/>
            <param name="params" value="configcastep_t_with_out_folder_and_castep_param.yaml" ftype="yaml"/>
            <param name="allpos_ext" value="cell"/>
            <param name="castep_param" value="Si.param" ftype="param"/>
            <output name="file_tree" file="tree_castep_t_with_out_folder_and_castep_param.txt" ftype="txt" sort="true" />
            <output name="allpos_file" file="allpos.cell" />
        </test>
        <!-- CASTEP with allpos_ext cif -->
        <test expect_num_outputs="3">
            <param name="structure" value="Si.cell" ftype="cell"/>
            <param name="testing" value="true"/>
            <param name="params" value="configcastep_t_with_out_folder_and_castep_param.yaml" ftype="yaml"/>
            <param name="allpos_ext" value="cif"/>
            <param name="castep_param" value="Si.param" ftype="param"/>
            <output name="file_tree" file="tree_castep_t_with_out_folder_and_castep_param.txt" ftype="txt" sort="true" />
            <output name="allpos_file" file="allpos.cif" />
        </test>
        <!-- CASTEP with script_file not specified in YAML file -->
        <test expect_num_outputs="2">
            <param name="structure" value="Si.cell" ftype="cell"/>
            <param name="testing" value="true"/>
            <param name="params" value="configcastep_t_with_out_folder_and_castep_param.yaml" ftype="yaml"/>
            <param name="castep_param" value="Si.param" ftype="param"/>
            <param name="script_file" value="submit.sh" ftype="txt"/>
            <output name="file_tree" file="tree_castep_t_with_script_file.txt" ftype="txt" sort="true" />
        </test>
        <!-- CASTEP with script_file specified in YAML file -->
        <test expect_num_outputs="2">
            <param name="structure" value="Si.cell" ftype="cell"/>
            <param name="testing" value="true"/>
            <param name="params" value="configcastep_t_with_script_file.yaml" ftype="yaml"/>
            <param name="castep_param" value="Si.param" ftype="param"/>
            <param name="script_file" value="s u b m i t.sh" ftype="txt"/>
            <output name="file_tree" file="tree_castep_t_with_script_file.txt" ftype="txt" sort="true" />
        </test>
        <!-- DFTB+ -->
        <test expect_num_outputs="2">
            <param name="structure" value="Si.cell" ftype="cell"/>
            <param name="testing" value="true"/>
            <param name="params" value="configdftb_t.yaml" ftype="yaml"/>
            <output name="file_tree" file="tree_dftb.txt" ftype="txt" sort="true" />
        </test>
        <!-- UEP with CELL -->
        <test expect_num_outputs="2">
            <param name="structure" value="Si.cell" ftype="cell"/>
            <param name="testing" value="true"/>
            <param name="params" value="configuep_t.yaml" ftype="yaml"/>
            <output name="file_tree" file="tree_uep.txt" ftype="txt" sort="true">
                <assert_contents>
                    <has_size value="734"/>
                </assert_contents>
            </output>
        </test>
        <!-- UEP with XYZ -->
        <test expect_failure="true">
            <param name="structure" value="Si.xyz" ftype="xyz"/>
            <param name="testing" value="true"/>
            <param name="params" value="configuep_t.yaml" ftype="yaml"/>
            <assert_stderr>
                <has_text text="TypeError: cannot unpack non-iterable NoneType object"/>
            </assert_stderr>
        </test>
        <!-- UEP with extended XYZ -->
        <test expect_num_outputs="2">
            <param name="structure" value="Si.extxyz" ftype="extxyz"/>
            <param name="testing" value="true"/>
            <param name="params" value="configuep_t.yaml" ftype="yaml"/>
            <output name="file_tree" file="tree_uep.txt" ftype="txt" sort="true">
                <assert_contents>
                    <has_size value="734"/>
                </assert_contents>
            </output>
        </test>
        <!-- UEP with CIF -->
        <test expect_num_outputs="2">
            <param name="structure" value="Si.cif" ftype="cif"/>
            <param name="testing" value="true"/>
            <param name="params" value="configuep_t.yaml" ftype="yaml"/>
            <output name="file_tree" file="tree_uep.txt" ftype="txt" sort="true">
                <assert_contents>
                    <has_size value="734"/>
                </assert_contents>
            </output>
        </test>
        <!-- check that file_tree filter works -->
        <test expect_num_outputs="1">
            <param name="structure" value="Si.cell" ftype="cell"/>
            <param name="testing" value="false"/>
            <param name="params" value="configuep_t.yaml" ftype="yaml"/>
        </test>
    </tests>
    <help><![CDATA[
        Given an input structure, this tool generates a set of duplicate structures, each with a single muon added in a random location. These are known as "muonated" structures.

        The YAML file controls many factors of the structure generation. We recommend using the '`YAML config generator`_' tool to create the file, but you can also write and upload it yourself following the `pm-muairss documentation`_.

        The resulting structures will be returned as a zip folder. This zip folder can be used as input for the '`Generate UEP outputs`_' tool, or downloaded for use outside Galaxy.

        Command-line usage: pm-muairss -t w structure_file parameter_file

        .. _pm-muairss documentation: https://github.com/muon-spectroscopy-computational-project/pymuon-suite/blob/master/docs/muairss-gen-docs.md
        .. _YAML config generator: /tool_runner?tool_id=pm_yaml_config
        .. _Generate UEP outputs: /tool_runner?tool_id=pm_uep_opt_write

        PyMuonSuite is distributed under the GPLv3 license. This tool wrapper is distributed under the MIT license.
    ]]></help>
    <citations>
        <citation type="bibtex">
            @misc{github,
                author = {{Muon Spectroscopy Computational Project}},
                year = {2021},
                title = {pymuon-suite 0.2.0},
                publisher = {GitHub},
                url = {https://github.com/muon-spectroscopy-computational-project/pymuon-suite/}
            }
        </citation>
        <citation type="doi">10.1063/1.5024450</citation>
        <citation type="doi">10.1063/1.5085197</citation>
        <citation type="doi">10.1063/5.0012381</citation>
        <citation type="bibtex">
            @TOOL_CITATION@
        </citation>
    </citations>
</tool>