Repository 'jbrowse2'
hg clone https://toolshed.g2.bx.psu.edu/repos/fubar/jbrowse2

Changeset 31:cb4b32ca9968 (2024-02-23)
Previous changeset 30:8f02a84ee278 (2024-02-21) Next changeset 32:fe48ed5810bd (2024-02-23)
Commit message:
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919-dirty
modified:
jbrowse2.py
jbrowse2.xml
macros.xml
b
diff -r 8f02a84ee278 -r cb4b32ca9968 jbrowse2.py
--- a/jbrowse2.py Wed Feb 21 02:57:30 2024 +0000
+++ b/jbrowse2.py Fri Feb 23 07:15:42 2024 +0000
[
@@ -450,22 +450,24 @@
             if len(genome_name.split()) > 1:
                 genome_name = genome_name.split()[0]
                 # spaces and cruft break scripts when substituted
-            fapath = genome_node["path"]
-            assem = self.make_assembly(fapath, genome_name)
-            assemblies.append(assem)
-            self.genome_names.append(genome_name)
-            if self.genome_name is None:
-                self.genome_name = (
-                    genome_name  # first one for all tracks - other than paf
-                )
-                self.genome_firstcontig = None
-                fl = open(fapath, "r").readline().strip().split(">")
-                if len(fl) > 1:
-                    fl = fl[1]
-                    if len(fl.split()) > 1:
-                        self.genome_firstcontig = fl.split()[0].strip()
-                    else:
-                        self.genome_firstcontig = fl
+            if genome_name not  in self.genome_names:
+                # ignore dupes - can have multiple pafs with same references?
+                fapath = genome_node["path"]
+                assem = self.make_assembly(fapath, genome_name)
+                assemblies.append(assem)
+                self.genome_names.append(genome_name)
+                if self.genome_name is None:
+                    self.genome_name = (
+                        genome_name  # first one for all tracks - other than paf
+                    )
+                    self.genome_firstcontig = None
+                    fl = open(fapath, "r").readline().strip().split(">")
+                    if len(fl) > 1:
+                        fl = fl[1]
+                        if len(fl.split()) > 1:
+                            self.genome_firstcontig = fl.split()[0].strip()
+                        else:
+                            self.genome_firstcontig = fl
         if self.config_json.get("assemblies", None):
             self.config_json["assemblies"] += assemblies
         else:
@@ -1013,26 +1015,31 @@
     def add_paf(self, data, trackData, pafOpts, **kwargs):
         tname = trackData["name"]
         tId = trackData["label"]
-        pgname = pafOpts["genome_label"]
-        if len(pgname.split()) > 1:
-            pgname = pgname.split()[
-                0
-            ]  # trouble from spacey names in command lines avoidance
-        asstrack = self.make_assembly(pafOpts["genome"], pgname)
-        self.genome_names.append(pgname)
-        if self.config_json.get("assemblies", None):
-            self.config_json["assemblies"].append(asstrack)
-        else:
-            self.config_json["assemblies"] = [
-                asstrack,
-            ]
+        pgnames = [x.strip() for x in pafOpts["genome_label"].split(',')]
+        pgpaths =  [x.strip() for x in pafOpts["genome"].split(',')]
+        passnames = [self.genome_name] # always first
+        for i, gname in enumerate(pgnames):
+            if len(gname.split()) > 1:
+                gname = gname.split()[0]
+                # trouble from spacey names in command lines avoidance
+                if gname not in self.genome_names:
+                    passnames.append(gname)
+                   # ignore if already there - eg for duplicates among pafs.
+                    asstrack = self.make_assembly(pgpaths[i], gname)
+                    self.genome_names.append(gname)
+                    if self.config_json.get("assemblies", None):
+                        self.config_json["assemblies"].append(asstrack)
+                    else:
+                        self.config_json["assemblies"] = [
+                            asstrack,
+                        ]
         url = "%s.paf" % (trackData["label"])
         dest = "%s/%s" % (self.outdir, url)
         self.symlink_or_copy(os.path.realpath(data), dest)
         trackDict = {
             "type": "SyntenyTrack",
             "trackId": tId,
-            "assemblyNames": [self.genome_name, pgname],
+            "assemblyNames": passnames,
             "name": tname,
             "adapter": {
                 "type": "PAFAdapter",
@@ -1533,6 +1540,9 @@
     default_session_data["session_name"] = root.find(
         "metadata/general/session_name"
     ).text
+    jc.zipOut =  root.find(
+        "metadata/general/zipOut"
+    ).text == "true"
     general_data = {
         "analytics": root.find("metadata/general/analytics").text,
         "primary_color": root.find("metadata/general/primary_color").text,
b
diff -r 8f02a84ee278 -r cb4b32ca9968 jbrowse2.xml
--- a/jbrowse2.xml Wed Feb 21 02:57:30 2024 +0000
+++ b/jbrowse2.xml Fri Feb 23 07:15:42 2024 +0000
[
b'@@ -17,9 +17,12 @@\n python \'$__tool_directory__/jbrowse2.py\'\n --outdir \'$output.files_path\'\n --xml \'$trackxml\' &&\n-\n-cp \'$output.files_path/index.html\' \'$output\'\n-\n+#if $jbgen.zipOut == "true":\n+    (cd \'$output.files_path\' && zip -r - . ) > JBrowse2.zip &&\n+    mv JBrowse2.zip \'$output\'\n+#else\n+  cp \'$output.files_path/index.html\' \'$output\'\n+#end if\n ## Ugly testing hack since I cannot get <extra_files> to test the files I want to test. Hmph.\n #if str($uglyTestingHack) == "enabled":\n  &&   cp \'$trackxml\' \'$output\'\n@@ -77,6 +80,7 @@\n         </genomes>\n         <general>\n             <defaultLocation>${jbgen.defaultLocation}</defaultLocation>\n+            <zipOut>${jbgen.zipOut}</zipOut>\n             <analytics>${jbgen.enableAnalytics}</analytics>\n             <primary_color>${jbgen.primary_color}</primary_color>\n             <secondary_color>${jbgen.secondary_color}</secondary_color>\n@@ -89,100 +93,109 @@\n     </metadata>\n     <tracks>\n         #for $tg in $track_groups:\n-        #for $track in $tg.data_tracks:\n-        <track cat="${tg.category}" format="${track.data_format.data_format_select}" visibility="${track.data_format.track_visibility}">\n-            #if $track.data_format.data_format_select != "sparql":\n-            <files>\n-              #set dataset = $track.data_format.annotation\n-              <trackFile path="${dataset}" ext="${dataset.ext}" label="${dataset.element_identifier}">\n-                <metadata>\n-                  <dataset id="${__app__.security.encode_id($dataset.id)}" hid="${dataset.hid}"\n-                      size="${dataset.get_size(nice_size=True)}"\n-                      edam_format="${dataset.datatype.edam_format}"\n-                      file_ext="${dataset.ext}" />\n-                  <history id="${__app__.security.encode_id($dataset.history_id)}"\n-                      #if $dataset.history.user:\n-                      user_email="${dataset.history.user.email}"\n-                      user_id="${dataset.history.user_id}"\n-                      display_name="${dataset.history.get_display_name()}"/>\n-                      #else\n-                      user_email="anonymous"\n-                      user_id="-1"\n-                      display_name="Unnamed History"/>\n-                      #end if\n-                  <metadata\n-                    #for (key, value) in $dataset.get_metadata().items():\n-                    #if "_types" not in $key and $value is not None and len(str($value)) < 5000:\n-                      #if isinstance($value, list):\n-                        #set value_str = "[%s]" % \',\'.join([str(val) for val in value])\n-                        ${key}="$value_str"\n-                      #else\n-                        ${key}="${value}"\n-                      #end if\n-                    #end if\n-                    #end for\n-                      />\n-                  <tool\n-                      tool_id="${dataset.creating_job.tool_id}"\n-                      tool_version="${dataset.creating_job.tool_version}"\n-                      />\n-                </metadata>\n-              </trackFile>\n-            </files>\n-            #end if\n+            #for $track in $tg.data_tracks:\n+            <track cat="${tg.category}" format="${track.data_format.data_format_select}" visibility="${track.data_format.track_visibility}">\n+                #if $track.data_format.data_format_select != "sparql":\n+                    <files>\n+                    #set dataset = $track.data_format.annotation\n+                      <trackFile path="${dataset}" ext="${dataset.ext}" label="${dataset.element_identifier}">\n+                        <metadata>\n+                          <dataset id="${__app__.security.encode_id($dataset.id)}" hid="${dataset.hid}"\n+                              size="${dataset.get_size(nice_size=True)}"\n+                              edam_format="${dataset.datatype.edam_format}"\n+                              file_ext="${dataset.ext}" />\n+                          <history id="${__ap'..b'$gnome,\n+                        #end for\n+                        </genome>\n+                        <genome_label>\n+                        #for gnome in $track.data_format.synteny_genome:\n+                            $gnome.name,\n+                        #end for\n+                        </genome_label>\n+                    </paf>\n+                #else if str($track.data_format.data_format_select) == "hic":\n+                    <hic>\n+                    </hic>\n+                #else if str($track.data_format.data_format_select) == "cool":\n+                    <cool>\n+                    </cool>\n+                #else if str($track.data_format.data_format_select) == "sparql":\n+                    <label>${track.data_format.label}</label>\n+                    <sparql>\n+                        <url>${track.data_format.url}</url>\n+                        <query>${track.data_format.query}</query>\n+                        <query_refnames>${track.data_format.query_refnames}</query_refnames>\n+                    </sparql>\n+                #end if\n+                </options>\n+            </track>\n         #end for\n-        #end for\n+    #end for\n     </tracks>\n </root>\n ]]></configfile>\n@@ -236,7 +249,7 @@\n                         <option value="maf">Multiple alignment format. Reference name must match the MAF name exactly to work correctly</option>\n                         <option value="paf">PAF - approximate mapping positions between two set of sequences</option>\n                         <option value="sparql">SPARQL</option>\n-                       <option value="vcf">VCF SNP annotation</option>\n+                       <option value="vcf">VCF SNP</option>\n                     </param>\n                     <when value="blast">\n                         <expand macro="input_conditional" label="BlastXML Track Data" format="blastxml" />\n@@ -302,11 +315,12 @@\n                         <expand macro="track_visibility" />\n                     </when>\n                     <when value="paf">\n-                        <param label="Comparison genome sequence" help="Paf from this as the reference, using the real reference as the reads to map"\n+                        <param label="Comparison genome sequence" help="Paf from these as the references, using the real reference as the reads to map"\n                             format="fasta"\n                             name="synteny_genome"\n-                            type="data" />\n-                        <expand macro="input_conditional" label="Synteny data" format="paf" help="Make paf with minimap2 mapping real reference onto desired syntenic reference"/>\n+                            type="data"\n+                            multiple="True"/>\n+                        <expand macro="input_conditional" label="Synteny data" format="paf" help="Make paf with mashmap or minimap2 mapping real reference onto desired syntenic references"/>\n                         <expand macro="track_visibility" />\n                     </when>\n \n@@ -376,7 +390,11 @@\n         <param type="hidden" name="uglyTestingHack" value="" />\n     </inputs>\n     <outputs>\n-        <data format="html" name="output" label="JBrowse2 on $reference_genome.genome.name"/>\n+        <data format="html" name="output" label="JBrowse2 on $reference_genome.genome.name">\n+            <change_format>\n+                <when input="zipOut" value="true" format="zip" />\n+            </change_format>\n+        </data>\n     </outputs>\n     <tests>\n          <test>\n@@ -405,6 +423,7 @@\n                 </assert_contents>\n             </output>\n         </test>\n+\n         <test>\n             <param name="reference_genome|genome_type_select" value="history"/>\n             <param name="reference_genome|genome" value="merlin.fa"/>\n@@ -739,6 +758,7 @@\n                 </assert_contents>\n             </output>\n         </test>\n+\n         <!-- TODO add a synteny test -->\n         <!-- TODO add a bam and a cram test -->\n         <!-- TODO add an hic test -->\n'
b
diff -r 8f02a84ee278 -r cb4b32ca9968 macros.xml
--- a/macros.xml Wed Feb 21 02:57:30 2024 +0000
+++ b/macros.xml Fri Feb 23 07:15:42 2024 +0000
[
@@ -140,6 +140,8 @@
 
     <xml name="general_options">
         <section name="jbgen" title="General JBrowse Options [Advanced]" expanded="false">
+            <param label="Create a zip archive for downloading rather than viewing " name="zipOut" help="Default is to make an interactive browser appear when the 'eye' icon is activated"
+            type="boolean" checked="false" truevalue="true" falsevalue="false" />
             <param label="Subset to display to new users" type="text" name="defaultLocation" value="" help="Initial subset to be shown for users who have never visited the browser before. Example: 'ctgA:1234..5678'"/>
             <param label="Session name" type="text" name="session_name" value="New session" help="Displayed at the top of the window"/>
             <param label="Enable analytics" help="Will send usage data to Google Analytics, see https://github.com/GMOD/jbrowse-components/issues/1166" name="enableAnalytics" type="boolean" checked="false" truevalue="true" falsevalue="false" />
@@ -502,7 +504,6 @@
         </sanitizer>
     </xml>
 
-
     <xml name="input_conditional" token_label="Track Data" token_format="data">
         <param label="@LABEL@" format="@FORMAT@" name="annotation" type="data" multiple="False"/>
     </xml>