diff macros_conffiles.xml @ 0:ef5f8bbf7730 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit a41493893bdcbe330434db9c5851719012b62fa8
author iuc
date Wed, 09 Aug 2017 09:52:52 -0400
parents
children 014a21767ac4
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/macros_conffiles.xml	Wed Aug 09 09:52:52 2017 -0400
@@ -0,0 +1,424 @@
+<?xml version="1.0"?>
+<macros>
+  <xml name="configfile_circos_conf">
+    <configfile name="circos_conf"><![CDATA[
+<<include colors_fonts_patterns.conf>>
+<<include housekeeping.conf>>
+karyotype = karyotype.txt
+
+<image>
+  <<include etc/image.conf>>
+</image>
+
+<<include ticks.conf>>
+<<include ideogram.conf>>
+<plots>
+    <<include 2d.conf>>
+</plots>
+<links>
+    <<include links.conf>>
+</links>
+
+    ]]></configfile>
+  </xml>
+  <xml name="configfile_ticks_conf">
+    <configfile name="ticks_conf"><![CDATA[
+show_ticks          = ${ticks.show_ticks}
+show_tick_labels    = yes
+
+#def circosColor($value)
+    #set $value = str($value)
+    #set $r = int($value[1:3], 16)
+    #set $g = int($value[3:5], 16)
+    #set $b = int($value[5:], 16)
+    $r, $g, $b
+#end def
+
+
+<ticks>
+    radius           = ${ticks.radius}r
+    color            = $circosColor($ticks.color)
+    thickness        = 2p
+    multiplier       = ${ticks.multiplier}
+
+    #for $tick_group in $ticks.tick_group:
+    <tick>
+        spacing        = ${tick_group.spacing}
+        size           = ${tick_group.size}p
+        show_label     = ${tick_group.show_tick_labels}
+        label_size     = ${tick_group.label_size}p
+        label_offset   = ${tick_group.label_offset}p
+        format         = ${tick_group.format} kb
+        ## TODO: figure out automated tick labels
+        ##if ${ticks.multiplier} * ${tick_group.spacing}
+    </tick>
+    #end for
+</ticks>
+]]>
+    </configfile>
+  </xml>
+  <xml name="configfile_ideogram_conf">
+    <configfile name="ideogram_conf"><![CDATA[
+
+<ideogram>
+
+    <spacing>
+        ## spacing between ideograms
+        default = ${ideogram.spacing}r
+    </spacing>
+
+    # ideogram position, thickness and fill
+    radius           = ${ideogram.radius}r
+    thickness        = ${ideogram.thickness}p
+    fill             = yes
+
+    show_label       = ${ideogram.ideogram_labels.show_label}
+    label_radius     = dims(ideogram,radius) + 0.075r
+    label_size       = 24
+    label_parallel   = ${ideogram.ideogram_labels.parallel}
+
+    show_bands            = yes
+    fill_bands            = yes
+    band_transparency     = 4
+
+</ideogram>
+]]></configfile>
+  </xml>
+  <xml name="configfile_data_conf">
+    <configfile name="data_conf"><![CDATA[
+#for $hi, $data in enumerate($sec_tdd.data):
+<plot>
+    #set plot_type = str($data.plot_format.plot_format_select)
+    #def circosColor($value)
+        #set $value = str($value)
+        #set $r = int($value[1:3], 16)
+        #set $g = int($value[3:5], 16)
+        #set $b = int($value[5:], 16)
+        $r, $g, $b
+    #end def
+
+    type = ${plot_type}
+    file = data/data-${hi}.txt
+
+    r1   = ${data.r1}r
+    r0   = ${data.r0}r
+    orientation = ${data.orientation}
+
+#if str($plot_type) == 'histogram':
+    extend_bin = ${data.plot_format.format_specific.extend_bins}
+    fill_color = ${data.plot_format.format_specific.fill_color}
+#else if str($plot_type) == 'heatmap':
+    color = $circosColor($data.plot_format.format_specific.fill_color)
+    scale_log_base = ${data.plot_format.format_specific.scale_log_base}
+#else if str($plot_type) == 'line':
+    color     = $circosColor($data.plot_format.format_specific.color)
+    thickness = ${data.plot_format.format_specific.thickness}
+#else if str($plot_type) == 'scatter':
+    glyph                = ${data.plot_format.format_specific.glyph}
+    glyph_size           = ${data.plot_format.format_specific.glyph_size}
+    color                = $circosColor($data.plot_format.format_specific.color)
+    stroke_color         = $circosColor($data.plot_format.format_specific.stroke_color)
+    stroke_thickness     = ${data.plot_format.format_specific.stroke_thickness}
+#else if str($plot_type) == 'tile':
+    color                = ${data.plot_format.format_specific.color}
+    stroke_color         = $circosColor($data.plot_format.format_specific.color)
+    stroke_thickness     = ${data.plot_format.format_specific.stroke_thickness}
+    layers               = ${data.plot_format.format_specific.layers}
+    thickness            = ${data.plot_format.format_specific.thickness}
+    padding              = ${data.plot_format.format_specific.padding}
+
+    layers_overflow       = ${data.plot_format.format_specific.overflow.overflow_behavior}
+    #if str($data.plot_format.format_specific.overflow.overflow_behavior) != "hide":
+    layers_overflow_color = $circosColor($data.plot_format.format_specific.overflow.layer_overflow_color)
+    #end if
+#end if
+
+    <rules>
+    #for $rule in $data.sec_rule.rules:
+        <rule>
+            #for $condition in $rule.conditions
+                #if str($condition.application.application_select) == "1":
+                    condition = 1
+                #elif str($condition.application.application_select) == "on":
+                    #set on_str = ' '.join([ "on(%s)" % $chr.strip() for $chr in $condition.application.on_genomes.split(',') ])
+                    condition = $on_str
+                #elif str($condition.application.application_select) == "pos":
+                    #if float($condition.application.pos_gt) != 0:
+                    condition = var(start) > $condition.application.pos_gt
+                    #end if
+
+                    #if float($condition.application.pos_lt) != 0:
+                    condition = var(start) < $condition.application.pos_lt
+                    #end if
+                #elif str($condition.application.application_select) == "value":
+                    #if float($condition.application.pos_gt) != 0:
+                    condition = var(value) > $condition.application.pos_gt
+                    #end if
+
+                    #if float($condition.application.pos_lt) != 0:
+                    condition = var(value) < $condition.application.pos_lt
+                    #end if
+                #elif str($condition.application.application_select) == "var":
+                    condition = var(${condition.application.varname}) ${condition.application.cond_select} "${condition.application.varvalue}"
+                #end if
+            #end for
+
+            #for $action in $rule.actions:
+                #if str($action.action.action_select) == "fill_color_value" or str($action.action.action_select) == "color_value" :
+                    #set x_fill_color = $action.action.action_value
+                    #set x_fill_color_count = int(str($x_fill_color).split('-')[1])
+                    #set x_min = $x_fill_color_count if $action.action.invert else 1
+                    #set x_max = 1 if $action.action.invert else $x_fill_color_count
+                    #set color_action = "fill_color" if str($plot_type) == 'histogram' else "color"
+
+                    $color_action = eval(sprintf("${action.action.action_value}-%d", remap_int(var(value), ${action.action.min_value}, ${action.action.max_value}, ${x_min}, ${x_max})))
+                #else
+                    $action.action.action_select = ${action.action.action_value}
+                #end if
+            #end for
+            $rule.continue_flow
+        </rule>
+    #end for
+    </rules>
+
+    <axes>
+        #for $axis in $data.sec_axes.axes:
+        <axis>
+            color     = $circosColor($axis.color)
+            thickness = ${axis.thickness}
+            spacing   = ${axis.spacing}r
+            y0        = ${axis.y0}r
+            y1        = ${axis.y1}r
+        </axis>
+        #end for
+    </axes>
+    <backgrounds>
+        #for $bkg in $data.sec_bkgs.backgrounds:
+        <background>
+            color = $circosColor($bkg.color)
+            y0    = ${bkg.y0}r
+            y1    = ${bkg.y1}r
+        </background>
+        #end for
+    </backgrounds>
+</plot>
+#end for
+    ]]></configfile>
+  </xml>
+
+  <xml name="configfile_links_conf">
+    <configfile name="links_conf"><![CDATA[
+#for $hi, $data in enumerate($sec_links.data):
+<link>
+    #def circosColor($value)
+        #set $value = str($value)
+        #set $r = int($value[1:3], 16)
+        #set $g = int($value[3:5], 16)
+        #set $b = int($value[5:], 16)
+        $r, $g, $b
+    #end def
+
+    file = data/links-${hi}.txt
+
+    radius   = ${data.radius}r
+    ribbon   = ${data.linktype.ribbon}
+    #if $data.linktype.ribbon == 'yes'
+        ${data.linktype.twist}
+    #end if
+    color                = $circosColor($data.color)
+    bezier_radius        = ${data.bezier_radius}r
+    thickness            = ${data.thickness}
+    crest                = ${data.advanced.crest}
+    bezier_radius_purity = ${data.advanced.bezier_radius_purity}
+
+    #if $data.advanced.perturbation.perturb == 'yes'
+        perturb = yes
+        perturb_crest = ${data.advanced.perturbation.perturb_crest_min},${data.advanced.perturbation.perturb_crest_max}
+        perturb_bezier_radius = ${data.advanced.perturbation.perturb_bezier_radius_min},${data.advanced.perturbation.perturb_bezier_radius_max}
+        perturb_bezier_radius_purity = ${data.advanced.perturbation.perturb_bezier_radius_purity_min},${data.advanced.perturbation.perturb_bezier_radius_purity_max}
+    #end if
+
+    #if $data.advanced.zdepth
+        z = ${data.advanced.zdepth}
+    #end if
+
+    <rules>
+    #for $rule in $data.sec_link_rule.rules:
+        <rule>
+            #for $condition in $rule.conditions
+                #set cond = $condition.application.application_select
+                #if $cond == 'interchr' or $cond == 'intrachr' or $cond == 'inv' or $cond == 'rev'
+                    condition = var($cond)
+                #elif $cond == 'always'
+                    condition = 1
+                #else
+                    #set op = $condition.application.comparison.compare
+                    #set val = $condition.application.comparison.compval
+                    #if $cond == 'chr'
+                        #if $op == 'between' or $op == 'fromto'
+                            #set val2 = $condition.application.comparison.compval2
+                            #set c=''.join([str($op),"(",str($val),",",str($val2),")"])
+                        #else
+                            #set c=''.join([str($op),"(",str($val),")"])
+                        #end if
+                        condition = $c
+                    #else
+                        #if $cond == 'dist' and $op == 'lt'
+                            condition = abs(var(pos1) - var(pos2)) < $val
+                        #elif $cond == 'dist' and $op == 'gt'
+                            condition = abs(var(pos1) - var(pos2)) > $val
+                        #elif $op == 'lt'
+                            condition = var($cond) < $val
+                        #elif $op == 'gt'
+                            condition = var($cond) > $val
+                        #end if
+                    #end if
+                #end if
+            #end for
+
+            #for $action in $rule.actions:
+                #set actiontype = $action.action.action_select
+                #if $actiontype == 'color':
+                    #if $action.action.dynamic.dynamic_select == "static":
+                        #set actionval = $circosColor($action.action.dynamic.action_value)
+                        $actiontype = $actionval
+                    #else
+                        #set x_fill_color = $action.action.dynamic.action_value
+                        #set x_fill_color_count = int(str($x_fill_color).split('-')[1])
+                        #set x_min = $x_fill_color_count if $action.action.dynamic.invert else 1
+                        #set x_max = 1 if $action.action.dynamic.invert else $x_fill_color_count
+
+                        $actiontype = eval(sprintf("${action.action.dynamic.action_value}-%d", remap_int(var(value), ${action.action.dynamic.min_value}, ${action.action.dynamic.max_value}, ${x_min}, ${x_max})))
+                    #end if
+                #elif $actiontype == 'z':
+                    #if $action.action.dynamic.dynamic_select == "static":
+                        #set actionval = $action.action.dynamic.action_value
+                        $actiontype = $actionval
+                    #else
+                        #set x_min = 1000 if $action.action.dynamic.invert else 1
+                        #set x_max = 1 if $action.action.dynamic.invert else 1000
+                        $actiontype = eval(remap_int(var(value), ${action.action.dynamic.min_value}, ${action.action.dynamic.max_value}, ${x_min}, ${x_max}))
+                    #end if
+                #else
+                    #set actionval = $action.action.action_value
+                    $actiontype = $actionval
+                #end if
+            #end for
+
+            $rule.continue_flow
+
+        </rule>
+    #end for
+    </rules>
+</link>
+#end for
+    ]]></configfile>
+  </xml>
+
+  <xml name="test_case">
+    <configfile name="test_case_conf"><![CDATA[
+<!--
+mkdir -p test-data/my-test-case/ &&
+#if $reference_genome.reference_genome_source == 'history':
+    cp '${genome_fasta}' test-data/my-test-case/input.fa &&
+#end if
+
+#if $reference_genome.reference_genome_source != 'karyotype':
+#if $reference_genome.bands:
+cp '${reference_genome.bands}' test-data/my-test-case/bands.${reference_genome.bands.ext} &&
+#end if
+#end if
+
+#for $idx, $data in enumerate($sec_tdd.data):
+    #if str($data.plot_format.plot_format_select) in ('histogram', 'heatmap'):
+        #for $jdx, $file in enumerate($data.plot_format.data_source):
+cp '${file}' test-data/my-test-case/${idx}-${jdx}.${file.ext} &&
+        #end for
+    #else
+cp '${data.plot_format.data_source}' test-data/my-test-case/${idx}.${data.plot_format.data_source.ext} &&
+    #end if
+#end for
+cp "$output_png" test-data/my-test-case/output.png &&
+cp "$output_svg" test-data/my-test-case/output.svg &&
+-->
+<test>
+    <param name="reference_genome|reference_genome_source" value="${reference_genome.reference_genome_source}"/>
+    <param name="reference_genome|genome_fasta" value="my-test-case/input.fa" />
+    <!-- ideograms -->
+    <param name="ideogram|spacing" value="${ideogram.spacing}" />
+    <param name="ideogram|radius" value="${ideogram.radius}" />
+    <param name="ideogram|thickness" value="${ideogram.thickness}" />
+    <param name="ideogram|ideogram_labels|show_label" value="${ideogram.ideogram_labels.show_label}" />
+    <param name="ideogram|ideogram_labels|parallel" value="${ideogram.ideogram_labels.parallel}" />
+    #if $reference_genome.reference_genome_source != 'karyotype':
+    #if $reference_genome.bands:
+    <param name="reference_genome.bands" value="my-test-case/bands.${reference_genome.bands.ext}" />
+    #end if
+    #end if
+    <!-- Ticks -->
+    <param name="ticks|show_ticks" value="${ticks.show_ticks}" />
+    <param name="ticks|radius" value="${ticks.radius}" />
+    <param name="ticks|color" value="${ticks.color}" />
+    <param name="ticks|multiplier" value="${ticks.multiplier}" />
+    #for $idx, $tick_group in enumerate($ticks.tick_group):
+    <param name="ticks|tick_group_${idx}|tickspacing" value="${tick_group.spacing}" />
+    <param name="ticks|tick_group_${idx}|size" value="${tick_group.size}" />
+    <param name="ticks|tick_group_${idx}|show_tick_labels" value="${tick_group.show_tick_labels}" />
+    <param name="ticks|tick_group_${idx}|label_size" value="${tick_group.label_size}" />
+    <param name="ticks|tick_group_${idx}|label_offset" value="${tick_group.label_offset}" />
+    <param name="ticks|tick_group_${idx}|label_format" value="${tick_group.format}" />
+    #end for
+    <!-- Data -->
+    #for $idx, $data_group in enumerate($sec_tdd.data):
+    <param name="sec_tdd|data_${idx}|r0" value="${data_group.r0}" />
+    <param name="sec_tdd|data_${idx}|r1" value="${data_group.r1}" />
+    <param name="sec_tdd|data_${idx}|orientation" value="${data_group.orientation}" />
+    <param name="sec_tdd|data_${idx}|plot_format|plot_format_select" value="${data_group.plot_format.plot_format_select}" />
+        <!-- Note, please double check your files -->
+    #if str($data_group.plot_format.plot_format_select) == 'histogram':
+        #set my_files = ','.join([ "my-test-case/%s-%s.%s" % ($idx, $j, $file.ext) for ($j, $file) in enumerate($data_group.plot_format.data_source)])
+        <param name="sec_tdd|data_${idx}|plot_format|data_source" value="${my_files}" />
+        <param name="sec_tdd|data_${idx}|plot_format|format_specific|fill_color" value="${data_group.plot_format.format_specific.fill_color}" />
+        <param name="sec_tdd|data_${idx}|plot_format|format_specific|extend_bins" value="${data_group.plot_format.format_specific.extend_bins}" />
+    #else if str($data_group.plot_format.plot_format_select) == 'heatmap':
+        #set my_files = ','.join([ "my-test-case/%s-%s.%s" % ($idx, $j, $file.ext) for ($j, $file) in enumerate($data_group.plot_format.data_source)])
+        <param name="sec_tdd|data_${idx}|plot_format|data_source" value="${my_files}" />
+        <param name="sec_tdd|data_${idx}|plot_format|format_specific|fill_color" value="${data_group.plot_format.format_specific.fill_color}" />
+        <param name="sec_tdd|data_${idx}|plot_format|format_specific|scale_log_base" value="${data_group.plot_format.format_specific.scale_log_base}" />
+    #else if str($data_group.plot_format.plot_format_select) == 'line':
+        <param name="sec_tdd|data_${idx}|plot_format|data_source" value="my-test-case/${idx}.${data.plot_format.data_source.ext}" />
+        <param name="sec_tdd|data_${idx}|plot_format|format_specific|color" value="${data_group.plot_format.format_specific.color}" />
+        <param name="sec_tdd|data_${idx}|plot_format|format_specific|stroke" value="${data_group.plot_format.format_specific.stroke}" />
+    #else if str($data_group.plot_format.plot_format_select) == 'scatter':
+        <param name="sec_tdd|data_${idx}|plot_format|data_source" value="my-test-case/${idx}.${data.plot_format.data_source.ext}" />
+        <param name="sec_tdd|data_${idx}|plot_format|format_specific|glyph" value="${data_group.plot_format.format_specific.glyph}" />
+        <param name="sec_tdd|data_${idx}|plot_format|format_specific|glyph_size" value="${data_group.plot_format.format_specific.glyph_size}" />
+        <param name="sec_tdd|data_${idx}|plot_format|format_specific|data_min" value="${data_group.plot_format.format_specific.data_min}" />
+        <param name="sec_tdd|data_${idx}|plot_format|format_specific|data_max" value="${data_group.plot_format.format_specific.data_max}" />
+        <param name="sec_tdd|data_${idx}|plot_format|format_specific|color" value="${data_group.plot_format.format_specific.color}" />
+        <param name="sec_tdd|data_${idx}|plot_format|format_specific|stroke_color" value="${data_group.plot_format.format_specific.stroke_color}" />
+        <param name="sec_tdd|data_${idx}|plot_format|format_specific|stroke_thickness" value="${data_group.plot_format.format_specific.stroke_thickness}" />
+    #else if str($data_group.plot_format.plot_format_select) == 'tile':
+        <param name="sec_tdd|data_${idx}|plot_format|data_source" value="my-test-case/${idx}.${data.plot_format.data_source.ext}" />
+        <param name="sec_tdd|data_${idx}|plot_format|format_specific|fill_color" value="${data_group.plot_format.format_specific.fill_color}" />
+        <param name="sec_tdd|data_${idx}|plot_format|format_specific|color" value="${data_group.plot_format.format_specific.color}" />
+        <param name="sec_tdd|data_${idx}|plot_format|format_specific|stroke_thickness" value="${data_group.plot_format.format_specific.stroke_thickness}" />
+        <param name="sec_tdd|data_${idx}|plot_format|format_specific|layers" value="${data_group.plot_format.format_specific.layers}" />
+        <param name="sec_tdd|data_${idx}|plot_format|format_specific|thickness" value="${data_group.plot_format.format_specific.thickness}" />
+        <param name="sec_tdd|data_${idx}|plot_format|format_specific|padding" value="${data_group.plot_format.format_specific.padding}" />
+        <param name="sec_tdd|data_${idx}|plot_format|format_specific|overflow|overflow_behavior" value="${data_group.plot_format.format_specific.overflow.overflow_behavior}" />
+        #if str($data_group.plot_format.format_specific.overflow.overflow_behavior) != 'hide':
+        <param name="sec_tdd|data_${idx}|plot_format|format_specific|overflow|layer_overflow_color" value="${data_group.plot_format.format_specific.overflow.layer_overflow_color}" />
+        #end if
+    #end if
+    ## Next line intentionally blank
+
+    #end for
+
+    <!-- Outputs -->
+    <output name="output_png" file="my-test-case/output.png" />
+    <output name="output_svg" file="my-test-case/output.svg" />
+</test>
+    ]]></configfile>
+  </xml>
+</macros>