view jbrowse2.xml @ 2:37b2c26c7b9b draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
author fubar
date Mon, 08 Jan 2024 09:23:19 +0000
parents d78175596286
children 2de9f585505b
line wrap: on
line source

 <tool id="jbrowse2" name="jbrowse2" version="@TOOL_VERSION@+@WRAPPER_VERSION@" profile="22.05">
    <description>genome browser</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="edamInc"/>
    <xrefs>
        <xref type="bio.tools">jbrowse2</xref>
    </xrefs>
    <expand macro="requirements"/>
    <version_command>python '${__tool_directory__}/jbrowse2.py' --version</version_command>
    <command detect_errors="aggressive"><![CDATA[
mkdir -p '$output.files_path' &&
## Copy the XML file into the directory, mostly for debugging
## but nice if users want to reproduce locally
cp '$trackxml' '$output.files_path/galaxy.xml' &&
python '$__tool_directory__/jbrowse2.py'
--outdir '$output.files_path'
--xml '$trackxml' &&

cp '$output.files_path/index.html' '$output'

## Ugly testing hack since I cannot get <extra_files> to test the files I want to test. Hmph.
#if str($uglyTestingHack) == "enabled":
 &&   cp '$trackxml' '$output'
#end if
  ]]></command>
<configfiles>
        <configfile name="trackxml"><![CDATA[<?xml version="1.0"?>
<root>
    <metadata>
        <genomes>
            #if str($reference_genome.genome_type_select) == "indexed":
              <genome path="${reference_genome.genomes.fields.path}" label="${reference_genome.genomes.fields.name}">
                  <metadata />
              </genome>s
            #else
              <genome path="$reference_genome.genome" label="${reference_genome.genome.element_identifier}">
                <metadata>
                  <dataset id="${__app__.security.encode_id($reference_genome.genome.id)}" hid="${reference_genome.genome.hid}"
                      size="${reference_genome.genome.get_size(nice_size=True)}"
                      edam_format="${reference_genome.genome.datatype.edam_format}"
                      file_ext="${reference_genome.genome.ext}"
                      dname = "${reference_genome.genome.element_identifier}" />
                  <history id="${__app__.security.encode_id($reference_genome.genome.history_id)}"
                      #if $reference_genome.genome.history.user:
                      user_email="${reference_genome.genome.history.user.email}"
                      user_id="${reference_genome.genome.history.user_id}"
                      display_name="${reference_genome.genome.history.get_display_name()}"/>
                      #else
                      user_email="anonymous"
                      user_id="-1"
                      display_name="Unnamed History"/>
                      #end if
                  <metadata
                      #for (key, value) in $reference_genome.genome.get_metadata().items():
                      #if "_types" not in $key:
                        #if isinstance($value, list):
                          #set value_str = "[%s]" % ','.join([str(val) for val in value])
                          ${key}="$value_str"
                        #else
                          ${key}="${value}"
                        #end if
                      #end if
                      #end for
                      />
                  <tool
                      tool_id="${reference_genome.genome.creating_job.tool_id}"
                      tool_version="${reference_genome.genome.creating_job.tool_version}"
                      />
                </metadata>
              </genome>
            #end if
        </genomes>
        <general>
            <defaultLocation>${jbgen.defaultLocation}</defaultLocation>
            <analytics>${jbgen.enableAnalytics}</analytics>
            <primary_color>${jbgen.primary_color}</primary_color>
            <secondary_color>${jbgen.secondary_color}</secondary_color>
            <tertiary_color>${jbgen.tertiary_color}</tertiary_color>
            <quaternary_color>${jbgen.quaternary_color}</quaternary_color>
            <font_size>${jbgen.font_size}</font_size>
            <session_name>${jbgen.session_name}</session_name>
        </general>
        <galaxyUrl>${__app__.config.galaxy_infrastructure_url}</galaxyUrl>
    </metadata>
    <tracks>
        #for $tg in $track_groups:
        #for $track in $tg.data_tracks:
        <track cat="${tg.category}" format="${track.data_format.data_format_select}" visibility="${track.data_format.track_visibility}">
            #if $track.data_format.data_format_select != "sparql":
            <files>
              #for $dataset in $track.data_format.annotation:
              <trackFile path="${dataset}" ext="${dataset.ext}" label="${dataset.element_identifier}">
                <metadata>
                  <dataset id="${__app__.security.encode_id($dataset.id)}" hid="${dataset.hid}"
                      size="${dataset.get_size(nice_size=True)}"
                      edam_format="${dataset.datatype.edam_format}"
                      file_ext="${dataset.ext}" />
                  <history id="${__app__.security.encode_id($dataset.history_id)}"
                      #if $dataset.history.user:
                      user_email="${dataset.history.user.email}"
                      user_id="${dataset.history.user_id}"
                      display_name="${dataset.history.get_display_name()}"/>
                      #else
                      user_email="anonymous"
                      user_id="-1"
                      display_name="Unnamed History"/>
                      #end if
                  <metadata
                    #for (key, value) in $dataset.get_metadata().items():
                    #if "_types" not in $key and $value is not None and len(str($value)) < 5000:
                      #if isinstance($value, list):
                        #set value_str = "[%s]" % ','.join([str(val) for val in value])
                        ${key}="$value_str"
                      #else
                        ${key}="${value}"
                      #end if
                    #end if
                    #end for
                      />
                  <tool
                      tool_id="${dataset.creating_job.tool_id}"
                      tool_version="${dataset.creating_job.tool_version}"
                      />
                </metadata>
              </trackFile>
              #end for
            </files>
            #end if

            <options>
                <style>
                    <display>${track.data_format.jbstyle.track_style.display}</display>
                    ## TODO change this to a for loop?
                    #if 'show_labels' in $track.data_format.jbstyle.track_style
                      <trackShowLabels type="boolean">${track.data_format.jbstyle.track_style.show_labels}</trackShowLabels>
                    #end if
                    #if 'show_descriptions' in $track.data_format.jbstyle.track_style
                      <trackShowDescriptions type="boolean">${track.data_format.jbstyle.track_style.show_descriptions}</trackShowDescriptions>
                    #end if
                    #if 'display_mode' in $track.data_format.jbstyle.track_style
                      <trackDisplayMode>${track.data_format.jbstyle.track_style.display_mode}</trackDisplayMode>
                    #end if
                    #if 'max_height' in $track.data_format.jbstyle.track_style
                      <trackMaxHeight type="integer">${track.data_format.jbstyle.track_style.max_height}</trackMaxHeight>
                    #end if
                    #if 'autoscale' in $track.data_format.jbstyle.track_style
                      <autoscale>${track.data_format.jbstyle.track_style.autoscale}</autoscale>
                    #end if
                    #if 'resolution' in $track.data_format.jbstyle.track_style
                      <resolution type="integer">${track.data_format.jbstyle.track_style.resolution}</resolution>
                    #end if
                    #if 'summaryScoreMode' in $track.data_format.jbstyle.track_style
                      <summaryScoreMode>${track.data_format.jbstyle.track_style.summaryScoreMode}</summaryScoreMode>
                    #end if
                    #if 'scaleType' in $track.data_format.jbstyle.track_style
                      <scaleType>${track.data_format.jbstyle.track_style.scaleType}</scaleType>
                    #end if
                    #if 'filled' in $track.data_format.jbstyle.track_style
                      <filled type="boolean">${track.data_format.jbstyle.track_style.filled}</filled>
                    #end if
                    #if 'displayCrossHatches' in $track.data_format.jbstyle.track_style
                      <displayCrossHatches type="boolean">${track.data_format.jbstyle.track_style.displayCrossHatches}</displayCrossHatches>
                    #end if
                    #if 'minScore' in $track.data_format.jbstyle.track_style and $track.data_format.jbstyle.track_style.minScore
                      <minScore type="integer">${track.data_format.jbstyle.track_style.minScore}</minScore>
                    #end if
                    #if 'maxScore' in $track.data_format.jbstyle.track_style and $track.data_format.jbstyle.track_style.maxScore
                      <maxScore type="integer">${track.data_format.jbstyle.track_style.maxScore}</maxScore>
                    #end if
                    ## TODO other coloring/etc options in each renderer (e.g https://github.com/GMOD/jbrowse-components/blob/main/plugins/svg/src/SvgFeatureRenderer/configSchema.ts)
                </style>
                <style_labels>
                    ## TODO other label options: https://github.com/GMOD/jbrowse-components/blob/main/plugins/svg/src/SvgFeatureRenderer/configSchema.ts
                    #if 'label' in $track.data_format.jbstyle.track_style
                    <name>${track.data_format.jbstyle.track_style.label}</name>
                    #end if
                    #if 'description' in $track.data_format.jbstyle.track_style
                    <description>${track.data_format.jbstyle.track_style.description}</description>
                    #end if
                </style_labels>
              #if str($track.data_format.data_format_select) == "gene_calls" or str($track.data_format.data_format_select) == "blast" or str($track.data_format.data_format_select) == "sparql":
                <scaling>
                  #if str($track.data_format.jbcolor_scale.color_score.color_score_select) == "none":
                        <method>ignore</method>
                        <scheme>
                          #if str($track.data_format.jbcolor_scale.color_score.color.color_select) == "automatic":
                            <color>__auto__</color>
                          #else
                            <color>${track.data_format.jbcolor_scale.color_score.color.style_color}</color>
                          #end if
                        </scheme>
                  #else
                        <method>score</method>
                        <algo>${track.data_format.jbcolor_scale.color_score.score_scaling}</algo>
                        <scales>
                            <type>${track.data_format.jbcolor_scale.color_score.score_scales.scale_select}</type>

                          #if str($track.data_format.jbcolor_scale.color_score.score_scales.scale_select) == "manual":
                            <min>${track.data_format.jbcolor_scale.color_score.score_scales.minimum}</min>
                            <max>${track.data_format.jbcolor_scale.color_score.score_scales.maximum}</max>
                          #end if
                        </scales>
                        <scheme>
                            <type>${track.data_format.jbcolor_scale.color_score.color_scheme.score_scheme}</type>
                        ## auto_color
                        #if str($track.data_format.jbcolor_scale.color_score.color_scheme.score_scheme) == "opacity":
                          #if str($track.data_format.jbcolor_scale.color_score.color_scheme.color.color_select) == "automatic":
                            <color>__auto__</color>
                          #else
                            <color>${track.data_format.jbcolor_scale.color_score.color_scheme.color.style_color}</color>
                          #end if
                        #end if
                        </scheme>
                  #end if
                </scaling>
                <menus>
                  #for $menu_item in $track.data_format.jbmenu.track_menu:
                  <menu>
                    <action>${menu_item.menu_action}</action>
                    #if str($menu_item.menu_label) != "":
                      <label>${menu_item.menu_label}</label>
                    #end if
                    #if str($menu_item.menu_title) != "":
                      <title>${menu_item.menu_title}</title>
                    #end if
                    #if str($menu_item.menu_url) != "":
                      <url>${menu_item.menu_url.replace("&", "&amp;").replace("\"", "&quot;")}</url>
                    #end if
                    #if str($menu_item.menu_icon) != "":
                      <iconClass>${menu_item.menu_icon}</iconClass>
                    #end if
                  </menu>
                  #end for
                </menus>
            #end if

            #if str($track.data_format.data_format_select) == "wiggle":
                <wiggle>
                    <type>${track.data_format.xyplot}</type>
                    <variance_band>${track.data_format.var_band}</variance_band>
                  #if str($track.data_format.scaling.scale_select) == "auto_local":
                    <autoscale>local</autoscale>
                  #else if str($track.data_format.scaling.scale_select) == "auto_global":
                    <autoscale>global</autoscale>
                  #else:
                    <min>${track.data_format.scaling.minimum}</min>
                    <max>${track.data_format.scaling.maximum}</max>
                  #end if
                  <scale>${track.data_format.scale_select2}</scale>

                  ## Wiggle tracks need special color config
                  #if str($track.data_format.jbcolor.color.color_select) != "automatic":
                    <color_pos>${track.data_format.jbcolor.color.style_pos_color}</color_pos>
                    <color_neg>${track.data_format.jbcolor.color.style_neg_color}</color_neg>
                  #else:
                    <color_pos>__auto__</color_pos>
                    <color_neg>__auto__</color_neg>
                  #end if

                  ## Bicolor pivot config
                  #if str($track.data_format.jbcolor.bicolor_pivot.bicolor_pivot_select) == "zero":
                    <bicolor_pivot>zero</bicolor_pivot>
                  #else if str($track.data_format.jbcolor.bicolor_pivot.bicolor_pivot_select) == "mean":
                    <bicolor_pivot>mean</bicolor_pivot>
                  #else:
                    <bicolor_pivot>${track.data_format.jbcolor.bicolor_pivot.pivot_point}</bicolor_pivot>
                  #end if
                </wiggle>
            #else if str($track.data_format.data_format_select) == "pileup":
                <pileup>
                    <bam_indices>
                        #for $dataset in $track.data_format.annotation:
                        <bam_index>${dataset.metadata.bam_index}</bam_index>
                        #end for
                    </bam_indices>
                </pileup>
            #else if str($track.data_format.data_format_select) == "cram":
                <cram>
                    <cram_indices>
                        #for $dataset in $track.data_format.annotation:
                        <cram_index>${dataset.metadata.cram_index}</cram_index>
                        #end for
                    </cram_indices>
                </cram>
            #else if str($track.data_format.data_format_select) == "blast":
                <blast>
                  #if str($track.data_format.blast_parent) != "":
                    <parent>${track.data_format.blast_parent}</parent>
                  #end if
                    <protein>${track.data_format.is_protein}</protein>
                    <min_gap>${track.data_format.min_gap}</min_gap>
                    <index>${track.data_format.index}</index>
                </blast>
            #else if str($track.data_format.data_format_select) == "gene_calls":
                <gff>
                  #if $track.data_format.match_part.match_part_select == "true":
                    <match>${track.data_format.match_part.name}</match>
                  #end if
                    <index>${track.data_format.index}</index>
                </gff>
            #else if str($track.data_format.data_format_select) == "synteny":
                <synteny>
                    <genome>${track.data_format.synteny_genome}</genome>
                    <genome_label>${track.data_format.synteny_genome.element_identifier}</genome_label>
                </synteny>
            #else if str($track.data_format.data_format_select) == "hic":
                <hic>
                </hic>
            #else if str($track.data_format.data_format_select) == "sparql":
                <label>${track.data_format.label}</label>
                <sparql>
                    <url>${track.data_format.url}</url>
                    <query>${track.data_format.query}</query>
                    <query_refnames>${track.data_format.query_refnames}</query_refnames>
                </sparql>
            #end if
            </options>
        </track>
        #end for
        #end for
    </tracks>
</root>
]]></configfile>
    </configfiles>
    <inputs>
        <conditional name="reference_genome">
            <param help="Built-in references" label="Reference genome to display" name="genome_type_select" type="select">
                <option selected="True" value="indexed">Use a built-in genome</option>
                <option value="history">Use a genome from history</option>
            </param>
            <when value="indexed">
                <param
                    help="If your genome of interest is not listed, contact the Galaxy team"
                    label="Select a reference genome"
                    name="genome"
                    type="select">
                    <options from_data_table="all_fasta">
                        <filter column="2" type="sort_by"/>
                        <validator message="No genomes are available for the selected input dataset" type="no_options">
                            </validator>
                    </options>
                </param>
            </when>
            <when value="history">
                <param
                    format="fasta"
                    label="Select the reference genome"
                    name="genome"
                    type="data">
                </param>
            </when>
        </conditional>

        <repeat name="track_groups" title="Track Group">
            <param label="Track Category"
                name="category"
                type="text"
                value="Default"
                help="Organise your tracks into Categories for a nicer end-user experience. You can use #date# and it will be replaced with the current date in 'yyyy-mm-dd' format, which is very useful for repeatedly updating a JBrowse instance when member databases / underlying tool versions are updated." optional="False"/>
            <repeat name="data_tracks" title="Annotation Track">
                <conditional name="data_format" label="Track Options">
                    <param type="select" label="Track Type" name="data_format_select">
                        <option value="pileup">BAM Pileup track</option>
                        <option value="wiggle">BigWig XY track</option>
                        <option value="blast">Blast XML track - converted to GFF with actual gaps between hits</option>
                        <option value="cram">CRAM</option>
                        <option value="gene_calls" selected="true">GFF/GFF3/BED feature tracks</option>
                        <option value="hic">HiC binary data. Existing cool format must be converted to binary hic - hic_matrix will NOT work.</option>
                        <option value="sparql">SPARQL</option>
                        <option value="synteny">Synteny</option>
                       <option value="vcf">VCF SNP annotation track</option>
                    </param>
                    <when value="blast">
                        <expand macro="input_conditional" label="BlastXML Track Data" format="blastxml" />

                        <param label="Features used in Blast Search"
                            help="in GFF3. This is used  so we know where to map features. E.g. where results of which CDS Protein32 match up to. The query IDs in your blast results should MATCH some feature IDs in your GFF3 file. This is an optional field and is most useful if using JBrowse to display protein blast results on a DNA genome. blastn results don't need this, blastp results on a protein sequence don't need this."
                            format="gff3"
                            name="blast_parent"
                            optional="true"
                            type="data"/>

                        <param label="Minimum Gap Size"
                            help="before a new match_part feature is created"
                            name="min_gap"
                            type="integer"
                            value="10"
                            min="2" />
                        <param label="Is this a protein blast search?"
                            type="boolean"
                            name="is_protein"
                            truevalue="true"
                            falsevalue="false" />

                        <param label="Index this track" name="index" type="boolean" checked="false" truevalue="true" falsevalue="false" />

                        <expand macro="track_styling_feature"
                                classname="feature"
                                label="description"
                                description="Hit_titles"
                                height="600px"/>
                        <expand macro="color_selection"
                                token_scaling_lin_select="false"
                                token_scaling_log_select="true" />
                        <expand macro="track_menu" />
                        <expand macro="track_visibility" />
                    </when>
                    <when value="vcf">
                        <expand macro="input_conditional" label="SNP Track Data" format="vcf,vcf_bgzip" />
                        <expand macro="track_styling_vcf"/>
                        <expand macro="track_visibility" />
                    </when>
                    <when value="gene_calls">
                        <expand macro="input_conditional" label="GFF/GFF3/BED Track Data" format="gff,gff3,bed" />
                        <conditional name="match_part" label="match/match_part data">
                        <param help="Match part data selection " label="This is match/match_part data" name="match_part_select" type="select">
                            <option selected="True" value="false">Not match/match part data</option>
                            <option value="true">Match/match part data</option>
                        </param>
                            <when value="true">
                                <param label="Match Part Feature Type"
                                    name="name"
                                    type="text"
                                    value="match"
                                    help="Match_parts have several options for the parent feature type, such as cDNA_match, match, translated_nucleotide_match, etc. Please select the appropriate one here. You can leave empty to try autodetection (only works with CanvasFeatures track type)."
                                    optional="True"/>
                            </when>
                            <when value="false" />
                        </conditional>

                        <param label="Index this track" name="index" type="boolean" checked="false" truevalue="true" falsevalue="false" />

                        <expand macro="track_styling_feature"
                                classname="feature"
                                label="product,name,id"
                                description="note,description"
                                height="10px"/>
                        <expand macro="color_selection" />
                        <expand macro="track_menu" />
                        <expand macro="track_visibility" />
                    </when>
                    <when value="pileup">
                        <expand macro="input_conditional" label="BAM Track Data" format="bam" />
                        <expand macro="track_styling_xam"/>
                        <expand macro="track_visibility" />
                    </when>
                    <when value="cram">
                        <expand macro="input_conditional" label="CRAM Track Data" format="cram" />
                        <expand macro="track_styling_xam"/>
                        <expand macro="track_visibility" />
                    </when>
                    <when value="wiggle">
                        <expand macro="input_conditional" label="BigWig Track Data" format="bigwig" />

                        <param label="Use XYPlot"
                            help="instead of continuous colored band"
                            type="boolean"
                            name="xyplot"
                            truevalue="JBrowse/View/Track/Wiggle/XYPlot"
                            falsevalue="JBrowse/View/Track/Wiggle/Density" />
                        <param label="Show variance band"
                            help="Only for XYPlots"
                            type="boolean"
                            name="var_band"
                            truevalue="true"
                            falsevalue="false" />

                        <conditional name="scaling" label="Scaling">
                            <param type="select" label="Track Scaling" name="scale_select">
                                <option value="auto_local" selected="true">Autoscale (local)</option>
                                <option value="auto_global">Autoscale (global)</option>
                                <option value="fixed">Specify Min/Max</option>
                            </param>
                            <when value="auto_local"></when>
                            <when value="auto_global"></when>
                            <when value="fixed">
                                <param label="Track minimum" name="minimum"
                                    type="integer" value="0" />
                                <param label="Track maximum" name="maximum"
                                    type="integer" value="100" />
                            </when>
                        </conditional>
                        <param type="select" label="Visual Scaling" name="scale_select2">
                            <option value="linear" selected="true">Linear</option>
                            <option value="log">Logarithmic (Dynamically Calculated)</option>
                        </param>

                        <expand macro="color_selection_minmax" />

                        <expand macro="track_styling_bigwig"/>
                        <expand macro="track_visibility" />
                    </when>

                    <when value="synteny">
                        <param label="Other genome sequence"
                            format="fasta"
                            name="synteny_genome"
                            type="data" />
                        <!-- TODO add .out (MashMap) .chain (UCSC), .delta (mummer) and .anchors (mcscan) inputs -->
                        <expand macro="input_conditional" label="Synteny data" format="paf" />
                        <expand macro="track_visibility" />
                    </when>

                    <when value="hic">
                        <!-- TODO no hic datatype by default, but input for hicConvertFormat? hic_matrix datatype on .eu -->
                        <expand macro="input_conditional" label="HiC data" format="hic" />
                        <expand macro="track_visibility" />
                    </when>

                    <when value="sparql">
                        <param type="text" label="SPARQL Server URL" name="url" />
                        <param type="text" label="Track Label" name="label" value="SPARQL Genes" />
                        <param type="text" label="SPARQL Query" name="query" area="true">
                            <sanitizer>
                                <mapping initial="galaxy.util.mapped_chars">
                                <add source="&#10;" target=" " />
                                <add source="&gt;" target="__gt__" />
                                <add source="&lt;" target="__lt__" />
                                </mapping>
                                <valid initial="default">
                                <add value="|" />
                                <add value="#" />
                                <add value="{"/>
                                <add value="}"/>
                                <add value="!"/>
                                <add value="?"/>
                                <add value="&amp;"/>
                                <add value="+"/>
                                <add value="="/>
                                <add value="'"/>
                                <add value='"'/>
                                </valid>
                            </sanitizer>
                        </param>
                        <param type="text" label="SPARQL reference names query" help="This query should return a line for each reference name in a `refName` column" name="query_refnames" area="true">
                            <sanitizer>
                                <mapping initial="galaxy.util.mapped_chars">
                                <add source="&#10;" target=" " />
                                <add source="&gt;" target="__gt__" />
                                <add source="&lt;" target="__lt__" />
                                </mapping>
                                <valid initial="default">
                                <add value="|" />
                                <add value="#" />
                                <add value="{"/>
                                <add value="}"/>
                                <add value="!"/>
                                <add value="?"/>
                                <add value="&amp;"/>
                                <add value="+"/>
                                <add value="="/>
                                <add value="'"/>
                                <add value='"'/>
                                </valid>
                            </sanitizer>
                        </param>
                        <expand macro="track_visibility" />
                    </when>
                </conditional>
            </repeat>
        </repeat>

        <expand macro="general_options" />

        <param type="hidden" name="uglyTestingHack" value="" />
    </inputs>
    <outputs>
        <data format="html" name="output" label="JBrowse2 on $reference_genome.genome.element_identifier"/>
    </outputs>
    <tests>
         <test>
            <param name="reference_genome|genome_type_select" value="history"/>
            <param name="reference_genome|genome" value="merlin.fa"/>
            <repeat name="track_groups">
                <param name="category" value="Default" />
                <repeat name="data_tracks">
                    <conditional name="data_format">
                        <param name="data_format_select" value="wiggle"/>
                        <param name="annotation" value="bw/merlin.bw"/>
                    </conditional>
                </repeat>
            </repeat>
            <param name="uglyTestingHack" value="enabled" />
            <output name="output">
                <assert_contents>
                    <has_text text="genome path="></has_text>
                    <has_text text="dataset id="></has_text>
                    <has_text text="history id="></has_text>
                    <has_text text="metadata"></has_text>
                    <has_text text="tool_id"></has_text>
                    <has_text text="trackFile path="></has_text>
                    <has_text text="file_ext=&quot;bigwig&quot;"></has_text>
                    <has_text text="format=&quot;wiggle&quot;"></has_text>
                    <has_text text="LinearWiggleDisplay"></has_text>
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="reference_genome|genome_type_select" value="history"/>
            <param name="reference_genome|genome" value="merlin.fa"/>
            <repeat name="track_groups">
                <param name="category" value="Default" />
                <repeat name="data_tracks">
                    <conditional name="data_format">
                        <param name="data_format_select" value="vcf"/>
                        <param name="annotation" value="vcf/merlin.vcf"/>
                    </conditional>
                </repeat>
            </repeat>
            <param name="uglyTestingHack" value="enabled" />
            <output name="output">
                <assert_contents>
                    <has_text text="genome path="></has_text>
                    <has_text text="dataset id="></has_text>
                    <has_text text="history id="></has_text>
                    <has_text text="metadata"></has_text>
                    <has_text text="tool_id"></has_text>
                    <has_text text="trackFile path="></has_text>
                    <has_text text="ext=&quot;vcf&quot; label=&quot;merlin.vcf&quot;"></has_text>
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="reference_genome|genome_type_select" value="history"/>
            <param name="reference_genome|genome" value="merlin.fa"/>
            <param name="uglyTestingHack" value="enabled" />
            <output name="output">
                <assert_contents>
                    <has_text text="genome path="></has_text>
                    <has_text text="dataset id="></has_text>
                    <has_text text="history id="></has_text>
                    <has_text text="metadata"></has_text>
                    <has_text text="tool_id"></has_text>
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="reference_genome|genome_type_select" value="history"/>
            <param name="reference_genome|genome" value="merlin.fa"/>
            <repeat name="track_groups">
                <param name="category" value="Default" />
                <repeat name="data_tracks">
                    <conditional name="data_format">
                        <param name="data_format_select" value="gene_calls"/>
                        <param name="annotation" value="bed/test-3.bed,bed/test-6.bed"/>
                    </conditional>
                </repeat>
            </repeat>
            <param name="uglyTestingHack" value="enabled" />
            <output name="output">
                <assert_contents>
                    <has_text text="genome path="></has_text>
                    <has_text text="dataset id="></has_text>
                    <has_text text="history id="></has_text>
                    <has_text text="metadata"></has_text>
                    <has_text text="tool_id"></has_text>
                    <has_text text="trackFile path="></has_text>
                    <has_text text="ext=&quot;bed&quot; label=&quot;test-3.bed&quot;"></has_text>
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="reference_genome|genome_type_select" value="history"/>
            <param name="reference_genome|genome" value="merlin.fa"/>
            <repeat name="track_groups">
                <param name="category" value="Auto Coloured" />
                <repeat name="data_tracks">
                    <conditional name="data_format">
                        <param name="data_format_select" value="gene_calls"/>
                        <param name="annotation" value="gff3/A.gff,gff3/B.gff,gff3/C.gff,gff3/D.gff"/>
                        <conditional name="match_part">
                            <param name="match_part_select" value="false"/>
                        </conditional>
                        <section name="jbcolor_scale">
                            <conditional name="color_score">
                                <param name="color_score_select" value="none"/>
                            </conditional>
                            <conditional name="color">
                                <param name="color_select" value="automatic"/>
                            </conditional>
                        </section>
                    </conditional>
                </repeat>
            </repeat>

            <repeat name="track_groups">
                <param name="category" value="Ignore Scale" />
                <repeat name="data_tracks">
                    <conditional name="data_format">
                        <param name="data_format_select" value="gene_calls"/>
                        <param name="annotation" value="gff3/1.gff"/>
                        <conditional name="match_part">
                            <param name="match_part_select" value="false"/>
                        </conditional>
                        <section name="jbcolor_scale">
                            <conditional name="color_score">
                                <param name="color_score_select" value="none"/>
                                <conditional name="color">
                                    <param name="color_select" value="manual"/>
                                    <param name="style_color" value="#ff00ff"/>
                                </conditional>
                            </conditional>
                        </section>
                    </conditional>
                </repeat>
            </repeat>

            <repeat name="track_groups">
                <param name="category" value="Scaled Colour" />
                <repeat name="data_tracks">
                    <conditional name="data_format">
                        <param name="data_format_select" value="gene_calls"/>
                        <param name="annotation" value="gff3/1.gff"/>
                        <conditional name="match_part">
                            <param name="match_part_select" value="false"/>
                        </conditional>
                        <section name="jbcolor_scale">
                            <conditional name="color_score">
                                <param name="color_score_select" value="score"/>
                                <param name="score_scaling" value="linear"/>
                                <conditional name="score_scales">
                                    <param name="scale_select" value="automatic"/>
                                </conditional>
                                <conditional name="color_scheme">
                                    <param name="score_scheme" value="opacity"/>
                                    <conditional name="color">
                                        <param name="color_select" value="automatic"/>
                                    </conditional>
                                </conditional>
                            </conditional>
                        </section>
                    </conditional>
                </repeat>
                <repeat name="data_tracks">
                    <conditional name="data_format">
                        <param name="data_format_select" value="gene_calls"/>
                        <param name="annotation" value="gff3/1.gff"/>
                        <conditional name="match_part">
                            <param name="match_part_select" value="false"/>
                        </conditional>
                        <section name="jbcolor_scale">
                            <conditional name="color_score">
                                <param name="color_score_select" value="score"/>
                                <param name="score_scaling" value="linear"/>
                                <conditional name="score_scales">
                                    <param name="scale_select" value="automatic"/>
                                </conditional>
                                <conditional name="color_scheme">
                                    <param name="score_scheme" value="opacity"/>
                                    <conditional name="color">
                                        <param name="color_select" value="manual"/>
                                        <param name="style_color" value="#0000ff"/>
                                    </conditional>
                                </conditional>
                            </conditional>
                        </section>
                    </conditional>
                </repeat>
                <repeat name="data_tracks">
                    <conditional name="data_format">
                        <param name="data_format_select" value="gene_calls"/>
                        <param name="annotation" value="gff3/1.gff"/>
                        <conditional name="match_part">
                            <param name="match_part_select" value="false"/>
                        </conditional>
                        <section name="jbcolor_scale">
                            <conditional name="color_score">
                                <param name="color_score_select" value="score"/>
                                <param name="score_scaling" value="linear"/>
                                <conditional name="score_scales">
                                    <param name="scale_select" value="manual"/>
                                    <param name="minimum" value="0"/>
                                    <param name="maximum" value="1000"/>
                                </conditional>
                                <conditional name="color_scheme">
                                    <param name="score_scheme" value="opacity"/>
                                    <conditional name="color">
                                        <param name="color_select" value="automatic"/>
                                    </conditional>
                                </conditional>
                            </conditional>
                        </section>
                    </conditional>
                </repeat>
                <repeat name="data_tracks">
                    <conditional name="data_format">
                        <param name="data_format_select" value="gene_calls"/>
                        <param name="annotation" value="gff3/1.gff"/>
                        <conditional name="match_part">
                            <param name="match_part_select" value="false"/>
                        </conditional>
                        <section name="jbcolor_scale">
                            <conditional name="color_score">
                                <param name="color_score_select" value="score"/>
                                <param name="score_scaling" value="linear"/>
                                <conditional name="score_scales">
                                    <param name="scale_select" value="manual"/>
                                    <param name="minimum" value="0"/>
                                    <param name="maximum" value="1000"/>
                                </conditional>
                                <conditional name="color_scheme">
                                    <param name="score_scheme" value="opacity"/>
                                    <conditional name="color">
                                        <param name="color_select" value="manual"/>
                                        <param name="style_color" value="#ff0000"/>
                                    </conditional>
                                </conditional>
                            </conditional>
                        </section>
                    </conditional>
                </repeat>
            </repeat>

            <repeat name="track_groups">
                <param name="category" value="Realistic" />
                <repeat name="data_tracks">
                    <conditional name="data_format">
                        <param name="data_format_select" value="gene_calls"/>
                        <param name="annotation" value="gff3/interpro.gff"/>
                        <conditional name="match_part">
                            <param name="match_part_select" value="false"/>
                        </conditional>
                        <section name="jbcolor_scale">
                            <conditional name="color_score">
                                <param name="color_score_select" value="none"/>
                            </conditional>
                            <conditional name="color">
                                <param name="color_select" value="automatic"/>
                            </conditional>
                        </section>
                    </conditional>
                </repeat>
                <repeat name="data_tracks">
                    <conditional name="data_format">
                        <param name="data_format_select" value="gene_calls"/>
                        <param name="annotation" value="gff3/2.gff"/>
                        <conditional name="match_part">
                            <param name="match_part_select" value="true"/>
                            <param name="name" value="cDNA_match"/>
                        </conditional>
                        <section name="jbcolor_scale">
                            <conditional name="color_score">
                                <param name="color_score_select" value="none"/>
                            </conditional>
                            <conditional name="color">
                                <param name="color_select" value="automatic"/>
                            </conditional>
                        </section>
                    </conditional>
                </repeat>
            </repeat>

            <param name="uglyTestingHack" value="enabled" />
            <output name="output">
                <assert_contents>
                        <has_text text="Auto Coloured"/>
                        <has_text text="A.gff"/>
                        <has_text text="B.gff"/>
                        <has_text text="C.gff"/>
                        <has_text text="D.gff"/>
                        <has_text text="Scaled Colour"/>
                        <has_text text="1.gff"/>
                        <has_text text="2.gff"/>
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="reference_genome|genome_type_select" value="history"/>
            <param name="reference_genome|genome" value="merlin.fa"/>

            <repeat name="track_groups">
                <param name="category" value="With menu or index" />
                <repeat name="data_tracks">
                    <conditional name="data_format">
                        <param name="data_format_select" value="gene_calls"/>
                        <param name="annotation" value="gff3/1.gff"/>
                        <conditional name="match_part">
                            <param name="match_part_select" value="false"/>
                        </conditional>
                        <section name="jbcolor_scale">
                            <conditional name="color_score">
                                <param name="color_score_select" value="none"/>
                            </conditional>
                            <conditional name="color">
                                <param name="color_select" value="automatic"/>
                            </conditional>
                        </section>
                        <section name="jbmenu">
                            <repeat name="track_menu">
                                <param name="menu_action" value="iframeDialog"/>
                                <param name="menu_label" value="Some menu item"/>
                                <param name="menu_title" value="Frame title"/>
                                <param name="menu_url" value="https://example.com/#!/?id={name}&amp;q={type}&amp;z=&quot;{end}&quot;"/>
                                <param name="menu_icon" value="dijitIconNewTask"/>
                            </repeat>
                            <repeat name="track_menu">
                                <param name="menu_action" value="newWindow"/>
                                <param name="menu_label" value="Another menu item"/>
                                <param name="menu_title" value="Frame title 2"/>
                                <param name="menu_url" value="https://example.com/#!/?id={name}&amp;q={type}&amp;z=&quot;{end}&quot;"/>
                            </repeat>
                        </section>
                    </conditional>
                </repeat>
                <repeat name="data_tracks">
                    <conditional name="data_format">
                        <param name="data_format_select" value="gene_calls"/>
                        <param name="annotation" value="gff3/1.gff"/>
                        <param name="index" value="true"/>
                        <conditional name="match_part">
                            <param name="match_part_select" value="false"/>
                        </conditional>
                        <section name="jbcolor_scale">
                            <conditional name="color_score">
                                <param name="color_score_select" value="none"/>
                            </conditional>
                            <conditional name="color">
                                <param name="color_select" value="automatic"/>
                            </conditional>
                        </section>
                    </conditional>
                </repeat>
            </repeat>

            <param name="uglyTestingHack" value="enabled" />
            <output name="output">
                <assert_contents>
                    <has_text text="With menu or index"/>
                    <has_text text="Some menu item"/>
                    <has_text text="Frame title"/>
                    <has_text text="dijitIconNewTask"/>
                </assert_contents>
            </output>
        </test>

        <!-- TODO add a synteny test -->
        <!-- TODO add a bam and a cram test -->
        <!-- TODO add an hic test -->
        <!-- TODO add a vcf_bgzip test -->
    </tests>
    <help><![CDATA[

JBrowse2-in-Galaxy
==================

JBrowse2-in-Galaxy offers a highly configurable, workflow-compatible
alternative to JBrowse1-in-Galaxy and Trackster.

Compared to JBrowse1-in-Galaxy, there is no support for alternative codons for unusual genomes,
and detailed track styling is not yet implemented. Send code.
JBrowse1 development has now ceased in favour of JBrowse2.

Use and local viewing
=====================

A JBrowse2 history item can be opened by viewing it (the "eye" icon).
They can also be downloaded as archives ("floppy disk" icon) to share and for local viewing.
One extra step is required before they can be viewed. A local python web server must be started using a script included in each archive.
Unzip the archive (*unzip [filename].zip*) and change to the first level directory. It contains a file named "servejb2.py"

Assuming you have python3 installed, running:

*python3 servjb2.py*

will serve the unarchived JBrowse2 configuration, so it can be browsed by pointing a web browser to localhost:8080

Overview
--------

JBrowse is a fast, embeddable genome browser built completely with
JavaScript and HTML5.

The JBrowse-in-Galaxy (JiG) tool was written to help build complex
JBrowse installations straight from Galaxy, taking advantage of the
latest Galaxy features such as dataset collections, sections, and colour
pickers. It allows you to build up a JBrowse instance without worrying
about how to run the command line tools to format your data, and which
options need to be supplied and where. Additionally it comes with many
javascript functions to handle colouring of features which would be
nearly impossible to write without the assistance of this tool.

The JBrowse-in-Galaxy tool is maintained by `the Galaxy IUC
<https://github.com/galaxyproject/tools-iuc/issues>`__, who you can help you
with missing features or bugs in the tool.

Options
-------

The first option you encounter is the **Fasta Sequence(s)**. This option
now accepts multiple fasta files, allowing you to build JBrowse
instances that contain data for multiple genomes or chrosomomes
(generally known as "landmark features" in gff3 terminology.)

**Track Groups** represent a set of tracks in a single category. These
can be used to let your users understand relationships between large
groups of tracks.

.. image:: sections.png

Annotation Tracks
-----------------

There are a few different types of tracks supported, each with their own
set of options:

GFF3/BED
~~~~~~~~

These are standard feature tracks. They usually highlight genes,
mRNAs and other features of interest along a genomic region.

BAM Pileups
~~~~~~~~~~~

We support BAM files and can automatically generate SNP tracks based on
that bam data.


BlastXML
~~~~~~~~

.. image:: blast.png

JiG now supports both blastn and blastp datasets. JiG internally uses a
blastXML to gapped GFF3 tool to convert your blastxml datasets into a
format amenable to visualization in JBrowse. This tool is also
available separately from the IUC on the toolshed.

**Minimum Gap Size** reflects how long a gap must be before it becomes a
real gap in the processed gff3 file. In the picture above, various sizes
of gaps can be seen. If the minimum gap size was set much higher, say
100nt, many of the smaller gaps would disappear, and the features on
both sides would be merged into one, longer feature. This setting is
inversely proportional to runtime and output file size. *Do not set this
to a low value for large datasets*. By setting this number lower, you
will have extremely large outputs and extremely long runtimes. The
default was configured based off of the author's experience, but the
author only works on small viruses. It is *strongly* recommended that
you filter your blast results before display, e.g. picking out the top
10 hits or so.

**Protein blast search** option merely informs underlying tools that
they should adjust feature locations by 3x.

Bigwig XY
~~~~~~~~~

.. image:: bigwig.png



VCFs/SNPs
~~~~~~~~~

These tracks do not support any special configuration.

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