view macros_inspectclusters.xml @ 2:56a093c2a3f9 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 1d6e79ba92ce98c7c91f0c4076c9ca5e4e3f3a20
author iuc
date Thu, 28 Feb 2019 17:40:54 -0500
parents 8dc8ff057b0f
children
line wrap: on
line source

<macros>
    <macro name="inspectclusters_inputs" >
        <param name="inputrds" type="data" format="rdata" label="Input RaceID RDS" help="Requires the RDS output from the cluster analysis" />
        <conditional name="plotgen">
            <param name="do_opt" type="select" label="Plot All Clusters?" help="Generates tSNE and F-R plots" >
                <option value="yes" selected="true" >Yes</option>
                <option value="no" >No</option>
            </param>
            <when value="no" />
            <when value="yes" />
        </conditional>
        <conditional name="plotsym" >
            <param name="do_opt" type="select" label="Perform Subset Analysis?" >
                <expand macro="yesno_checkedno" />
            </param>
            <when value="no" />
            <when value="yes">
                <param name="types_regex" type="text" optional="true" label="Types Regex (removal)" help="Regular expression to be used to remove portions of the cell names, in order to indicate cell type. e.g. if your cells are labelled as 'cdk5_1, cdk5_2, glow_1, glow_2', then a regex of '_\\d$' would trim off the ends and set the cell types to 'cdk5, cdk5, glow, glow'. " >
                    <expand macro="sanitize_regex" />
                </param>
                <expand macro="use_defaults_no" >
                    <param name="subset_regex" type="text" optional="true" label="Subset of Types: Regex (select)" help="Regular expression to be used to select for cell types of interest. e.g. if we are only interested in 'cdk5' positive cells, then we would simply put 'cdk5' here. ">
                        <expand macro="sanitize_regex" />
                    </param>
                    <param name="fr" type="boolean" checked="false" label="Output FR map instead of tSNE" help="Performs a Fruchterman-Rheingold projection instead of tSNE" />
                </expand>
            </when>
        </conditional>
        <conditional name="gois" >
            <param name="do_opt" type="select" label="Examine Genes of Interest" >
                <expand macro="yesno_checkedno" />
            </param>
            <when value="no" />
            <when value="yes">
                <param name="inspect_goi_genes" type="text" value="" label="Genes to Examine" >
                    <expand macro="sanitize_string_vector" />
                </param>
                <param name="inspect_goi_cells" type="text" optional="true" label="Cells to Examine" help="Leave blank to examine all" ><!-- "":NULL -->
                    <expand macro="sanitize_string_vector" />
                </param>
                <expand macro="use_defaults_no" >
                    <!-- Yes, examine genes of interest, but no do not use defaults... -->
                    <param name="inspect_goi_imputed" type="boolean" checked="false" label="Impute Genes" help="Only works if k-nearest neighbours was used in the clustering" />
                    <param name="plotexp_n" type="text" optional="true" label="Title of plot" help="If blank, the list of genes are used" >
                        <expand macro="sanitize_title" />
                    </param>
                    <param name="plotmarkg_cthr" type="integer" min="0" value="0" label="Cluster Threshold" help="Include only clusters with cells greater than this" />
                    <param name="plotmarkg_cl" type="text" optional="true" label="Cluster List" help="List of cluster numbers to include. Leave blank to include all" >
                        <expand macro="sanitize_numeric_vector" />
                    </param><!-- "":NULL -->
                    <param name="plotmarkg_order_cells" type="boolean" checked="false" label="Order Cells" help="Order heatmap by cell names, not by cluster" />
                    <param name="plotmarkg_aggr" type="boolean" checked="false" label="Average Expression" help="Show only average expression for each cluster" />
                    <param name="plotmarkg_norm" type="boolean" checked="false" label="Normalise Gene Expression " help="Normalise gene expression to 1 to depict genes on the same scale" />
                    <param name="plotmarkg_flo" type="integer" max="-5" optional="true" label="Lower-bound for Gene Expression" /><!-- negative or null vals only for this seem to work-->
                    <param name="plotmarkg_cap" type="integer" min="1" optional="true" label="Upper-bound for Gene Expression" />
                    <param name="plotmarkg_samples" type="text" optional="true" label="Regex to Select Sample Names For Each cell" >
                        <expand macro="sanitize_regex" />
                    </param>
                    <param name="plotmarkg_cluster_cols" type="boolean" checked="false" label="Cluster columns" />
                    <param name="plotmarkg_cluster_rows" type="boolean" checked="true" label="Cluster rows" />
                    <param name="plotmarkg_cluster_set" type="boolean" checked="false" label="Order Clusters by Heirarchal Clustering of Cluster Medoids." />
                </expand>
            </when>
        </conditional>
        <conditional name="diffgtest" >
            <param name="do_opt" type="select" label="Differential Gene Testing" >
                <expand macro="yesno_checkedno" />
            </param>
            <when value="no" />
            <when value="yes" >
                <expand macro="select_cells" sectionname="set_a" sectiontitle="Cells in Set A" />
                <expand macro="select_cells" sectionname="set_b" sectiontitle="Cells in Set B" />
                <expand macro="use_defaults_no" >
                    <param name="plotdiffg_pthr" type="float" min="0" max="1" value="0.05" label="P-value cutoff" help="Cutoff for displaying differentially expressed genes" />
                    <param name="plotdiffg_padj" type="boolean" checked="true" label="Apply B-H Correction" help="Display genes with a Benjamini-Hochberg corrected false discovery rate lower than the above P-value threshold" />
                    <param name="plotdiffg_lthr" type="float" min="0" value="0" label="Log2-Fold Threshold" help="Differentially expressed genes are displayed only for log2 fold-changes higher than this" />
                    <param name="plotdiffg_mthr" type="float" optional="true" label="Log2 Mean Threshold" help="Differentially expressed genes are displayed only for log2 mean expression greater than this" /><!-- opt:-Inf -->
                    <param name="plotdiffg_show_names" type="boolean" checked="false" label="Display Gene Names" />
                </expand>
            </when>
        </conditional>
    </macro>
    <macro name="inspectclusters_tests" >
        <test><!-- general plots, plotgen -->
            <param name="inputrds" value="out_cluster_default.rdat" />
            <conditional name="plotgen" >
                <param name="do_opt" value="yes" />
            </conditional>
            <output name="outpdf" value="out_cluster_general_default.pdf" />
        </test>
        <test><!-- default test, plotsym -->
            <param name="inputrds" value="out_cluster_default.rdat" />
            <conditional name="plotsym" >
                <param name="do_opt" value="yes" />
                <param name="types_regex" value="\\_\\d+" />
                <expand macro="test_nondef" >
                    <param name="subset_regex" value="IV|V" />
                </expand>
            </conditional>
            <conditional name="gois" >
                <param name="do_opt" value="yes" />
                <param name="inspect_goi_genes" value="Apoa1,Apoa1bp,Apoa2,Apoa4,Apoa5" />
            </conditional>
            <output name="outpdf" value="out_cluster_inspect_default.pdf" />
        </test>
        <test><!-- Advanced 1 -->
            <param name="inputrds" value="out_cluster_default.rdat" />
            <conditional name="plotsym" >
                <param name="do_opt" value="yes" />
                <param name="types_regex" value="\\_\\d+" />
                <expand macro="test_nondef" >
                    <param name="subset_regex" value="IV|V" />
                    <param name="fr" value="true" />
                </expand>
            </conditional>
            <conditional name="gois" >
                <param name="do_opt" value="yes" />
                <param name="inspect_goi_genes" value="Apoa1,Apoa1bp,Apoa2,Apoa4,Apoa5" />
                <expand macro="test_nondef" >
                    <param name="inspect_goi_imputed" value="false" />
                    <param name="plotexp_n" value="Test Title" />
                    <param name="plotmarkg_order_cells" value="true" />
                    <param name="plotmarkg_aggr" value="true" />
                    <param name="plotmarkg_norm" value="true" />
                    <param name="plotmarkg_flo" value="-10" />
                    <param name="plotmarkg_cap" value="100" />
                    <param name="plotmarkg_samples" value="(\\_\\d+)$" />
                    <param name="plotmarkg_cluster_cols" value="true" />
                    <param name="plotmarkg_cluster_rows" value="false" />
                    <param name="plotmarkg_cluster_set" value="true" />
                </expand>
            </conditional>
            <conditional name="diffgtest" >
                <param name="do_opt" value="yes" />
                <section name="set_a" >
                    <param name="name_set" value="Test set A" />
                    <conditional name="meth" >
                        <param name="type" value="regex" />
                        <param name="selector" value="^V5.*" />
                    </conditional>
                </section>
                <section name="set_b" >
                    <param name="name_set" value="Test set B" />
                    <conditional name="meth" >
                        <param name="type" value="manual" />
                        <param name="selector" value="I5d_3,I5d_4,I5d_6,I5d_8,I5d_9,I5d_10,I5d_11,I5d_12,I5d_13,I5d_14" />
                    </conditional>
                </section>
                <expand macro="test_nondef" >
                    <param name="plotdiffg_pthr" value="0.1" />
                    <param name="plotdiffg_padj" value="false" />
                    <param name="plotdiffg_lthr" value="0.2" />
                    <param name="plotdiffg_mthr" value="0.2" />
                    <param name="plotdiffg_show_names" value="true" />
                </expand>
            </conditional>
            <output name="outpdf" value="out_cluster_inspect_advanced1.pdf" />
        </test>
        <test><!-- Advanced 2 -->
            <param name="inputrds" value="out_cluster_default.rdat" />
            <conditional name="plotsym" >
                <param name="do_opt" value="yes" />
                <expand macro="test_nondef" >
                    <param name="fr" value="false" />
                </expand>
            </conditional>
            <conditional name="gois" >
                <param name="do_opt" value="yes" />
                <param name="inspect_goi_genes" value="Sp1,Spc24,Spcs1,Spcs2,Spcs3" />
                <expand macro="test_nondef" >
                    <param name="plotexp_n" value="Test Title 2" />
                    <param name="plotmarkg_order_cells" value="true" />
                    <param name="plotmarkg_aggr" value="true" />
                    <param name="plotmarkg_norm" value="false" />
                    <param name="plotmarkg_flo" value="-10" />
                    <param name="plotmarkg_cap" value="10" />
                    <param name="plotmarkg_cluster_cols" value="true" />
                    <param name="plotmarkg_cluster_rows" value="true" />
                    <param name="plotmarkg_cluster_set" value="true" />
                </expand>
            </conditional>
            <conditional name="diffgtest" >
                <param name="do_opt" value="yes" />
                <section name="set_a" >
                    <param name="name_set" value="Test set A" />
                    <conditional name="meth" >
                        <param name="type" value="regex" />
                        <param name="selector" value="^IV.*" />
                    </conditional>
                </section>
                <section name="set_b" >
                    <param name="name_set" value="Test set B" />
                    <conditional name="meth" >
                        <param name="type" value="cln" />
                        <param name="selector" value="3" />
                    </conditional>
                </section>
                <expand macro="test_nondef" >
                    <param name="plotdiffg_pthr" value="0.8" />
                    <param name="plotdiffg_padj" value="true" />
                    <param name="plotdiffg_lthr" value="0.8" />
                    <param name="plotdiffg_mthr" value="0.8" />
                    <param name="plotdiffg_show_names" value="false" />
                </expand>
            </conditional>
            <output name="outpdf" value="out_cluster_inspect_advanced2.pdf" />
        </test>
    </macro>
    <token name="@INSPECTCLUSTERS_CHEETAH@"><![CDATA[

in.rdat = readRDS('${inputrds}')

perform.plotting = FALSE
perform.symbolmap = FALSE
perform.genesofinterest = FALSE
perform.diffgene = FALSE

#if str($plotgen.do_opt) == "yes":
perform.plotting = TRUE
#end if

#if str($plotsym.do_opt) == "yes":
perform.symbolmap = TRUE
plotsym = formals(plotsymbolsmap)
plotsym.use.typeremoveregex = NULL
plotsym.use.typeremoveregex.subselect = NULL
plotsym.use.typeremoveregex = as.character( '$plotsym.types_regex' )
    #if str($plotsym.use.def) == "no":
plotsym\$fr = as.logical( '$plotsym.use.fr' )
        #if $plotsym.use.subset_regex:
plotsym.use.typeremoveregex.subselect = as.character( '$plotsym.use.subset_regex' )
        #end if
    #end if
#end if

#if str($gois.do_opt) == "yes":
perform.genesofinterest = TRUE
plotexp = formals(plotexpmap)
plotmarkg = formals(plotmarkergenes)

inspect.goi.use.genes = string2textvector( '$gois.inspect_goi_genes' )
plotexp\$g = inspect.goi.use.genes
plotmarkg\$genes = inspect.goi.use.genes

    #if $gois.inspect_goi_cells:
inspect.goi.use.cells = as.character( '$gois.inspect_goi_cells' )
plotexp\$cells = inspect.goi.use.cells
plotmarkg\$cells = inspect.goi.use.cells
    #end if
    #if str($gois.use.def) == "no":
inspect.goi.use.imputed = as.logical( '$gois.use.inspect_goi_imputed' )
plotexp\$imputed = inspect.goi.use.imputed
plotmarkg\$imputed = inspect.goi.use.imputed
        #if $gois.use.plotmarkg_cl
plotmarkg\$cl = string2numericvector( '$gois.use.plotmarkg_cl' )
        #end if
        #if $gois.use.plotmarkg_cap
plotmarkg\$cap = as.integer( '$gois.use.plotmarkg_cap' )
        #end if
        #if $gois.use.plotmarkg_flo
plotmarkg\$flo = as.integer( '$gois.use.plotmarkg_flo' )
        #end if
        #if $gois.use.plotmarkg_samples
plotmarkg\$samples = as.character( '$gois.use.plotmarkg_samples' )
        #end if
        #if $gois.use.plotexp_n
plotexp\$n = as.character( '$gois.use.plotexp_n' )
        #end if
plotmarkg\$cthr = as.integer( '$gois.use.plotmarkg_cthr' )
plotmarkg\$order.cells = as.logical( '$gois.use.plotmarkg_order_cells' )
plotmarkg\$aggr = as.logical( '$gois.use.plotmarkg_aggr' )
plotmarkg\$norm = as.logical( '$gois.use.plotmarkg_norm' )
plotmarkg\$cluster_cols = as.logical( '$gois.use.plotmarkg_cluster_cols' )
plotmarkg\$cluster_rows = as.logical( '$gois.use.plotmarkg_cluster_rows' )
plotmarkg\$cluster_set = as.logical( '$gois.use.plotmarkg_cluster_set' )
    #end if
#end if

#if str($diffgtest.do_opt) == "yes":
plotdiffg = formals(plotdiffgenesnb)

perform.diffgene = TRUE
plotdiffg\$Aname = '$diffgtest.set_a.name_set'
plotdiffg\$Bname = '$diffgtest.set_b.name_set'

gfdat.A.use = list()
gfdat.B.use = list()

gfdat.A.use\$manual = NULL
gfdat.A.use\$regex = NULL
gfdat.A.use\$cln = NULL
gfdat.B.use\$manual = NULL
gfdat.B.use\$regex = NULL
gfdat.B.use\$cln = NULL

    #if str($diffgtest.set_a.meth.type) == "cln":
gfdat.A.use\$cln = c( '$diffgtest.set_a.meth.selector' )
    #else if str($diffgtest.set_a.meth.type) == "regex":
gfdat.A.use\$regex = as.character( '$diffgtest.set_a.meth.selector' )
    #else if str($diffgtest.set_a.meth.type) == "manual":
gfdat.A.use\$manual = string2textvector( '$diffgtest.set_a.meth.selector' )
    #end if

    #if str($diffgtest.set_b.meth.type) == "cln":
gfdat.B.use\$cln = c( '$diffgtest.set_b.meth.selector' )
    #else if str($diffgtest.set_b.meth.type) == "regex":
gfdat.B.use\$regex = as.character( '$diffgtest.set_b.meth.selector' )
    #else if str($diffgtest.set_b.meth.type) == "manual":
gfdat.B.use\$manual = string2textvector( '$diffgtest.set_b.meth.selector' )
    #end if

    #if str($diffgtest.use.def) == "no":
plotdiffg\$pthr = as.numeric( '$diffgtest.use.plotdiffg_pthr' )
plotdiffg\$padj = as.logical( '$diffgtest.use.plotdiffg_padj' )
plotdiffg\$lthr = as.integer( '$diffgtest.use.plotdiffg_lthr' )
plotdiffg\$show_names = as.logical( '$diffgtest.use.plotdiffg_show_names' )
        #if $diffgtest.use.plotdiffg_mthr
plotdiffg\$mthr = as.numeric( '$diffgtest.use.plotdiffg_mthr' )
        #end if
    #end if
#end if

out.pdf='${outpdf}'
    ]]>
    </token>
</macros>