view jbrowse.xml @ 16:b5c5470d7c09 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit c306d242caf7e0447517c9749ca7656823f315e5
author iuc
date Wed, 13 Sep 2017 13:07:20 -0400
parents 69c5e9c0add0
children ff11d442feed
line wrap: on
line source

<tool id="jbrowse" name="JBrowse" version="@WRAPPER_VERSION@.2">
  <description>genome browser</description>
  <macros>
    <import>macros.xml</import>
  </macros>
  <expand macro="requirements"/>
  <expand macro="stdio"/>
  <command><![CDATA[

#if $action.action_select == "create":
    mkdir -p $output.files_path &&
#else:
    cp -R $action.update_jbrowse.extra_files_path $output.files_path &&
#end if

## 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 &&

## Once that's done, we run the python script to handle the real work
python $__tool_directory__/jbrowse.py

--jbrowse \${JBROWSE_SOURCE_DIR}
#if str($standalone) == "Complete":
    --standalone
#end if

--outdir $output.files_path
$trackxml &&

#if str($standalone) == "Complete":
    mv $output.files_path/index.html $output;
#else:
    mv $dummyIndex $output;
#end if


## Ugly testing hack since I cannot get <extra_files> to test the files I want to test. Hmph.
#if str($uglyTestingHack) == "enabled":
    mv $trackxml $output
#end if
]]></command>
  <configfiles>
      <configfile name="dummyIndex">
      <![CDATA[
      <html>
          <head>
          </head>
          <body>
              <h1>JBrowse Data Directory</h1>
              <p>
                Hi! This is not a full JBrowse instance. JBrowse v0.4(+?)
                started shipping with the ability to produce just the
                "data" directory from a JBrowse instance, rather than a
                complete, standalone instance. This was intended to be used
                with the in-development Apollo integration, but may have other
                uses as well.
              </p>
              <p>
                <u>This is not usable on its own</u>. The output dataset may be
                used with Apollo, or may be passed through the "JBrowse -
                Convert to Standalone" tool in Galaxy to "upgrade" to a full
                JBrowse instance.
              </p>
          </body>
      </html>
          ]]>
      </configfile>
      <configfile name="trackxml"><![CDATA[<?xml version="1.0"?>
<root>
    <metadata>
        <gencode>$gencode</gencode>
        <genomes>
            #if str($reference_genome.genome_type_select) == "indexed":
              <genome>${reference_genome.genomes.fields.path}</genome>
            #else
              #for $genome in $reference_genome.genomes:
                  <genome>$genome</genome>
              #end for
            #end if
        </genomes>
        <general>
            <defaultLocation>${jbgen.defaultLocation}</defaultLocation>
            <trackPadding>${jbgen.trackPadding}</trackPadding>

            <shareLink>${jbgen.shareLink}</shareLink>
            <aboutDescription>${jbgen.aboutDescription}</aboutDescription>
            <show_tracklist>${jbgen.show_tracklist}</show_tracklist>
            <show_nav>${jbgen.show_nav}</show_nav>
            <show_overview>${jbgen.show_overview}</show_overview>
            <show_menu>${jbgen.show_menu}</show_menu>
            <hideGenomeOptions>${jbgen.hideGenomeOptions}</hideGenomeOptions>
        </general>
    </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}">
            <files>
              #for $dataset in $track.data_format.annotation:
              <trackFile path="${dataset}" ext="${dataset.ext}" label="${dataset.element_identifier}" />
              #end for
            </files>

            <options>
            #if str($track.data_format.data_format_select) == "gene_calls" or  str($track.data_format.data_format_select) == "blast":
                <style>
                    <className>${track.data_format.jbstyle.style_classname}</className>
                    <description>${track.data_format.jbstyle.style_description}</description>
                    <label>${track.data_format.jbstyle.style_label}</label>
                    <height>${track.data_format.jbstyle.style_height}</height>
                </style>
                <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

                  ## 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>
                    <auto_snp>${track.data_format.auto_snp}</auto_snp>
                    <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) == "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>
                    <trackType>${track.data_format.track_config.track_class}</trackType>
                  #if $track.data_format.track_config.track_class == 'JBrowse/View/Track/CanvasFeatures':
                    #if str($track.data_format.track_config.canvas_options.transcriptType) != "":
                    <transcriptType>${track.data_format.track_config.canvas_options.transcriptType}</transcriptType>
                    #end if
                    #if str($track.data_format.track_config.canvas_options.subParts) != "":
                    <subParts>${track.data_format.track_config.canvas_options.subParts}</subParts>
                    #end if
                    #if str($track.data_format.track_config.canvas_options.impliedUTRs) != "false":
                    <impliedUTRs>${track.data_format.track_config.canvas_options.impliedUTRs}</impliedUTRs>
                    #end if
                  #else if $track.data_format.track_config.track_class == 'JBrowse/View/Track/HTMLFeatures':
                    #if str($track.data_format.track_config.html_options.transcriptType) != "":
                    <transcriptType>${track.data_format.track_config.html_options.transcriptType}</transcriptType>
                    #end if
                  #end if
                  #if $track.data_format.match_part.match_part_select:
                    <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) == "sparql":
