view qcxms_neutral_run.xml @ 6:475bbef634d4 draft default tip

planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/qcxms commit 384b9f232ce56d35cc16cbf0e499c5e1be683933
author recetox
date Tue, 15 Apr 2025 12:33:15 +0000
parents 33b7a99b6de3
children
line wrap: on
line source

<tool id="qcxms_neutral_run" name="QCxMS neutral run" version="@TOOL_VERSION@+galaxy6" profile="22.09">
    <description>required as first step to prepare for the production runs</description>
    
    <macros>
        <import>macros.xml</import>
    </macros>
    
    <expand macro="edam"/>
    <expand macro="creator"/>
    <expand macro="requirements"/>

    <command detect_errors="exit_code"><![CDATA[
        ln -s '$mol' molecule.xyz &&
        cat qcxms.in &&
        /qcxms_bin/qcxms -i molecule.xyz >> '$log' &&
        /qcxms_bin/qcxms -i molecule.xyz >> '$log' &&
        python3 rename.py

    ]]></command>

    <environment_variables>
        <environment_variable name="OMP_NUM_THREADS">1,2,1</environment_variable>
    </environment_variables>

    <configfiles>
        <configfile filename="qcxms.in"><![CDATA[
${QC_Level}
#if $keywords.ntraj
ntraj  ${keywords.ntraj}
#end if
tmax  ${keywords.tmax} 
etemp  ${keywords.etemp}
tinit  ${keywords.tinit} 
ieeatm  ${keywords.ieeatm}
tstep  ${keywords.tstep}
]]>
        </configfile>
        <configfile filename="rename.py">
import os

def rename_files_with_folder_name(folder_path):
    if not os.path.exists(folder_path):
        print(f"The folder '{folder_path}' does not exist.")
        return

    for root, _, files in os.walk(folder_path):
        for filename in files:
            folder_name = os.path.basename(root)
            new_filename = f"{folder_name}_{filename}"
            
            old_path = os.path.join(root, filename)
            new_path = os.path.join(root, new_filename)

            os.rename(old_path, new_path)

path = os.getcwd() + "/TMPQCXMS"
rename_files_with_folder_name(path) 
        </configfile>
    </configfiles>

    <inputs>
        <param type="data" name="mol" label="Molecule 3D structure [.xyz]" format="xyz" />
        <param name="QC_Level" type="select" display="radio" label="QC Method">
            <option value="xtb2" selected="true">GFN2-xTB</option>
            <option value="xtb">GFN1-xTB</option>
        </param>
        <section name="keywords" title="Advanced method parameters" expanded="false" 
            help="List of advanced keywords to specify the method - for more information see [1].">
            <param name="tmax" type="integer" value="5" label="Maximum MD time (sampling) [ps]"
            help="MD time for the mean-free-path (mfp) simulation in the EI mode."/>
            <param name="tinit" type="integer" value="500" label="Initial Temperature [K]"/>
            <param name="ieeatm" type="float" value="0.6" label="Impact excess energy (IEE) per atom [eV/atom]" />
            <param name="ntraj" type="integer" optional="true" min="2" label="Number of trajectories[#]" help="Default is 25 * no. of atoms if unspecified."/>
            <param name="tstep" type="float" value="0.5" label="MD time step (tstep) [fs]" help="Default is 0.5 fs."/>
            <param name="etemp" type="integer" value="5000" label="Electronic temperature (etemp) [K]" help="Default is 5000 K."/>
        </section>
        <param name="store_extended_output" type="boolean" value="false" label="Store additional outputs?" help="Output the logfile and generated trajectory."/>
    </inputs>

    <outputs>
        <data name="qcxms_out" format="txt" from_work_dir="qcxms.gs" label="qcxms.gs generated by ${tool.name} on ${on_string}">
            <filter>store_extended_output</filter>
        </data>
        <data name="trajectory" from_work_dir="trjM" format="txt" label="trajectories generated by ${tool.name} on ${on_string}">
            <filter>store_extended_output</filter>
        </data>
        <data name="log" format="txt" label="logfile of ${tool.name} on ${on_string}">
            <filter>store_extended_output</filter>
        </data>

        <collection name="coords1" format="txt" type="list" label="input in files generated by ${tool.name} on ${on_string}" >
            <discover_datasets pattern="(?P&lt;designation&gt;.+)\.in" format="txt" directory="TMPQCXMS" recurse="true"/>
        </collection>
        <collection name="coords2" format="txt" type="list" label="input start files generated by ${tool.name} on ${on_string}" >
            <discover_datasets pattern="(?P&lt;designation&gt;.+)\.start" format="txt" directory="TMPQCXMS" recurse="true"/>
        </collection>
        <collection name="coords3" format="txt" type="list" label="input xyz files generated by ${tool.name} on ${on_string}" >
            <discover_datasets pattern="(?P&lt;designation&gt;.+)\.xyz" format="txt" directory="TMPQCXMS" recurse="true"/>
        </collection>
    </outputs>

    <tests>
        <test expect_num_outputs="6">
            <param name="mol" value="mol.xyz" ftype="xyz"/>
            <section name="keywords">
                <param name="ntraj" value="2"/>
            </section>
            <param name="store_extended_output" value="true"/>
            <output_collection name="coords1" type="list" count="2"/>
            <output_collection name="coords2" type="list" count="2"/>
            <output_collection name="coords3" type="list" count="2"/>
            <output name="qcxms_out">
                <assert_contents>
                    <has_size value="174613" delta="300"/>
                </assert_contents>
            </output>
            <output name="trajectory">
                <assert_contents>
                    <has_size value="22150" delta="300"/>
                </assert_contents>
            </output>
            <output name="log">
                <assert_contents>
                    <has_size value="11103" delta="500"/>
                </assert_contents>
            </output>
        </test>
        <!-- test 2-->
        <test expect_num_outputs="6">
            <param name="mol" value="mol.xyz" ftype="xyz"/>
            <param name="QC_Level" value="xtb"/>
            <section name="keywords">
                <param name="ntraj" value="2"/>
            </section>
            <param name="store_extended_output" value="true"/>
            <output_collection name="coords1" type="list" count="2"/>
            <output_collection name="coords2" type="list" count="2"/>
            <output_collection name="coords3" type="list" count="2"/>
            <output name="qcxms_out">
                <assert_contents>
                    <has_size value="174613" delta="300"/>
                </assert_contents>
            </output>
            <output name="trajectory">
                <assert_contents>
                    <has_size value="22150" delta="300"/>
                </assert_contents>
            </output>
            <output name="log">
                <assert_contents>
                    <has_text text="initializing GFN1-xTB"/>
                </assert_contents>
            </output>
        </test>
    </tests>

    <help><![CDATA[
        The QCxMS Neutral Run tool serves as the first step in preparing for production runs. The tool execute neutral runs for mass 
        spectrometry simulations using the GFN2-xTB and GFN1-xTB quantum chemistry methods. For detail information visit the documentation 
        at https://xtb-docs.readthedocs.io/en/latest/qcxms_doc/qcxms_run.html#excecuting-the-production-runs
        ]]>
    </help>

    <citations>
        <citation type="doi">10.1002/anie.201300158</citation>
        <citation type="doi">10.1039/C4OB01668H</citation>
        <citation type="doi">10.1021/jp5096618</citation>
        <citation type="doi">10.1255/ejms.1313</citation>
        <citation type="doi">10.1021/acs.jpca.6b02907</citation>
    </citations>
</tool>