view macros_conffiles.xml @ 2:014a21767ac4 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit 076837a2e9c2b6ececcea4aa286ea7a412387a96"
author iuc
date Tue, 17 Sep 2019 16:54:57 -0400
parents ef5f8bbf7730
children 184dfd9e113d
line wrap: on
line source

<?xml version="1.0"?>
<macros>
  <xml name="configfile_circos_conf">
    <configfile name="circos_conf"><![CDATA[
@UTILS@

<<include colors_fonts_patterns.conf>>
<<include housekeeping.conf>>

<colors>
<<include karyotype-colors.conf>>

#for $hi, $data in enumerate($sec_tdd.data):
    #set plot_type = str($data.plot_format.plot_format_select)
    #if str($plot_type) == 'tile':
        color-tile-$hi = $circosColor($data.plot_format.format_specific.fill_color)
    #end if
#end for
</colors>

karyotype = karyotype.txt
#if str($ideogram.units) == 'bases':
chromosomes_units = 1
#else if str($ideogram.units) == 'kb':
chromosomes_units = 1000
#else if str($ideogram.units) == 'mb':
chromosomes_units = 1000000
#else:
chromosomes_units = 1000000000
#end if

#if $ideogram.limit_chromosomes:
chromosomes = $ideogram.limit_chromosomes
chromosomes_order = $chromosomesToOrder($ideogram.limit_chromosomes)
chromosomes_display_default = no
#end if

#if $ideogram.chromosomes_reverse:
chromosomes_reverse = $ideogram.chromosomes_reverse
#end if

<image>
  # Transcluded from etc/image.generic.conf
  dir                = .
  file               = circos.png
#if $outputs.png:
  png                = yes
#end if
#if $outputs.svg:
  svg                = yes
#end if
  # by default angle = 0 is at 3 o'clock position
  angle_offset       = -90
  auto_alpha_colors  = yes
  auto_alpha_steps   = 5
#if str($plot_options.background.background_select) == 'transparent':
  background         = transparent
#else
  background         = $circosColor($plot_options.background.background_color)
#end if
  radius*            = ${plot_options.radius}p
</image>

<<include ticks.conf>>
<<include ideogram.conf>>
<<include data.conf>>
<<include highlight.conf>>
<<include links.conf>>

    ]]></configfile>
  </xml>
  <xml name="configfile_ticks_conf">
    <configfile name="ticks_conf"><![CDATA[
@UTILS@

show_ticks          = ${ticks.show_ticks}
show_tick_labels    = yes


<ticks>
    radius           = ${ticks.radius}r
    color            = black
    skip_first_label = ${ticks.skip_first_label}
    skip_last_label  = ${ticks.skip_last_label}
    thickness        = 2p

    # Multiplier controls how 'u' behaves when used in numbers.
    #if str($ideogram.units) == 'bases':
    multiplier       = 1
    #else if str($ideogram.units) == 'kb':
    multiplier       = 1e-3
    #else if str($ideogram.units) == 'mb':
    multiplier       = 1e-6
    #else if str($ideogram.units) == 'gb':
    multiplier       = 1e-9
    #end if

    #for $tick_group in $ticks.tick_group:
    <tick>
        spacing        = ${tick_group.spacing}
        size           = ${tick_group.size}p
        show_label     = ${tick_group.ticks.show_tick_labels}
        color          = $circosColor($tick_group.color)

      #if str($tick_group.ticks.show_tick_labels) == 'yes':
        label_size     = ${tick_group.ticks.label_size}p
        label_offset   = ${tick_group.ticks.label_offset}p
      #if $tick_group.ticks.format_ext:
       #if str($ideogram.units) == 'bases':
        format         = ${tick_group.ticks.format}
       #else if str($ideogram.units) == 'kb':
        format         = ${tick_group.ticks.format} Kb
       #else if str($ideogram.units) == 'mb':
        format         = ${tick_group.ticks.format} Mb
       #else if str($ideogram.units) == 'gb':
        format         = ${tick_group.ticks.format} Gb
       #end if
      #else
        format = ${tick_group.ticks.format}
    #end if
      #end if
    </tick>
    #end for
</ticks>
]]>
    </configfile>
  </xml>
  <xml name="configfile_ideogram_conf">
    <configfile name="ideogram_conf"><![CDATA[
@UTILS@
<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) + ${ideogram.ideogram_labels.radius_offset}r
    label_size       = ${ideogram.ideogram_labels.size}
    label_parallel   = ${ideogram.ideogram_labels.parallel}

  #if $ideogram.bands.bands:
    show_bands            = yes
  #else
    show_bands            = no
  #end if
    fill_bands            = ${ideogram.bands.fill_bands}
  #if int($ideogram.bands.band_transparency) > 0:
    band_transparency     = ${ideogram.bands.band_transparency}
  #end if
    band_stroke_color     = $circosColor($ideogram.bands.band_stroke_color)
    band_stroke_thickness = ${ideogram.bands.band_stroke_thickness}
</ideogram>
]]></configfile>
  </xml>
  <xml name="configfile_highlight_conf">
    <configfile name="highlight_conf"><![CDATA[
@UTILS@
<highlights>
#for $hi, $data in enumerate($sec_highlight.data):
    <highlight>
    file       = data/highlight-${hi}.txt # ${data.data_source.element_identifier}
    r1         = ${data.r1}r
    r0         = ${data.r0}r
    fill_color = $circosColor($data.fill_color)

    <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 $condition.application.pos_gt:
                    condition = var(start) > $condition.application.pos_gt
                    #end if

                    #if $condition.application.pos_lt:
                        #if $condition.application.pos_lt_sub == 'yes':
                    condition = var(end) < chrlen(var(chr)) - $condition.application.pos_lt
                        #else
                    condition = var(end) < $condition.application.pos_lt
                        #end if
                    #end if
                #elif str($condition.application.application_select) == "value":
                    #if $condition.application.pos_gt:
                    condition = var(value) > $condition.application.pos_gt
                    #end if

                    #if $condition.application.pos_lt:
                    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}"
                #elif str($condition.application.application_select) == "random":
                    condition = rand() < ${condition.application.value}
                #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) in ('histogram', 'histogram-stacked') 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 = $circosColor($action.action.action_value)
                #end if
            #end for
            $rule.continue_flow
        </rule>
    #end for
    </rules>
    </highlight>
#end for
</highlights>
 ]]></configfile>
  </xml>


  <xml name="configfile_data_conf">
    <configfile name="data_conf"><![CDATA[
<plots>
@UTILS@

#for $hi, $data in enumerate($sec_tdd.data):
<plot>
    #set plot_type = str($data.plot_format.plot_format_select)
    file        = data/data-${hi}.txt # ${data.plot_format.data_source.element_identifier}
    r1          = ${data.r1}r
    r0          = ${data.r0}r
    orientation = ${data.orientation}
    #if str($data.minmax.minmax_select) == 'yes':
    min         = ${$data.minmax.min_value}
    max         = ${$data.minmax.max_value}
    #end if

#if str($plot_type) in ('histogram', 'histogram-stacked'):
    type       = histogram
    extend_bin = ${data.plot_format.format_specific.extend_bins}
    #if str($plot_type) == 'histogram':
    fill_color = $circosColorAlpha($data.plot_format.format_specific.fill_color, $data.plot_format.format_specific.fill_color_alpha)
    #else:
    fill_color = $data.plot_format.format_specific.fill_color
    #end if
    fill_under = ${data.plot_format.format_specific.fill_under}
    color      = $circosColorAlpha($data.plot_format.format_specific.stroke_color, $data.plot_format.format_specific.stroke_color_alpha)
    thickness  = ${data.plot_format.format_specific.stroke_thickness}
#else if str($plot_type) == 'heatmap':
    type       = ${plot_type}
    color      = ${data.plot_format.format_specific.fill_color}
    scale_log_base = ${data.plot_format.format_specific.scale_log_base}
#else if str($plot_type) == 'line':
    type       = ${plot_type}
    color      = $circosColor($data.plot_format.format_specific.stroke_color)
    thickness  = ${data.plot_format.format_specific.stroke_thickness}
#else if str($plot_type) == 'scatter':
    type             = ${plot_type}
    glyph            = ${data.plot_format.format_specific.glyph}
    glyph_size       = ${data.plot_format.format_specific.glyph_size}
    # So this option is ignored, and we have added an always-on rule in the
    # first place to override the colour. This is because this color option will
    # only accept named colours, while you can override the colour in a rule
    # block with an RGB colour.
    #
    # Additionally it is named "color" in a scatter track whilst in the rule
    # you must override it with "fill_color"
    color            = $circosColor($data.plot_format.format_specific.fill_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':
    type                  = ${plot_type}
    color                 = color-tile-$hi
    stroke_color          = $circosColor($data.plot_format.format_specific.stroke_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}
    margin                = ${data.plot_format.format_specific.margin}u
    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
#else if str($plot_type) == 'text':
    type           = ${plot_type}
  #if $data.plot_format.format_specific.link.show_link == "yes":
    show_links     = yes
    link_dims      = ${data.plot_format.format_specific.link.link_dims}
    link_thickness = ${data.plot_format.format_specific.link.link_thickness}p
    link_color     = ${data.plot_format.format_specific.link.link_color}
  #else
    show_links     = no
  #end if

  #if $data.plot_format.format_specific.snuggle.label_snuggle == "yes":
    label_snuggle                  = ${data.plot_format.format_specific.snuggle.label_snuggle}
    max_snuggle_distance           = ${data.plot_format.format_specific.snuggle.max_snuggle_distance}r
    snuggle_sampling               = ${data.plot_format.format_specific.snuggle.snuggle_sampling}
    snuggle_tolerance              = ${data.plot_format.format_specific.snuggle.snuggle_tolerance}r
    snuggle_link_overlap_test      = ${data.plot_format.format_specific.snuggle.snuggle_link_overlap_test}
    snuggle_link_overlap_tolerance = ${data.plot_format.format_specific.snuggle.snuggle_link_overlap_tolerance}p
    snuggle_refine = ${data.plot_format.format_specific.snuggle.snuggle_refine}
  #end if

    label_size     = ${data.plot_format.format_specific.label_size}p
    label_font     = condensed
    padding        = 0p
    rpadding       = 0p
#end if

    <rules>
    #if str($plot_type) == 'scatter':
        <rule>
            # Workaround for above commented colour bug.
            condition  = 1
            fill_color = $circosColor($data.plot_format.format_specific.fill_color)
            flow       = continue
        </rule>
    #end if
    #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 $condition.application.pos_gt:
                    condition = var(start) > $condition.application.pos_gt
                    #end if

                    #if $condition.application.pos_lt:
                    condition = var(start) < $condition.application.pos_lt
                    #end if
                #elif str($condition.application.application_select) == "value":
                    #if $condition.application.pos_gt:
                    condition = var(value) > $condition.application.pos_gt
                    #end if

                    #if $condition.application.pos_lt:
                    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) in ('histogram', 'histogram-stacked') 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})))
                #elif str($action.action.action_select) in ('fill_color', 'stroke_color'):
                    #if str($plot_type) in ('tile', ):
                        color = $circosColor($action.action.action_value)
                    #else:
                        #if str($action.action.action_select) == "stroke_color" and str($plot_type) == "histogram":
                        color = $circosColor($action.action.action_value)
                        #else
                        $action.action.action_select = $circosColor($action.action.action_value)
                        #end if
                    #end if
                #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
</plots>
    ]]></configfile>
  </xml>

  <xml name="configfile_links_conf">
    <configfile name="links_conf"><![CDATA[
@UTILS@
<links>
#for $hi, $data in enumerate($sec_links.data):
<link>
    file                 = data/links-${hi}.txt
    radius               = ${data.radius}r
    ribbon               = ${data.linktype.ribbon}
  #if $data.linktype.ribbon == 'yes'
    ${data.linktype.twist}
   #if $data.linktype.pattern != 'solid':
    pattern              = ${data.linktype.pattern}
   #end if
  #end if
    color                = $circosColorAlpha($data.color, $data.color_alpha)
    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
                #elif $cond == 'random'
                    condition = rand() < ${condition.application.value}
                #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),")"])
                        #elif $op == 'on'
                            #set c='(var(chr1) eq "%s" or var(chr2) eq "%s")' % (str($val), str($val))
                        #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 = $circosColorAlpha($action.action.dynamic.action_value, $action.action.dynamic.action_value_alpha)
                        $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
</links>
    ]]></configfile>
  </xml>

  <xml name="test_case">
    <inputs name="test_case_conf" />
  </xml>
</macros>