##                <sparql>
##                    <url>${track.data_format.url}</url>
##                    <label>${track.data_format.label}</label>
##                    <!-- This is going to be an absolutey nightmare -->
##                    <query>${track.data_format.query}</query>
##                </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="genomes"
              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" />
                </options>
            </param>
        </when>
        <when value="history">
            <param
              format="fasta"
              label="Select the reference genome"
              name="genomes"
              type="data"
              multiple="True" />
        </when>
    </conditional>

    <param name="standalone" label="Produce Standalone Instance" type="boolean" truevalue="Complete" falsevalue="Data Directory" help="Produce a full, working JBrowse instance or just the data directory. Data dir mode is experimental and intended to be used with Apollo" checked="True"/>


    <param label="Genetic Code" name="gencode" type="select">
      <option value="1">1. The Standard Code</option>
      <option value="2">2. The Vertebrate Mitochondrial Code</option>
      <option value="3">3. The Yeast Mitochondrial Code</option>
      <option value="4">4. The Mold, Protozoan, and Coelenterate Mitochondrial Code and the Mycoplasma/Spiroplasma Code</option>
      <option value="5">5. The Invertebrate Mitochondrial Code</option>
      <option value="6">6. The Ciliate, Dasycladacean and Hexamita Nuclear Code</option>
      <option value="9">9. The Echinoderm and Flatworm Mitochondrial Code</option>
      <option value="10">10. The Euplotid Nuclear Code</option>
      <option value="11">11. The Bacterial, Archaeal and Plant Plastid Code</option>
      <option value="12">12. The Alternative Yeast Nuclear Code</option>
      <option value="13">13. The Ascidian Mitochondrial Code</option>
      <option value="14">14. The Alternative Flatworm Mitochondrial Code</option>
      <option value="16">16. Chlorophycean Mitochondrial Code</option>
      <option value="21">21. Trematode Mitochondrial Code</option>
      <option value="22">22. Scenedesmus obliquus Mitochondrial Code</option>
      <option value="23">23. Thraustochytrium Mitochondrial Code</option>
      <option value="24">24. Pterobranchia Mitochondrial Code</option>
      <option value="25">25. Candidate Division SR1 and Gracilibacteria Code</option>
   </param>

    <conditional name="action">
        <param type="select" label="JBrowse-in-Galaxy Action" name="action_select">
            <option value="create">New JBrowse Instance</option>
            <option value="update">Update exising JBrowse Instance</option>
        </param>
        <when value="create" />
        <when value="update">
            <param label="Previous JBrowse Instance"
                   name="update_jbrowse"
                   type="data"
                   format="html" />
        </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" optional="False"/>
    <repeat name="data_tracks" title="Annotation Track">
        <conditional name="data_format">
            <param type="select" label="Track Type" name="data_format_select">
                <option value="gene_calls">GFF/GFF3/BED/GBK Features</option>
                <option value="pileup">BAM Pileups</option>
                <option value="blast">Blast XML</option>
                <option value="wiggle">BigWig XY</option>
                <option value="vcf">VCF SNPs</option>
                <!--<option value="sparql">SPARQL</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"
                        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_display" />
            </when>
            <when value="vcf">
                <expand macro="input_conditional" label="SNP Track Data" format="vcf" />
                <expand macro="track_display" />
            </when>
            <when value="gene_calls">
                <expand macro="input_conditional" label="GFF/GFF3/BED Track Data" format="gff,gff3,bed" />
                <conditional name="match_part">
                    <param label="This is match/match_part data"
                           type="boolean"
                           name="match_part_select"
                           truevalue="true"
                           falsevalue="false" />
                    <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"
                               optional="False"/>
                    </when>
                    <when value="false" />
                </conditional>

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

                <conditional name="track_config">
                    <param type="select" label="JBrowse Track Type [Advanced]" name="track_class">
                        <option value="JBrowse/View/Track/HTMLFeatures">HTML Features</option>
                        <option value="JBrowse/View/Track/CanvasFeatures" selected="true">Canvas Features</option>
                    </param>
                    <when value="JBrowse/View/Track/CanvasFeatures">
                        <section name="canvas_options" title="CanvasFeatures Options [Advanced]" expanded="false">
                            <param label="Transcript type"
                                   name="transcriptType"
                                   type="text"
                                   value=""
                                   help="If your input files represents transcripts with features not named 'mRNA', give the alternate name here (e.g. 'transcript')"
                                   optional="True"/>
                            <param label="Subfeatures type"
                                   name="subParts"
                                   type="text"
                                   value=""
                                   help="If you have 'exons' but no corresponding 'CDS' features, specify here the subfeatures that should be displayed (e.g. 'exon')"
                                   optional="True"/>
                            <param label="Implied UTRs"
                                   name="impliedUTRs"
                                   type="boolean"
                                   checked="false"
                                   truevalue="true"
                                   falsevalue="false"
                                   help="Check this your input files does not contain UTR features, but the UTR can be 'implied' from the difference between the exon and CDS boundaries"/>
                       </section>
                   </when>
                   <when value="JBrowse/View/Track/HTMLFeatures">
                       <section name="html_options" title="HTMLFeatures Options [Advanced]" expanded="false">
                           <param label="Transcript type"
                                  name="transcriptType"
                                  type="text"
                                  value=""
                                  help="If your input files represents transcripts, give the name of the corresponding features here (e.g. 'mRNA' or 'transcript')"
                                  optional="True"/>
                      </section>
                   </when>
                </conditional>
                <expand macro="track_styling" />
                <expand macro="color_selection" />
                <expand macro="track_menu" />
                <expand macro="track_display" />
            </when>
            <when value="pileup">
                <expand macro="input_conditional" label="BAM Track Data" format="bam" />
                <param label="Autogenerate SNP Track"
                       help="Not recommended for deep coverage BAM files"
                       type="boolean"
                       name="auto_snp"
                       truevalue="true"
                       falsevalue="false" />
                <expand macro="track_display" />
            </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">
                    <param type="select" label="Track Scaling" name="scale_select">
                        <option value="auto_local">Autoscale (local)</option>
                        <option value="auto_global" selected="true">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>
                <expand macro="color_selection_minmax" />
                <expand macro="track_display" />
            </when>
            <!--
            <when value="sparql">
                <param type="text" label="SPARQL Server URL" name="url" />
                <param type="text" label="Track Label" name="key" value="SPARQL Genes" />
                <param type="text" label="SPARQL Query" name="query" area="true" />
                <expand macro="track_display" />
            </when>
            -->
        </conditional>
    </repeat>
    </repeat>

    <expand macro="general_options" />
    <param type="hidden" name="uglyTestingHack" value="" />
  </inputs>
  <outputs>
      <data format="html" name="output" label="JBrowse on $on_string - $standalone"/>
  </outputs>
  <tests>
    <test>
      <!-- gencode -->
      <param name="reference_genome|genome_type_select" value="history"/>
      <param name="reference_genome|genomes" value="merlin.fa"/>
      <param name="gencode" value="1" />
      <param name="standalone" value="Data Directory" />
      <param name="uglyTestingHack" value="enabled" />
      <output name="output" file="gencode/test-1.xml" lines_diff="4" />
    </test>
    <test>
      <param name="reference_genome|genome_type_select" value="history"/>
      <param name="reference_genome|genomes" value="merlin.fa"/>
      <param name="gencode" value="11" />
      <param name="standalone" value="Data Directory" />
      <param name="uglyTestingHack" value="enabled" />
      <output name="output" file="gencode/test.xml" lines_diff="4"/>
    </test>
    <test>
      <param name="reference_genome|genome_type_select" value="history"/>
      <param name="reference_genome|genomes" value="merlin.fa"/>
      <param name="gencode" value="11" />
      <param name="standalone" value="Data Directory" />
      <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" file="gff3/test.xml" lines_diff="24" />
    </test>
    <test>
        <param name="reference_genome|genome_type_select" value="history"/>
        <param name="reference_genome|genomes" value="merlin.fa"/>
        <param name="gencode" value="11" />
        <param name="standalone" value="Data Directory" />

        <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" file="menus/test.xml" lines_diff="6"/>
    </test>
    <test>
        <param name="reference_genome|genome_type_select" value="history"/>
        <param name="reference_genome|genomes" value="merlin.fa"/>
        <param name="gencode" value="11" />
        <param name="standalone" value="Data Directory" />

        <repeat name="track_groups">
            <param name="category" value="With canvas config" />
            <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>
                    <conditional name="track_config">
                        <section name="canvas_options">
                            <param name="transcriptType" value="transcript"/>
                            <param name="subParts" value="exon"/>
                            <param name="impliedUTRs" value="true"/>
                        </section>
                    </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" file="track_config/test.xml" lines_diff="6"/>
    </test>
  </tests>
  <help><![CDATA[
JBrowse-in-Galaxy
=================

JBrowse-in-Galaxy offers a highly configurable, workflow-compatible
alternative to Trackster.

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 `Eric
Rasche <mailto:esr+jig@tamu.edu>`__, who you can contact if you
encounter missing features or bugs.

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.) Up to 30
will be shown from the dropdown selector within JBrowse, this is a known
issue.

**Standalone Instances** are a somewhat in-development feature.
Currently Galaxy copies the entire JBrowse directory in order to have a
complete, downloadable file that contains a ready-to-go JBrowse
instance. This is obviously an anti-feature because users don't want a
complete copy of JBrowse (6-20Mb) that's duplicated for every JBrowse
dataset in their history, and admins don't want useless copies of
JBrowse on disk. Unfortunately we have not come up with the perfect
solution just yet, but we're working on it! In the meantime, users have
been given the option to produce just the ``data/`` directory. For those
unfamiliar with JBrowse, the ``data/`` directory contains processed data
files, but no way to view them. This feature is additionally implemented
for upcoming `Apollo <https://github.com/gmod/apollo>`__ integration.

**Genetic Code** is a new feature in v0.4 of JiG / v1.12.0 of JBrowse,
which allows users to specify a non standard genetic code, and have
JBrowse highlight the correct start and stop codons. If you would like
to use a coding table not provided by this list, please let
`me <mailto:esr+jig@tamu.edu>`__ know so that I may add support for
this.

**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
-----------------

Within Track Groups, you have one or more **Annotation Tracks**. Each
Annotation Track is a groups of datasets which have similar styling.
This allows you to rapidly build up JBrowse instances without having to
configure tracks individually. A massive improvement over previous
versions. For example, if you have five different GFF3 files from
various gene callers that you wish to display, you can take advantage of
this feature to style all of them similarly.

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

GFF3/BED/GBK
~~~~~~~~~~~~

These are your standard feature tracks. They usually highlight genes,
mRNAs and other features of interest along a genomic region. The
underlying tool and this help documentation focus primarily on GFF3
data, and have not been tested extensively with other formats. Automatic
min/max detection will likely fail under BED and GBK datasets.

The data may be of a subclass we call **match/match part** data. This
consists of top level ``match`` features, with a child ``match_part``
feature, and is often used in displaying alignments. (See "Alignments"
section on the `GFF3
specification <https://github.com/The-Sequence-Ontology/Specifications/blob/master/gff3.md>`__ for more
information). If the data is match/match part, you will need to specify
the top level match feature name, as it can be one of a few different SO
terms, and JiG does not yet have the ability to understand SO terms.

Next up is the **Styling Options** section, which lets you control a few
properties on how the track is styled. Most of these you will not need
to configure and can safely leave on defaults. Occasionally you will
want to change what information is shown in the end product.

.. image:: styling.png

In the above image you can see some black text, and some blue text. The
source of the black text is configured with the **style.label** option,
and the source of the blue text is configured with the
**style.description** option.

Feature Score Scaling & Colouring Options
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

First, you need to choose between ignoring the score attribute of GFF3
files, or using it. If you choose to ignore it, all features will be
coloured with a solid colour. If you choose to use it, features will
have slightly different colours based on their scores.

.. image:: opacity.png

If you choose **Ignore score**, you may choose between automatically
choosing a colour, or manually specifying one. The automatically chosen
colours vary along a brewer palette and generally look quite nice with
no human intervention required. The manual colour choice is somewhat
self explanatory. Clicking on the small coloured square will bring up a
colour palette.

If you choose **Base on score**, you're faced with a dizzying array of
options. First is the function to map the colour choices to colour
values. JiG comes with a few functions built in such as linear scaling,
logarithmic scaling, and blast scaling.

The **linear scaling** method says "take these values, and they map
directly to a range of output values". **Logarithmic scaling** says
"please take the log of the score before mapping", and **Blast scaling**
is further specialised to handle blast data more nicely. These are
convenience functions to help transform the wide array of possible
values in the GFF3 score attribute to more meaningful numbers. If you
need more comprehensive score scaling, it is recommended that you
pre-process your GFF3 files somehow.

Once you've selected a scaling method, you can choose to manually
specify the minimum and maximum expected values, or you can let JiG
determine them for you automatically.

Finally, opacity is the only mapping we currently provide. Future
iterations will attempt to improve upon this and provide more colour
scales. The Opacity option maps the highest scoring features to full
opacity, and everything else to lower ones.

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

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

.. image:: bam.png

This is *strongly discouraged* for high coverage density datasets.
Unfortunately there are no other configuration options exposed for bam
files. If you find JBrowse options you wish to see exposed, please let
`me <mailto:esr+jig@tamu.edu>`__ know.

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.

Styling Options
^^^^^^^^^^^^^^^

Please see the styling options for GFF3 datasets, they are identical.

Feature Score Scaling & Coloring Options
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Please see the score scaling and colouring options for GFF3 datasets,
they are identical. Remember to set your score scaling to "blast" method
if you do use it.

Bigwig XY
~~~~~~~~~

.. image:: bigwig.png

**XYPlot**

BigWig tracks can be displayed as a "density" plot which is continuous
line which varies in colour, or as an "XYplot." XYplots are preferable
for users to visually identify specific features in a bigwig track,
however density tracks are more visually compact.

**Variance Band** is an option available to XYPlots, and can be seen in
the third and fourth tracks in the above picture. This overlays a mean
line, and 1 and 2 standard deviation areas.

**Track Scaling** is different from colour scaling, instead it
configures how the track behaves inside of JBrowse. **Autoscaling
globally** means that JBrowse will determine the minimum and maximum for
the track, and fix the bounds of the viewport to that. E.g. if your
track ranges from 1-1000, and the region you're currently zoomed to only
goes from 0-50, then the viewport range will still show 1-1000. This is
good for global genomic context. However you may wish to consider
**autoscaling locally** instead. In the example of a region which varies
from 0-50, autoscaling locally would cause the individual track's
viewport to re-adjust and show just the 0-50 region. If neither of these
options are palatable, you may manually hardcode the minimum and
maximums for the track to scale to.

Colour Options
^^^^^^^^^^^^^^

BigWig tracks have two colours in JBrowse, a positive and a negative
colour.

As always you may manually choose a colour, or let JiG choose for you.

One of the more interesting options is the **Bicolor pivot**. This
option allows you to control the point at which JBrowse switches from
the positive colour to the negative. In the above graphic, you can see
this has been configured to "mean" for the first two (orange and blue)
tracks.

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

These tracks do not support any special configuration.

Known Issues
------------

-  More than 30 landmark features cannot be listed in the manual
   selector.
-  Non GFF3 likely has issue with automatically determined min/max
   scores. Manually specify minimum and maximum score attributes, or do
   not use varied colours based on scores to avoid this issue.


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