view macros.xml @ 0:8dc8ff057b0f draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
author iuc
date Thu, 22 Nov 2018 04:44:44 -0500
parents
children 5d5b14dbd092
line wrap: on
line source

<macros>
    <token name="@GET_VERSION@"><![CDATA[ 2>&1 | head -1 | cut -d' ' -f 2 ]]></token>
    <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_PACKAGE@">0.2</token>
    <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>
    <macro name="select_cells" token_sectionname="@SECTIONNAME@" token_sectiontitle="@SECTIONTITLE@" >
        <section name="@SECTIONNAME@" title="@SECTIONTITLE@" expanded="true" >
            <param name="name_set" type="text" optional="true" label="Name of Set" >
                <!-- Aname, Bname -->
                <expand macro="sanitize_title" />
            </param>
            <conditional name="meth" >
                <param name="type" type="select" label="Selection method" >
                    <option value="cln" selected="true">Cluster Numbers</option>
                    <option value="regex" >Regular Expression</option>
                    <option value="manual" >Manual Selection</option>
                </param>
                <when value="cln" >
                    <param name="selector" type="text" value="" label="List of clusters" >
                        <expand macro="sanitize_numeric_vector" />
                    </param>
                </when>
                <when value="regex" >
                    <param name="selector" type="text" value="" label="Regular Expression to select gene names" >
                        <expand macro="sanitize_regex" />
                    </param>
                </when>
                <when value="manual" >
                    <param name="selector" type="text" value="" label="List of genes" >
                        <expand macro="sanitize_string_vector" />
                    </param>
                </when>
            </conditional>
        </section>
    </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>