view circos.xml @ 8:e6cbe3190642 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit cc96dd4a8aef7d0b6d3057024af0344ab8a9410f"
author iuc
date Fri, 12 Jun 2020 10:39:58 -0400
parents 4b519282a05b
children df7356989ac1
line wrap: on
line source

<?xml version="1.0"?>
<tool id="circos" name="Circos" version="@WRAPPER_VERSION@">
    <description>visualizes data in a circular layout</description>
    <xrefs>
        <xref type="bio.tools">galactic_circos</xref>
        <!--<xref type="bioconda">circos</xref>-->
        <!--<xref type="rrid">RRID:SCR_018207</xref>-->
    </xrefs>
    <macros>
        <import>macros.xml</import>
        <import>macros_conffiles.xml</import>
        <import>macros_tests.xml</import>
    </macros>
    <expand macro="requirements"/>
    <version_command>circos --version</version_command>
    <stdio>
      <!-- Anything other than zero is an error -->
      <exit_code range="1:"/>
      <exit_code range=":-1"/>
      <!-- In case the return code has not been set propery check stderr too -->
      <regex match="Circos::Error::fatal_error.* called at"/>
    </stdio>
    <command><![CDATA[
## Directory structure
mkdir -p circos/conf/ circos/data/ &&

#if $reference_genome.ref.ref_source == 'history':
    ln -s '$reference_genome.ref.genome_fasta' genomeref.fa &&
#end if

#if $reference_genome.ref.ref_source in ('lengths', 'cached'):
    python '$__tool_directory__/karyotype-from-lengths.py'
        #if $reference_genome.ref.ref_source == 'lengths':
            ${reference_genome.ref.input_lengths}'
        #else
            #if $ideogram.limit_chromosomes:
                ## If they are limiting the chromosomes, ensure they have access to the full list
                '${reference_genome.ref.fasta_indexes.fields.len_path}'
            #else
                ## Otherwise only the reduced list, as the full list will often overwhelm circos
                <(head -n 50 '${reference_genome.ref.fasta_indexes.fields.len_path}')
            #end if
        #end if
        > circos/conf/karyotype.txt &&
#else if $reference_genome.ref.ref_source == 'karyotype':
    cp $reference_genome.ref.input_karyotype circos/conf/karyotype.txt &&
#else if str($reference_genome.ref.ref_source) == 'history':
    ## Process the karyotype.txt file
    python
        '$__tool_directory__/karyotype-from-fasta.py'
        genomeref.fa
        > circos/conf/karyotype.txt &&
#else if $reference_genome.ref.ref_source == 'preset':
    cp '$__tool_directory__/karyotype/'${reference_genome.ref.preset_karyotype} circos/conf/karyotype.txt &&
#end if

python '$__tool_directory__/karyotype-colors.py' `grep -c '^chr\s' 'circos/conf/karyotype.txt'`
    > 'circos/conf/karyotype-colors.conf' &&

touch circos/conf/karyotype-colors.conf &&

## #if $ideogram.bands.bands:
##     #if $ideogram.bands.convert_bands:
##         python '$__tool_directory__/process-cytogenetic-bands.py'
##             '${ideogram.bands.bands}'
##             >> circos/conf/karyotype.txt
##             2> circos/conf/karyotype-colors.conf &&
##     #else
##         cat '${ideogram.bands.bands}'
##             >> circos/conf/karyotype.txt &&
##     #end if
## #end if

#if $plot_options.colour_profile:
    #if str($plot_options.colour_profile) == 'cg':
        cat '$__tool_directory__/colours/cg.conf' >> circos/conf/karyotype-colors.conf &&
    #end if
#end if

cp '$circos_conf' circos/conf/circos.conf &&
cp '$ticks_conf' circos/conf/ticks.conf &&
cp '$ideogram_conf' circos/conf/ideogram.conf &&
cp '$data_conf'  circos/conf/data.conf &&
cp '$links_conf'  circos/conf/links.conf &&
cp '$test_case_conf' circos/conf/galaxy_test_case.json &&

## 2D Data Plots
#for $hi, $data in enumerate($sec_tdd.data):
    cp '${data.plot_format.data_source}' circos/data/data-${hi}.txt &&
#end for

## Link Tracks
#for $hi, $data in enumerate($sec_links.data):
    cp '${data.data_source}' circos/data/links-${hi}.txt &&
#end for

#if $outputs.tar == "yes"
    tar -czf circos.tar.gz circos &&
#end if

#if $outputs.svg == "yes" or $outputs.png == "yes":
    circos -conf circos/conf/circos.conf -noparanoid
#end if
    ]]></command>
    <configfiles>
        <expand macro="configfile_circos_conf" />
        <expand macro="configfile_ticks_conf" />
        <expand macro="configfile_ideogram_conf" />
        <expand macro="configfile_data_conf" />
        <expand macro="configfile_links_conf" />
        <expand macro="test_case" />
    </configfiles>
    <inputs>
        <section name="reference_genome" title="Karyotype" expanded="true">
            <conditional name="ref">
                <param name="ref_source" type="select" label="Reference Genome Source">
                    <option value="preset" selected="True">Circos Presets</option>
                    <option value="history"> FASTA File from History (can be slow, generate a length file to improve execution time.)</option>
                    <option value="cached">Locally Cached</option>
                    <option value="karyotype">Custom Karyotype</option>
                    <option value="lengths">Lengths File</option>
                </param>
                <!--
                     This does not work at all for us. Many dbkeys lengths simply have too many contigs that are completely irrelevant for 99% of plotting operations. Our options were:

                     - picking for the user (will never be right)
                     - picking some N contigs (also never right)
                     - regex (eww, and requires users to know thje names of things in the data table which is not exposed to user ever.)
                     - built in custom filters we'd have to maintain
                     - some code files (see meme_chip.xml, doesn't work there.)

                     - using one of the legacy chromosomes that doesn't include detritus

                     But none of the optinos work well or uniformly, so, no. We're forced to remove this as an option completely.

                -->
                <when value="preset">
                    <param name="preset_karyotype" type="select" label="Choose your Circos karyotype" help="In parentheses are the naming conventions for chromosomes used in each karyotype file. These are required for some plot parameters (e.g. filtering chromosomes or specifying rules). The karyotype will also be output along with your plot, for your review.">
                        <option value="karyotype.arabidopsis.tair10.txt">Arabidopsis tair10 (chr1,chr2,..)</option>
                        <option value="karyotype.chimp.pt4.txt">Chimp pt4 (pt1,pt2a,pt2b,..)</option>
                        <option value="karyotype.drosophila.dm6.hires.txt">Drosophila dm6 (M,X,Y,2L,2R,..)</option>
                        <option value="karyotype.drosophila.hires.dm3.txt">Drosophila dm3 (dmX,dm2l,dm2r,..)</option>
                        <option value="karyotype.human.hg38.txt" selected="True">Human hg38 (hs1,hs2,..,hsX,hsY)</option>
                        <option value="karyotype.human.hg19.txt">Human hg19 (hs1,hs2,..,hsX,hsY)</option>
                        <option value="karyotype.human.hg18.txt">Human hg18 (hs1,hs2,..,hsX,hsY)</option>
                        <option value="karyotype.human.hg17.txt">Human hg17 (hs1,hs2,..,hsX,hsY)</option>
                        <option value="karyotype.human.hg16.txt">Human hg16 (hs1,hs2,..,hsX,hsY)</option>
                        <option value="karyotype.mouse.mm10.txt">Mouse mm10 (mm1,mm2,..)</option>
                        <option value="karyotype.mouse.mm9.txt">Mouse mm9 (mm1,mm2,..)</option>
                        <option value="karyotype.oryzasativa.txt">Oryzasativa (os1,os2,..)</option>
                        <option value="karyotype.rat.rn4.txt">Rat rn4 (rn1,rn2,..)</option>
                        <option value="karyotype.sorghum.txt">Sorghum (sb1,sb2,..)</option>
                        <option value="karyotype.yeast.txt">Yeast (chrI, chrII,..)</option>
                        <option value="karyotype.zeamays.txt">Zeamays (zm1,zm2,..)</option>
                    </param>
                </when>
                <when value="cached">
                    <param name="fasta_indexes" type="select" label="Source Genome Build" help="Warning: this also contains unplaced scaffolds present in the reference genome. You can restrict the regions to plot in 'Limit/Filter Chromosomes' below, or supply your own file.">
                        <options from_data_table="__dbkeys__"/>
                    </param>
                </when>
                <when value="history">
                    <param name="genome_fasta" type="data" format="fasta" label="Source FASTA Sequence"/>
                </when>
                <when value="karyotype">
                    <param name="input_karyotype" type="data" format="tabular,txt" label="Karyotype Configuration" help="Provide your own karyotype configuration. Should be 'chr - ID LABEL START END COLOR'"/>
                </when>
                <when value="lengths">
                    <param name="input_lengths" type="data" format="tabular" label="Sequence Lengths" help="This needs to be a 2+ column tabular, e.g. from 'Compute sequence lengths', the first column should be chromosome and second should be length."/>
                </when>
            </conditional>
        </section>

        <section name="ideogram" title="Ideogram">
            <param name="limit_chromosomes" type="text" optional="true" label="Limit/Filter and Order Chromosomes" help="For example: 'hs1;hs2;hs3' or 'chr1:1-1000;chr2:3000-9000' to plot only a subset of regions. The chromosome names must match those in your karyotype file. They will be displayed in this order as well, you will need to specify all chromosomes that you wish to plot. The numerical positions are in terms of chromosome units (whatever this is set to)">
                <sanitizer>
                    <valid initial="string.letters,string.digits">
                        <add value=","/>
                        <add value="_"/>
                        <add value="."/>
                        <add value=":"/>
                        <add value=";"/>
                        <add value="-"/>
                    </valid>
                </sanitizer>
            </param>
            <param name="chromosomes_reverse" type="text" optional="true" label="Reverse these Chromosomes" help="Important: If you set this, you will need to set the 'Limit/Filter Chromosomes' option (above) as well">
                <sanitizer>
                    <valid initial="string.letters,string.digits">
                        <add value=","/>
                        <add value="_"/>
                        <add value="."/>
                        <add value=":"/>
                        <add value=";"/>
                        <add value="-"/>
                    </valid>
                </sanitizer>
            </param>

            <param name="units" type="select" label="Chromosome units" help="Setting this to MB allows usage of numbers like 5u to represent 5MB, rather than having to specify 5000000 or 5e6">
                <option value="bases">Bases</option>
                <option value="kb">Kilobases</option>
                <option value="mb" selected="true">Megabases</option>
                <option value="gb">Gigabases</option>
            </param>

            <param name="spacing" value="0.5" type="float" min="0" label="Spacing Between Ideograms (in chromosome units)"/>
            <repeat name="pairwise_spacing" title="Spacing between specific ideograms">
                <param name="chr1" type="text" label="Chromosome" help="as written in your karyotype file">
                    <sanitizer>
                        <valid initial="string.letters,string.digits">
                            <add value="_"/>
                            <add value="."/>
                            <add value="-"/>
                        </valid>
                    </sanitizer>
                </param>

                <param name="chr2" type="text" label="Chromosome" help="as written in your karyotype file">
                    <sanitizer>
                        <valid initial="string.letters,string.digits">
                            <add value="_"/>
                            <add value="."/>
                            <add value="-"/>
                        </valid>
                    </sanitizer>
                </param>

                <param name="spacing" type="float" min="0" label="Spacing between these two ideograms (in chromosome units)" value="1" />
            </repeat>

            <param name="radius" type="float" value="0.90" label="Radius" min="0"/>
            <param name="thickness" type="float" value="30" label="Thickness" min="0"/>
            <param name="angle_offset" type="integer" min="-180" max="180" value="-90" label="Angle Offset" help="Rotate the plot such that the first ideogram is at the top center of the page."/>
            <param name="angle_orientation" type="select" label="Angle orientation" help="Chromosomes are plotted clockwise around the chromosome" >
                <option value="clockwise">Clockwise</option>
                <option value="counterclockwise">Counterclockwise</option>
            </param>

            <section name="ideogram_labels" title="Labels">
                <param name="show_label" type="boolean" truevalue="yes" falsevalue="no" label="Show Label" checked="true"/>
                <param type="float" value="0.075" label="Radius" name="radius_offset"/>
                <param type="integer" value="24" label="Label Font Size" name="size"/>
                <param name="parallel" type="boolean" label="Parallel" truevalue="yes" falsevalue="no" checked="true"
                    help="When set to yes/true, labels will be perpendicular to the tangent of the circle at the location of the label. Otherwise, they will be parallel with the tangent of the circle"/>
            </section>

            <section name="bands" title="Cytogenic Bands">
                <param name="show_bands" type="boolean" truevalue="yes" falsevalue="no" label="Show Cytogenic Bands?" checked="true" help="Cytogenic bands can be defined inside the karyotype file"/>
                <!-- Removed these based on reviewer feedback and that they are
                     not heavily used. Re-enable upon user-request, perhaps
                     with a more well defined use case rather than a
                     speculative one.
                <param name="bands" type="data" format="tabular" optional="true" label="Cytogenetic Bands" help="If defined, will display cytogenetic bands as part of the karyotype configuration. This field accepts any tabular format file. If you provide a BED file you should enable automatic conversion below. Otherwise disable conversion below and it is expected that your file have 7 columns: 'band', chromosome ID (should match fasta), band ID, band ID (again), start, end, color (gneg, gpos, or r,g,b triple). E.g. a complete row would look like: 'band chr1 p32.2 p32.2 56100000 59000000 gneg25'"/>
                <param name="convert_bands" type="boolean" truevalue="yes" falsevalue="no" label="Convert bands from BED format to circos karyotype band format" checked="true"
                help="Automatically reformat BED file into the appropriate columns. This should be a BED 6+ file, BED 9+ if you want the colours from the BED file automatically used. Otherwise everything will appear grey."/>
                -->
                <param name="fill_bands" type="boolean" truevalue="yes" falsevalue="no" label="Fill Bands" checked="true"/>
                <param name="band_transparency" type="integer" label="Band Transparency" value="3" min="0" max="5" help="0 is solid, 1 is the least transparent, and 5 is the most transparent"/>

                <param type="integer" value="0" label="Band Stroke Thickness" name="band_stroke_thickness"/>
                <expand macro="circos_color" label="Band Stroke Color" name="band_stroke_color" value="#000000"/>
            </section>
        </section>

        <section name="plot_options" title="General">
            <conditional name="background">
                <param name="background_select" type="select" label="Plot Background">
                    <option value="transparent">Transparent</option>
                    <option value="color" selected="true">Solid Color</option>
                </param>
                <when value="transparent" />
                <when value="color">
                    <expand macro="circos_color" label="Background Color" name="background_color" value="#ffffff"/>
                </when>
            </conditional>
            <param name="radius" type="integer" label="Image Radius" value="1500" min="500" max="5000" help="Plot radius (in pixels), final plot dimensions will be 2*r by 2*r"/>
            <param name="colour_profile" type="select" label="Load additional colour profiles" optional="true" help="Only useful in a tiny subset of situations">
                <option value="cg">Complete Genomics</option>
            </param>
        </section>

        <section name="sec_tdd" title="2D Data Tracks">
            <repeat name="data" title="2D Data Plot" help="2D Data Plots allow you to graph all sorts of data visually such as scatter or line plots, heatmaps, or tiles representing gene locations. These are commonly used to plot sequencing density tracks or other datasets that have some value at different positions along a genome.">
                <!-- Positioning -->
                <param name="r1" type="float" value="0.89" min="0" max="1" label="Outside Radius" help="Value must be between 1 (outer edge of plot) and 0 (center of the plot)"/>
                <param name="r0" type="float" value="0.8" min="0" max="1" label="Inside Radius" help="Value must be between 1 (outer edge of plot) and 0 (center of the plot)"/>
                <expand macro="zdepth"/>


                <conditional name="plot_format">
                    <param name="plot_format_select" type="select" label="Plot Type">
                        <option value="histogram" selected="True">Histogram</option>
                        <option value="histogram-stacked">Stacked Histogram</option>
                        <option value="heatmap">Heatmap</option>
                        <option value="highlight">Highlight</option>
                        <option value="line">Line</option>
                        <option value="scatter">Scatter</option>
                        <option value="tile">Tiles</option>
                        <option value="text">Text Labels</option>
                        <option value="connector">Connectors</option>
                    </param>
                    <when value="histogram">
                        <param name="data_source" type="data" format="tabular,interval" label="Histogram Data Source" help="Columns must be (chrom, start, end, value)"/>
                        <section name="format_specific" title="Plot Format Specific Options">
                            <expand macro="circos_color_alpha" label="Fill Color" name="fill_color" value="#ffdcfc"/>
                            <expand macro="stroke_opts"/>

                            <param name="fill_under" type="boolean" label="Fill underneath the histogram" truevalue="yes" falsevalue="no" checked="true" />
                            <param name="extend_bins" type="boolean" label="Join non-abutting Bins" truevalue="yes" falsevalue="no"
                                help="Join histogram bins that do not touch (abut)" />
                        </section>
                    </when>
                    <when value="histogram-stacked">
                        <param name="data_source" type="data" format="tabular,interval" label="Histogram Data Source" help="Columns must be (chrom, start, end, values). Values should be comma-separated"/>
                        <section name="format_specific" title="Plot Format Specific Options">
                            <expand macro="brewer_scale" label="Fill Color" name="fill_color"/>
                            <expand macro="stroke_opts"/>

                            <param name="fill_under" type="boolean" label="Fill underneath the histogram" truevalue="yes" falsevalue="no" checked="true" />
                            <param name="extend_bins" type="boolean" label="Join non-abutting Bins" truevalue="yes" falsevalue="no"
                                help="Join histogram bins that do not touch (abut)" />

                        </section>
                    </when>
                    <when value="heatmap">
                        <param name="data_source" type="data" format="tabular,interval" label="Heatmap Data Source" help="Columns must be (chrom, start, end, value)"/>
                        <section name="format_specific" title="Plot Format Specific Options">
                            <conditional name="color_scale">
                                <param name="color_scale_select" type="select" label="Color Scale">
                                    <option value="basic" selected="True">Basic</option>
                                    <option value="advanced">Advanced</option>
                                </param>
                                <when value="basic">
                                    <expand macro="brewer_scale" label="Fill Color" name="fill_color"/>
                                </when>
                                <when value="advanced">
                                    <param name="fill_color" type="text" label="Advanced color entry" help="E.g. blues-5-seq-rev,reds-5-seq">
                                        <sanitizer>
                                            <valid initial="string.letters,string.digits">
                                              <add value="," />
                                              <add value="-" />
                                            </valid>
                                        </sanitizer>
                                    </param>
                                </when>
                            </conditional>
                            <expand macro="stroke_opts"/>

                            <param name="color_mapping" type="select" label="Color Mapping">
                                <option value="0" selected="True">divided uniformly</option>
                                <option value="1">division at min/max boundary 1/2 size of others</option>
                                <option value="2">divided uniformly, 0,n reserved for [,min] and [max,]</option>
                            </param>

                            <param name="scale_log_base" type="float" value="1.0" label="Scale Log Base"
                                help="If scale_log_base&lt;1, the dynamic range of color mapping of small values will be increased. If scale_log_base&gt;1, then dynamic range of large values will be increased."/>
                        </section>
                    </when>
                    <when value="highlight">
                        <param name="data_source" type="data" format="tabular,interval" label="Highlight Data Source" help="Columns must be (chrom, start, end)"/>
                        <section name="format_specific" title="Plot Format Specific Options">
                            <expand macro="circos_color_alpha" label="Fill Color" name="fill_color" value="#000000"/>
                            <expand macro="stroke_opts"/>
                        </section>
                    </when>
                    <when value="line">
                        <param name="data_source" type="data" format="tabular,interval" label="Line Data Source" help="Columns must be (chrom, start, end, value)"/>
                        <section name="format_specific" title="Plot Format Specific Options">
                            <expand macro="stroke_opts"/>
                        </section>
                    </when>
                    <when value="scatter">
                        <param name="data_source" type="data" format="tabular,interval" label="Scatter Plot Data Source" help="Columns must be (chrom, start, end, value)"/>
                        <section name="format_specific" title="Plot Format Specific Options">
                        <!-- glyph, glyph_size, min, max -->
                            <param name="glyph" type="select" label="Glyph">
                                <option value="circle">Circle</option>
                                <option value="triangle">Triangle</option>
                                <option value="rectangle">Rectangle</option>
                            </param>
                            <param name="glyph_size" type="integer" value="8" label="Glyph Size"/>
                            <expand macro="circos_color_alpha" name="fill_color" value="#555555" label="Fill Color" />
                            <expand macro="stroke_opts"/>
                        </section>
                    </when>
                    <when value="tile">
                        <param name="data_source" type="data" format="tabular,interval" label="Tile Data Source"
                            help="Column must be (chrom, start, end)"/>
                        <section name="format_specific" title="Plot Format Specific Options">
                            <expand macro="circos_color_alpha" name="fill_color" label="Fill Color"/>

                            <expand macro="stroke_opts"/>
                            <param name="layers" type="integer" value="15" label="Layers"/>
                            <param name="thickness" type="float" value="15" label="Thickness" help="In pixels"/>
                            <param name="padding" type="float" value="8" label="Padding" help="In pixels"/>
                            <param name="margin" type="float" value="0.002" label="Margin" help="In chromosome units. This is essentially distance added to the gene, before laying it out. Increasing it will prevent genes from packing as well."/>

                            <conditional name="overflow">
                                <param name="overflow_behavior" type="select" label="Overflow Behavior">
                                    <option value="hide">Hide: overflow tiles are not drawn</option>
                                    <option value="grow">Grow: new layers are added as required</option>
                                    <option value="collapse">Collapse: overflow tiles are drawn on the first layer</option>
                                </param>
                                <when value="hide">
                                </when>
                                <when value="grow">
                                    <expand macro="circos_color" name="layer_overflow_color" label="Layer Overflow Color"/>
                                </when>
                                <when value="collapse">
                                    <expand macro="circos_color" name="layer_overflow_color"  label="Layer Overflow Color"/>
                                </when>
                            </conditional>
                        </section>
                    </when>
                    <when value="text">
                        <param name="data_source" type="data" format="tabular,interval" label="Text Data Source" help="Columns must be (chrom, start, end, text)"/>

                        <section name="format_specific" title="Plot Format Specific Options">
                            <param name="label_size" type="integer" value="24" label="Label Size" min="1"/>
                            <conditional name="link">
                                <param name="show_link" type="select" label="Show Link">
                                    <option value="yes" selected="true">Yes</option>
                                    <option value="no">No</option>
                                </param>
                                <when value="yes">
                                    <param name="link_thickness" type="integer" value="2" label="Link thickness" min="0" help="In pixels"/>
                                    <expand macro="circos_color" name="link_color"  label="Link Color" value="#ff0000"/>
                                    <param name="link_dims" type="text" value="1p,2p,3p,2p,1p" label="Link dimensions" help="From the manual: &quot;Each link line has five dimensions: outer padding, outer line length (drawn at new position), connecting line length (connects old to new position), inner line length (drawn at old position) and inner padding. If snuggling is not used, then distinction between line lengths is not made&quot;.">
                                        <sanitizer>
                                            <valid initial="string.digits">
                                                <add value="p"/>
                                                <add value=","/>
                                                <add value="."/>
                                            </valid>
                                        </sanitizer>
                                    </param>

                                </when>
                                <when value="no">
                                </when>
                            </conditional>
                            <conditional name="snuggle">
                                <param name="label_snuggle" type="select" label="Snuggle Labels" help="The label's radial position may be slightly adjusted to reduce the number of layers of text">
                                    <option value="yes">Yes</option>
                                    <option value="no" selected="true">No</option>
                                </param>
                                <when value="yes">
                                    <param name="max_snuggle_distance" type="integer" value="2" min="0" label="Max snuggle Distance" help="Shift label up to N times its height, in the angular direction"/>
                                    <param name="snuggle_sampling" type="integer" value="2" min="1" label="Snuggle Sampling" help="Sample possible positions every N pixels"/>
                                    <param name="snuggle_tolerance" type="float" value="0.25" min="0" label="Snuggle Tolerance" help="You can also short-circuit precise placement by setting snuggle_tolerance (absolute or relative to label's tangential size). The larger this value, the less precise the placement. (from Circos manual)"/>
                                    <param name="snuggle_link_overlap_test" type="boolean" truevalue="yes" falsevalue="no" checked="yes" label="Snuggle Link Overlap Test" help="If the labels have a link line, you choose to test whether link lines overlap with previous labels using snuggle_link_overlap_test (from Circos manual)"/>
                                    <param name="snuggle_link_overlap_tolerance" type="float" value="2" min="0" label="Snuggle Link Overlap Tolerance" help="The extent of acceptable overlap is set using snuggle_link_overlap_tolerance (from Circos manual)"/>
                                    <param name="snuggle_refine" type="boolean" truevalue="yes" falsevalue="no" checked="yes" label="Snuggle refine" help="The snuggle_refine parameter toggles an additional check for crossing of links of labels that are placed at similar radial positions. Label pairs whose link lines cross are swapped. This refine parameter is functionaly only if show_links=yes. (from Circos manual)"/>
                                </when>
                                <when value="no">
                                </when>
                            </conditional>

                        </section>
                    </when>
                    <when value="connector">
                        <param name="data_source" type="data" format="interval" label="Connector Data Source" help="Columns must be (chrom, pos1, pos2). Connectors are articulated line segments that relate two positions on an ideogram between two radial positions."/>
                        <section name="format_specific" title="Plot Format Specific Options">
                            <expand macro="stroke_opts"/>
                            <param name="connector_dims" type="text" value="0,0.3,0.4,0.3,0" label="Connector dimensions" help="From the manual: &quot;Each link line has five dimensions: outer padding, outer line length (drawn at new position), connecting line length (connects old to new position), inner line length (drawn at old position) and inner padding. If snuggling is not used, then distinction between line lengths is not made&quot;.">
                                <sanitizer>
                                    <valid initial="string.digits">
                                        <add value=","/>
                                        <add value="."/>
                                    </valid>
                                </sanitizer>
                            </param>
                        </section>
                    </when>
                </conditional>
                <param name="orientation" type="boolean" label="Orient Inwards" truevalue="in" falsevalue="out"
                    help="When yes, the plot will face inwards; i.e. lowest values will be plotted to the outside"/>
                <expand macro="minsize" />
                <expand macro="minmax" />

                <expand macro="rules" />
                <expand macro="axes" />
                <expand macro="backgrounds" />
            </repeat>
        </section>
        <section name="sec_links" title="Link Tracks">
            <repeat name="data" title="Link Data" help="Link tracks show a relationship between two locations in your plot. They are often used for indicating sequence similarity between two regions of a genome, or some interaction between two groups.">
                <!-- Positioning -->
                <param name="radius" type="float" value="0.8" min="0" max="1" label="Inside Radius"
                    help="This is the radial position of the termination of the link. Value must be between 1 (outer edge of plot) and 0 (center of the plot)" />
                <expand macro="zdepth"/>
                <param name="data_source" type="data" format="tabular,interval" label="Link Data Source" help="Select file with link data. Format: chr1 start1 end1 chr2 start2 end2" />
                <conditional name="linktype">
                    <param name="ribbon" type="select" label="Link Type" help="">
                        <option value="no">basic</option>
                        <option value="yes" selected="true">ribbon</option>
                    </param>
                    <when value="yes">
                        <param name="twist" type="select" label="Twist Ribbon" help="Fine grained control for display behaviour of ribbons">
                            <option value="" selected="true">auto</option>
                            <option value="twist=yes">always (twist)</option>
                            <option value="flat=yes">never (flat)</option>
                        </param>
                        <param name="pattern" type="select" label="Ribbon background pattern">
                            <option value="solid" selected="true">Solid</option>
                            <option value="hline">Horizontal Lines</option>
                            <option value="hline-sparse">Horizontal Lines (sparse)</option>
                            <option value="vline">Vertical Lines</option>
                            <option value="vline-sparse">Vertical Lines (sparse)</option>
                            <option value="checker">Checker</option>
                            <option value="checker-sparse">Checker (sparse)</option>
                            <option value="dot">Dots</option>
                            <option value="dot-sparse">Dots (sparse)</option>
                        </param>
                    </when>
                    <when value="no"/>
                </conditional>
                <expand macro="circos_color_alpha" name="color" value="#000000" label="Link Color"/>
                <param name="thickness" type="float" value="15" label="Thickness" help="In pixels"/>
                <param name="bezier_radius" type="float" value="0.1" min="0" max="1" label="Bezier Radius"
                    help="The radial position of the third control point (in addition to the two positions defined by the link coordinates) used to draw the Bezier curve; if this parameter is 0 then straight lines will be used"/>

                <section name="advanced" title="Advanced Settings">
                    <param name="crest" type="float" value="0.5" min="0" max="1" label="Crest"
                        help="Two additional Bezier control points can be set by using the crest parameter. When defined, points p3 and p4 are added. These points lie at the same angular position as the start and end link termini and have the radial position. In the crest=0 extreme, p3 and p4 are at the same position as p0,p1. In this case, crest has no effect. When crest=1, p3,p4 are at the radial position of p2, the control point set by bezier_radius"/>
                    <param name="bezier_radius_purity" type="float" value="0.75" min="0" max="1" label="Bezier Radius Purity"
                        help="The bezier_radius_purity adjusts the position of p2 for each link. The p2 control point will move along the line formed by the original p2 location and the intersection of p0-p1 and the bisecting radius. When purity = 1, p2' = p2. When purity = 0, p2' = midpoint(p0,p1)"/>
                    <conditional name="perturbation">
                        <param name="perturb" type="select" label="Perturb links?"
                            help="A set of parameters can be used to randomly adjust bezier_radius, bezier_radius_purity, and crest parameters to give the links a more disorganized, organic feel. By perturbing each link you can also show additional texture in the data among links which would have ordinarily overlapped. Each parameter's perturbation amount is defined as a pair of values - pmin,pmax. These are the minimum and maximum multipliers by which the value can be perturbed">
                            <option value="no" selected="true">no</option>
                            <option value="yes">yes</option>
                        </param>
                        <when value="yes">
                            <param name="perturb_crest_min" type="float" value="0.5" label="Crest min"
                                help="For example setting (min,max) = (0.5,1.2) will cause parameter to be randomly scaled between 50-120%"/>
                            <param name="perturb_crest_max" type="float" value="1.5" label="Crest max"
                                help="For example setting (min,max) = (0.5,1.2) will cause parameter to be randomly scaled between 50-120%"/>
                            <param name="perturb_bezier_radius_min" type="float" value="0.5" label="Bezier Radius min"
                                help="For example setting (min,max) = (0.5,1.2) will cause parameter to be randomly scaled between 50-120%"/>
                            <param name="perturb_bezier_radius_max" type="float" value="1.5" label="Bezier Radius max"
                                help="For example setting (min,max) = (0.5,1.2) will cause parameter to be randomly scaled between 50-120%"/>
                            <param name="perturb_bezier_radius_purity_min" type="float" value="0.5" label="Bezier Radius Purity min"
                                help="For example setting (min,max) = (0.5,1.2) will cause parameter to be randomly scaled between 50-120%"/>
                            <param name="perturb_bezier_radius_purity_max" type="float" value="1.5" label="Bezier Radius Purity max"
                                help="For example setting (min,max) = (0.5,1.2) will cause parameter to be randomly scaled between 50-120%"/>
                        </when>
                        <when value="no"/>
                    </conditional>
                </section>
                <expand macro="linkrules"/>
                <expand macro="minsize" />
            </repeat>
        </section>

        <section name="scaling" title="Scaling">
            <repeat name="zooms" title="Zoomed Region" help="From the documentation: &quot;Local adjustment of scale is for cases when you want to zoom parts of your data domain without cropping. If you think of the ideogram as a rubber band, applying a local scale adjustment is analogous to locally stretching or compressing the rubber band. The effect is that you still see the entire rubber band, but the length scale across it is variable.&quot;">
                <param name="chr" type="text" label="Chromosome" help="as written in your karyotype file" />

                <param name="start" type="float" label="Start" value="1" help="in chromosome units" />
                <param name="end"   type="float" label="End"   value="5" help="in chromosome units" />
                <param name="scale" type="float" min="0" label="Scale" value="5" />
            </repeat>
        </section>

        <section name="ticks" title="Ticks">
            <param name="radius"  type="float" value="1.0" label="Radius"/>
            <param name="skip_first_label" type="boolean" truevalue="yes" falsevalue="no" label="Skip first label"/>
            <param name="skip_last_label" type="boolean" truevalue="yes" falsevalue="no" label="Skip last label"/>

            <repeat name="tick_group" title="Tick Group">
                <param name="spacing" type="float" min="0" label="Tick Spacing" value="1" help="in chromosome units" />
                <param name="size" type="float" value="10" label="Tick Size"/>
                <expand macro="circos_color"/>
                <conditional name="ticks">
                    <param name="show_tick_labels" type="select" label="Show Tick Labels">
                        <option value="yes">Yes</option>
                        <option value="no" selected="true">No</option>
                    </param>
                    <when value="yes">
                        <param name="label_size" type="float" value="20" label="Label Size"/>
                        <param name="label_offset"  type="float" value="10" label="Label Offset"/>
                        <param name="format" type="select" label="Label Format">
                            <option value="%d" selected="True">Integer</option>
                            <option value="%f">Float</option>
                            <option value="%.1f">Float (one decimal)</option>
                            <option value="%.2f">Float (two decimals)</option>
                            <sanitizer>
                                <valid>
                                    <add value="%" />
                                </valid>
                            </sanitizer>
                        </param>
                        <param name="format_ext" type="boolean" truevalue="yes" falsevalue="no" checked="true" label="Show unit in tick labels" help="If your chromosome units is set to kilobases and you have enabled this option and enabled tick labels, they will include the size value, e.g. '500 kb' "/>
                    </when>
                    <when value="no">
                    </when>
                </conditional>
            </repeat>

        </section>

        <section name="limits" title="Limits">
            <param name="max_ticks"            type="integer" min="200" value="5000"  label="Maximum number of ticks to draw" help="These are advanced options, if you increase these due to a plotting failure it may result in a significantly longer plotting time. Beware!"/>
            <param name="max_ideograms"        type="integer" min="200" value="200"   label="Maximum number of ideograms to draw"/>
            <param name="max_links"            type="integer" min="200" value="25000" label="Maximum number of links to draw"/>
            <param name="max_points_per_track" type="integer" min="200" value="25000" label="Maximum number of points per track"/>
        </section>

        <section name="outputs" title="Outputs">
            <param name="png" type="boolean" truevalue="yes" falsevalue="no" label="PNG" checked="true"/>
            <param name="svg" type="boolean" truevalue="yes" falsevalue="no" label="SVG" checked="false" help="Oftentimes this will not be viewable directly in Galaxy, you may need to download this file first."/>
            <param name="tar" type="boolean" truevalue="yes" falsevalue="no" label="Configuration Archive" checked="false" help="This contains all the files needed to make this plot. With the data contained within here, and a copy of Circos installed locally, you can rebuild the plot and make any manual changes that are not possible in Galaxy (e.g. colours not in the colour picker)"/>
        </section>
    </inputs>
    <outputs>
        <data name="output_png" format="png" from_work_dir="circos.png" label="Circos Plot">
            <filter>outputs['png']</filter>
        </data>
        <data name="output_svg" format="svg" from_work_dir="circos.svg" label="Circos Plot">
            <filter>outputs['svg']</filter>
        </data>
        <data name="output_tar" format="tar.gz" from_work_dir="circos.tar.gz" label="Circos Conf Files">
            <filter>outputs['tar']</filter>
        </data>
        <data name="karyotype_txt" format="tabular" from_work_dir="circos/conf/karyotype.txt" label="Circos Karyotype">
            <filter>reference_genome['ref']['ref_source'] != 'karyotype' and reference_genome['ref']['ref_source'] != 'preset' </filter>
        </data>
    </outputs>
    <expand macro="test_cases" />
    <help><![CDATA[
Circos
======

.. class:: infomark

   Made a nice plot? Share it with us in the `training materials <https://github.com/galaxyproject/training-material/issues/1867>`__, we're looking for more cool plots with scientifically relevant stories to share with the students who want to learn how to use Circos.

   Have a feature request? `Share it with us! <https://github.com/galaxyproject/training-material/issues/1867>`__

.. class:: warningmark

   No data or plot crashes? Check that your chromosome naming scheme matches between your Karyotype file and your datasets.

Circos is a software package for visualizing data and information. It visualizes data in a circular layout — this makes Circos ideal for exploring relationships between objects or positions. There are other reasons why a circular layout is advantageous, not the least being the fact that it is attractive.

Circos is ideal for creating publication-quality infographics and illustrations with a high data-to-ink ratio, richly layered data and pleasant symmetries. You have fine control each element in the figure to tailor its focus points and detail to your audience.

.. image:: $PATH_TO_IMAGES/circos-sample-panel.png
   :alt: several example circos plots

For more information see the Circos documentation_.

.. _documentation: http://circos.ca/documentation/


    ]]></help>
    <expand macro="citations" />
</tool>