view macros_conffiles.xml @ 10:7f13dc906cb9 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit 164c36ba98fe4cd293e035efca00a9efa885a7ec"
author iuc
date Mon, 11 Oct 2021 10:09:51 +0000
parents 740057a5126d
children
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>>

max_ticks*            = ${limits.max_ticks}
max_ideograms*        = ${limits.max_ideograms}
max_links*            = ${limits.max_links}
max_points_per_track* = ${limits.max_points_per_track}

<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       = ${ideogram.angle_offset}
  angle_orientation  = ${ideogram.angle_orientation}
  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>

<zooms>
  #for zoom in $scaling.zooms:
    <zoom>
        chr   = ${zoom.chr}
        start = ${zoom.start}u
        end   = ${zoom.end}u
        scale = ${zoom.scale}
    </zoom>
  #end for
</zooms>

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

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

show_ticks          = yes
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}u
        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}u

        #for pairwise in $ideogram.pairwise_spacing
        <pairwise ${pairwise.chr1} ${pairwise.chr2}>
            spacing = ${pairwise.spacing}u
        </pairwise>
        #end for
    </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.show_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_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
    #if str($data.zdepth) != '':
    z           = ${data.zdepth}
    #end if
    orientation = ${data.orientation}
    #if str($data.minmax.minmax_select) == 'yes':
    min         = ${$data.minmax.min_value}
    max         = ${$data.minmax.max_value}
    #end if
    minsize     = ${data.minsize}u

#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) == 'highlight':
    type       = ${plot_type}
    fill_color = $circosColorAlpha($data.plot_format.format_specific.fill_color, $data.plot_format.format_specific.fill_color_alpha)
    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.color_scale.fill_color}
    color_mapping = ${data.plot_format.format_specific.color_mapping}  # http://www.circos.ca/documentation/tutorials/2d_tracks/heat_maps/
    scale_log_base = ${data.plot_format.format_specific.scale_log_base}
    stroke_color     = $circosColorAlpha($data.plot_format.format_specific.stroke_color, $data.plot_format.format_specific.stroke_color_alpha)
    stroke_thickness = ${data.plot_format.format_specific.stroke_thickness}
#else if str($plot_type) == 'line':
    type       = ${plot_type}
    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) == 'connector':
    type       = ${plot_type}
    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}
    connector_dims = ${data.plot_format.format_specific.connector_dims}
#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            = $circosColorAlpha($data.plot_format.format_specific.fill_color, $data.plot_format.format_specific.fill_color_alpha)
    stroke_color     = $circosColorAlpha($data.plot_format.format_specific.stroke_color, $data.plot_format.format_specific.stroke_color_alpha)
    stroke_thickness = ${data.plot_format.format_specific.stroke_thickness}
#else if str($plot_type) == 'tile':
    type                  = ${plot_type}
    color                 = color-tile-$hi
    stroke_color          = $circosColorAlpha($data.plot_format.format_specific.stroke_color, $data.plot_format.format_specific.stroke_color_alpha)
    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 = $circosColorAlpha($data.plot_format.format_specific.fill_color, $data.plot_format.format_specific.fill_color_alpha)
            flow       = continue
        </rule>
    #end if
    #for $rule in $data.sec_rule.rules:
        <rule>
            #for $condition in $rule.conditions
                #set cond = $condition.application.application_select
                #if $cond == "always":
                    condition = 1
                #elif $cond == 'random'
                    condition = rand() < ${condition.application.value}
                #elif $cond == "on":
                    #set on_str = ' '.join([ "on(%s)" % $chr.strip() for $chr in $condition.application.on_genomes.split(',') ])
                    condition = $on_str
                #elif $cond == "pos":
                    #if str($condition.application.pos_gt) != '':
                    condition = var(start) > $condition.application.pos_gt
                    #end if

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

                    #if str($condition.application.pos_lt) != '':
                    condition = var(value) < $condition.application.pos_lt
                    #end if
                #elif $cond == "var":
                    condition = var(${condition.application.varname}) ${condition.application.cond_select} "${condition.application.varvalue}"
                #else
                    condition = 0 # Error: the Galaxy devs forgot a case
                #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>
        #if str($data.sec_axes.only_if_data) == "data":
        show  = data
        #end if
        #for $axis in $data.sec_axes.axes:
        <axis>
            color     = $circosColorAlpha($axis.color, $axis.color_alpha)
            thickness = ${axis.thickness}
            #if str($axis.radial_position.select) == 'plot':
            spacing   = ${axis.radial_position.spacing}r
            y0        = ${axis.y0}r
            y1        = ${axis.y1}r
            #else:
            spacing   = ${axis.radial_position.spacing}
            y0        = ${axis.y0}
            y1        = ${axis.y1}
            #end if
        </axis>
        #end for
    </axes>
    <backgrounds>
        #if str($data.sec_bkgs.only_if_data) == "data":
        show  = data
        #end if
        #for $bkg in $data.sec_bkgs.backgrounds:
        <background>
            color = $circosColorAlpha($bkg.color, $bkg.color_alpha)
            #if str($bkg.radial_position.select) == 'plot':
            y0    = ${bkg.radial_position.y0}r
            y1    = ${bkg.radial_position.y1}r
            #else:
            y0    = ${bkg.radial_position.y0}
            y1    = ${bkg.radial_position.y1}
            #end if
        </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 # ${data.data_source.element_identifier}
    radius               = ${data.radius}r
    z                    = ${data.zdepth}
    ribbon               = ${data.linktype.ribbon}
    minsize              = ${data.minsize}u
  #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

    <rules>
    #for $rule in $data.sec_link_rule.rules:
        <rule>
            #for $condition in $rule.conditions
                #set cond = $condition.application.application_select
                #if $cond == 'always'
                    condition = 1
                #elif $cond == 'random'
                    condition = rand() < ${condition.application.value}
                #elif $cond == 'interchr' or $cond == 'intrachr' or $cond == 'inv' or $cond == 'rev'
                    condition = var($cond)
                #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
                            condition = ${op}(${val}, ${val2})
                        #elif $op == 'on'
                            condition = var(chr1) eq "${val}" or var(chr2) eq "${val}"
                        #else
                            condition = ${op}(${val})
                        #end if
                    #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 in ('color', 'stroke_color'):
                    #if $action.action.dynamic.dynamic_select == "static":
                        #set actionval = $circosColorAlpha($action.action.dynamic.action_value, $action.action.dynamic.action_value_alpha)
                        $actiontype = $actionval
                    #elif $action.action.dynamic.dynamic_select == 'source':
                        $actiontype = eval(var(chr1))
                    #elif $action.action.dynamic.dynamic_select == 'dest':
                        $actiontype = eval(var(chr2))
                    #end if
                #elif $actiontype == 'z':
                    #if $action.action.dynamic.dynamic_select == "static":
                        $actiontype = ${action.action.dynamic.action_value}
                    #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
                #elif $actiontype == 'value_from_attr':
                    value = var(${action.action.action_value})
                #else
                    $actiontype = ${action.action.action_value}
                #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>