view macros.xml @ 4:86e2358cf273 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 5d7c4cd914295a81d42bf8baaad4981c23a83059"
author iuc
date Mon, 12 Aug 2019 13:03:03 -0400
parents e0e9b24d76aa
children c8434a623268
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="@VERSION_RACEID@">3</token>
    <token name="@VERSION_WRAPPER@">1</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="0.1.1">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>