view macros.xml @ 9:f3eb2291da05 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
author iuc
date Wed, 24 Aug 2022 18:11:37 +0000
parents 2b0d3e2f402a
children
line wrap: on
line source

<macros>
    <token name="@STRING2VECTOR@">
string2numericvector = function(string){
    #' Converts a string to a valid vector
    #'
    #' e.g. "-1,2:5,2"  evaluates to c(-1,2,3,4,5,2)
    #'
    #' @param add string2vector function to safe environment
    #' @return vector of integers
    terms = unlist(strsplit(string, split=","))
    res = lapply(terms, function(x){
        if (grepl(":",x)){
            l_r = as.integer(c(unlist(strsplit(x,split=":"))))
            return(seq(l_r[1],l_r[2]))
        }
        return(as.integer(x))
    })
    return(c(unlist(res)))
}

string2textvector = function(string){
    #' Converts a string to a valid string vector
    #'
    #'   e.g. "red,yellow,white" evaluates to c("red","yellow","white")
    return(unlist(strsplit(string,",")))
}
    </token>
    <token name="@TOOL_VERSION@">0.2.3</token>
    <token name="@VERSION_SUFFIX@">3</token>
    <token name="@PROFILE@">21.01</token>

    <macro name="version_command_config" token_prog="temp" token_cheetah="temp2" token_out="2&#62; '$outlog'">
        <version_command><![CDATA[
Rscript '$__tool_directory__/scripts/@PROG@' 2>&1 | head -1 | cut -d' ' -f 2
        ]]></version_command>
        <command detect_errors="exit_code"><![CDATA[
Rscript '$__tool_directory__/scripts/@PROG@' '$userconf' @OUT@
]]>
        </command>
        <configfiles>
            <configfile name="userconf" ><![CDATA[
@STRING2VECTOR@

@@CHEETAH@@
]]></configfile>
        </configfiles>
    </macro>

    <macro name="requirements" >
        <requirements>
            <requirement type="package" version="@TOOL_VERSION@" >r-raceid</requirement>
            <!-- <requirement type="package" version="1.6.2">bioconductor-scran</requirement> -->
        </requirements>
    </macro>
    <macro name="yesno_checkedno" >
        <option value="yes" >Yes</option>
        <option value="no" selected="true" >No</option>
    </macro>
    <macro name="use_defaults_no" >
        <conditional name="use" >
            <param name="def" type="select" label="Use Defaults?" >
                <option value="yes" selected="true" >Yes</option>
                <option value="no" >No</option>
            </param>
            <when value="yes" />
            <when value="no" >
                <yield />
            </when>
        </conditional>
    </macro>
    <macro name="test_nondef" >
        <conditional name="use" >
            <param name="def" value="no" />
            <yield />
        </conditional>
    </macro>
    <macro name="section_test_nondef" >
        <section name="@SECTIONNAME@" >
            <expand macro="test_nondef" >
                <yield />
            </expand>
        </section>
    </macro>
    <macro name="citations" >
        <citations>
            <citation type="doi">10.1038/nature14966</citation>
            <citation type="doi">10.1038/nmeth.4662</citation>
        </citations>
    </macro>
    <!-- Sanitizers -->
    <macro name="sanitize_title">
        <sanitizer invalid_char="">
            <valid initial="string.letters,string.digits" >
                <add value=" " />
                <add value="_" />
            </valid>
        </sanitizer>
    </macro>
    <macro name="sanitize_regex" >
        <sanitizer invalid_char="">
            <valid initial="string.letters,string.digits">
                <add value="!"/>
                <add value="="/>
                <add value="-"/>
                <add value="."/>
                <add value="*"/>
                <add value="?"/>
                <add value="+"/>
                <add value="\\"/>
                <add value="_"/>
                <add value="|"/>
                <add value="&#91;"/> <!-- left square bracket, e.g subselecting from vec[1] -->
                <add value="&#93;"/> <!-- right square bracket -->
                <add value="&#40;"/> <!-- left parenthesis -->
                <add value="&#41;"/> <!-- right parenthesis -->
            </valid>
        </sanitizer>
    </macro>
    <macro name="sanitize_numeric_vector" >
        <sanitizer invalid_char="">
            <valid initial="string.digits">
                <add value=","/>
            </valid>
        </sanitizer>
    </macro>
    <macro name="sanitize_string_vector" >
        <sanitizer invalid_char="">
            <valid initial="string.letters,string.digits">
                <add value=","/>
                <add value="_"/>
                <add value="-"/>
                <add value="."/>
            </valid>
        </sanitizer>
    </macro>
</macros>