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

Changeset 89:408781c080fc (2024-04-17)
Previous changeset 88:efd1d41f11b4 (2024-04-14) Next changeset 90:51980e0dafd2 (2024-04-17)
Commit message:
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 03400b3f71140ce62dba0db266a1f7b94b6c1a11
modified:
jbrowse2.py
jbrowse2.xml
macros.xml
test-data/jbrowse2_result02.zip
b
diff -r efd1d41f11b4 -r 408781c080fc jbrowse2.py
--- a/jbrowse2.py Sun Apr 14 03:49:10 2024 +0000
+++ b/jbrowse2.py Wed Apr 17 22:18:47 2024 +0000
[
b'@@ -21,7 +21,8 @@\n \n JB2VER = "v2.10.3"\n # version pinned if cloning - but not cloning now\n-\n+logCommands = True\n+# useful for seeing what\'s being written but not for production setups\n TODAY = datetime.datetime.now().strftime("%Y-%m-%d")\n SELF_LOCATION = os.path.dirname(os.path.realpath(__file__))\n GALAXY_INFRASTRUCTURE_URL = None\n@@ -427,14 +428,19 @@\n \n     def subprocess_check_call(self, command, output=None, cwd=True):\n         if output:\n-            log.debug("cd %s && %s >  %s", self.get_cwd(cwd), " ".join(command), output)\n+            if logCommands:\n+                log.debug(\n+                    "cd %s && %s >  %s", self.get_cwd(cwd), " ".join(command), output\n+                )\n             subprocess.check_call(command, cwd=self.get_cwd(cwd), stdout=output)\n         else:\n-            log.debug("cd %s && %s", self.get_cwd(cwd), " ".join(command))\n+            if logCommands:\n+                log.debug("cd %s && %s", self.get_cwd(cwd), " ".join(command))\n             subprocess.check_call(command, cwd=self.get_cwd(cwd))\n \n     def subprocess_popen(self, command, cwd=True):\n-        log.debug(command)\n+        if logCommands:\n+            log.debug(command)\n         p = subprocess.Popen(\n             command,\n             cwd=self.get_cwd(cwd),\n@@ -452,7 +458,8 @@\n             raise RuntimeError("Command failed with exit code %s" % (retcode))\n \n     def subprocess_check_output(self, command):\n-        log.debug(" ".join(command))\n+        if logCommands:\n+            log.debug(" ".join(command))\n         return subprocess.check_output(command, cwd=self.outdir)\n \n     def symlink_or_copy(self, src, dest):\n@@ -491,14 +498,14 @@\n                 nrow = len(fl)\n             except Exception:\n                 nrow = 0\n-        logging.debug("### getNrow returning %d" % nrow)\n+        logging.debug("### getNrow %s returning %d" % (url, nrow))\n         return nrow\n \n     def process_genomes(self, genomes):\n         assembly = []\n         assmeta = []\n         useuri = False\n-        genome_names = []\n+        primaryGenome = None\n         for i, genome_node in enumerate(genomes):\n             this_genome = {}\n             if genome_node["useuri"] == "yes":\n@@ -509,17 +516,18 @@\n             if len(genome_name.split()) > 1:\n                 genome_name = genome_name.split()[0]\n                 # spaces and cruft break scripts when substituted\n-            if genome_name not in genome_names:\n-                # pafs with shared references\n+            if not primaryGenome:\n+                primaryGenome = genome_name\n+            if genome_name not in self.genome_names:\n+                self.genome_names.append(genome_name)\n                 fapath = genome_node["path"]\n                 if not useuri:\n                     fapath = os.path.realpath(fapath)\n                 assem, first_contig = self.make_assembly(fapath, genome_name, useuri)\n                 assembly.append(assem)\n                 self.ass_first_contigs.append(first_contig)\n-                if len(genome_names) == 0:\n+                if genome_name == primaryGenome:  # first one\n                     this_genome["genome_name"] = genome_name  # first one for all tracks\n-                    genome_names.append(genome_name)\n                     this_genome["genome_sequence_adapter"] = assem["sequence"][\n                         "adapter"\n                     ]\n@@ -551,10 +559,9 @@\n                             )\n                 assmeta.append(this_genome)\n         self.assemblies += assembly\n-        self.assmeta[genome_names[0]] = assmeta\n-        self.tracksToAdd[genome_names[0]] = []\n-        self.genome_names += genome_names\n-        return this_genome["genome_name"]\n+        self.assmeta[primaryGenome] = assmeta\n+        self.tracksToAdd[primaryGenome] = []\n+        return primaryGenome\n \n     def make_assembly(self, fapath, gname, useuri):\n         """added code to grab the first contig name and length for broken default session from Anthony and Helena\'s c'..b'                                    os.path.realpath(x.attrib["path"]),\n                                     x.attrib["ext"],\n                                     x.attrib["useuri"],\n-                                    x.attrib["label"],\n+                                    track_conf["label"],\n                                     metadata,\n                                 )\n                             track_conf["trackfiles"].append(tfa)\n@@ -1714,14 +1717,13 @@\n             track_conf["format"] = track.attrib["format"]\n             track_conf["conf"] = etree_to_dict(track.find("options"))\n             keys = jc.process_annotations(track_conf)\n-\n             if keys:\n                 for key in keys:\n                     vis = track.attrib.get("visibility", "default_off")\n                     if not vis:\n                         vis = "default_off"\n-                    default_session_data[assref_name]["visibility"][vis].append(key)\n-                    trakdat = jc.tracksToAdd[assref_name]\n+                    default_session_data[primaryGenome]["visibility"][vis].append(key)\n+                    trakdat = jc.tracksToAdd[primaryGenome]\n                     stile = {}\n                     for trak in trakdat:\n                         if trak["trackId"] == key:\n@@ -1732,21 +1734,20 @@\n                             for item in track.find("options/style")\n                         }\n                         stile.update(supdate)\n-                    default_session_data[assref_name]["style"][key] = stile\n-                    logging.debug("@@@ for %s got style=%s" % (key, stile))\n+                    default_session_data[primaryGenome]["style"][key] = stile\n                     if track.find("options/style_labels"):\n-                        default_session_data[assref_name]["style_labels"][key] = {\n+                        default_session_data[primaryGenome]["style_labels"][key] = {\n                             item.tag: parse_style_conf(item)\n                             for item in track.find("options/style_labels")\n                         }\n-                default_session_data[assref_name]["tracks"].append(key)\n+                    default_session_data[primaryGenome]["tracks"].append(key)\n     default_session_data["defaultLocation"] = root.find(\n         "metadata/general/defaultLocation"\n     ).text\n     default_session_data["session_name"] = root.find(\n         "metadata/general/session_name"\n     ).text\n-    logging.debug("default_session=%s" % (default_session_data))\n+    logging.debug("default_session=%s" % (json.dumps(default_session_data, indent=2)))\n     jc.zipOut = root.find("metadata/general/zipOut").text == "true"\n     general_data = {\n         "analytics": root.find("metadata/general/analytics").text,\n@@ -1759,12 +1760,28 @@\n     jc.add_general_configuration(general_data)\n     trackconf = jc.config_json.get("tracks", [])\n     for gnome in jc.genome_names:\n-        trackconf += jc.tracksToAdd[gnome]\n+        gtracks = jc.tracksToAdd[gnome]\n+        if len(gtracks) > 0:\n+            logging.debug(\n+                "for genome %s adding gtracks %s"\n+                % (gnome, json.dumps(gtracks, indent=2))\n+            )\n+            trackconf += gtracks\n     jc.config_json["tracks"] = trackconf\n     assconf = jc.config_json.get("assemblies", [])\n     assconf += jc.assemblies\n     jc.config_json["assemblies"] = assconf\n-    logging.debug("assemblies=%s, gnames=%s" % (assconf, jc.genome_names))\n+    logging.debug(\n+        "assmeta=%s, first_contigs=%s, assemblies=%s, gnames=%s, trackidlist=%s, tracks=%s"\n+        % (\n+            jc.assmeta,\n+            jc.ass_first_contigs,\n+            json.dumps(assconf, indent=2),\n+            jc.genome_names,\n+            jc.trackIdlist,\n+            json.dumps(trackconf, indent=2),\n+        )\n+    )\n     jc.write_config()\n     jc.add_default_session(default_session_data)\n     # note that this can be left in the config.json but has NO EFFECT if add_defsess_to_index is called.\n'
b
diff -r efd1d41f11b4 -r 408781c080fc jbrowse2.xml
--- a/jbrowse2.xml Sun Apr 14 03:49:10 2024 +0000
+++ b/jbrowse2.xml Wed Apr 17 22:18:47 2024 +0000
b
@@ -263,25 +263,15 @@
                                 #if $track.data_format.pafuseuri.insource == "history":
                                 <genome>
                                     #for $anno in $track.data_format.pafuseuri.annotation:
-                                        ${anno},
+                                        ${anno}:${anno.name},
                                     #end for
                                 </genome>
-                                <genome_label>
-                                    #for $anno in $track.data_format.pafuseuri.annotation:
-                                            ${anno.name},
-                                    #end for
-                                </genome_label>
                                 #else:
                                 <genome>
                                     #for $refgenome in $track.data_format.pafuseuri.refuri:
-                                        $refgenome.annotation,
+                                        ${refgenome.annotation}:${refgenome.annoname},
                                     #end for
                                 </genome>
-                                <genome_label>
-                                    #for $refgenome in $track.data_format.pafuseuri.refuri:
-                                        ${refgenome.annoname},
-                                    #end for
-                                </genome_label>
                                 #end if
                             </paf>
                         #else if str($track.data_format.data_format_select) == "hic":
@@ -477,7 +467,7 @@
         <param type="hidden" name="uglyTestingHack" value="" />
     </inputs>
     <outputs>
-        <data format="html" name="output" label="JBrowse2">
+        <data format="html" name="output" label="JBrowse2: ${jbgen.session_name}">
             <change_format>
                 <when input="zipOut" value="true" format="zip" />
             </change_format>
@@ -643,6 +633,7 @@
             </repeat>
             <section name="jbgen">
                 <param name="zipOut" value="true" />
+                <param name="session_name" value="New test session"/>
             </section>
             <output name="output" file="jbrowse2_result02.zip" ftype="zip" compare="sim_size">
                 <assert_contents>
@@ -656,25 +647,24 @@
                     <has_archive_member path="galaxy.xml">
                         <is_valid_xml />
                         <xml_element path="./metadata/general/session_name" n="1">
-                            <has_text_matching expression="New session"/>
+                            <has_text_matching expression="New test session"/>
                             <not_has_text text="Newton"/>
                         </xml_element>
                     </has_archive_member>
-                    <has_archive_member path="merlin.gff3_0.gff3.gz"/>
-                    <has_archive_member path="merlin.bw_1.bigwig"/>
-                    <has_archive_member path="test-6.bed_2.bed.gz"/>
-                    <has_archive_member path="merlin.vcf_3.vcf.tbi"/>
-                    <has_archive_member path="merlin.cram_4.cram"/>
-                    <has_archive_member path="merlin-sample.bam_5.bam"/>
-                    <has_archive_member path="merlinlastz.maf_6.maf.sorted.bed.gz.tbi"/>
-                    <has_archive_member path="merlin.blastxml_7.blastxml.gz"/>
-                    <has_archive_member path="dm3test.cool_9.cool.hic"/>
-                    <has_archive_member path="peach-grape-map.paf_10.paf"/>
+                    <has_archive_member path="merlin.gff3_0.gz"/>
+                    <has_archive_member path="merlin.bw_1"/>
+                    <has_archive_member path="test-6.bed_2.gz"/>
+                    <has_archive_member path="merlin.vcf_3.tbi"/>
+                    <has_archive_member path="merlin.cram_4"/>
+                    <has_archive_member path="merlin-sample.bam_5"/>
+                    <has_archive_member path="merlinlastz.maf_6.sorted.bed.gz.tbi"/>
+                    <has_archive_member path="merlin.blastxml_7.gz"/>
+                    <has_archive_member path="dm3test.cool_9.hic"/>
+                    <has_archive_member path="peach-grape-map.paf_10"/>
                     <has_archive_member path="Merlin.fa.gz.fai"/>
                     <has_archive_member path="config.json">
                         <has_json_property_with_text property="name" text="Merlin" />
                     </has_archive_member>
-
                 </assert_contents>
             </output>
         </test>
b
diff -r efd1d41f11b4 -r 408781c080fc macros.xml
--- a/macros.xml Sun Apr 14 03:49:10 2024 +0000
+++ b/macros.xml Wed Apr 17 22:18:47 2024 +0000
[
@@ -28,8 +28,8 @@
     <token name="@WRAPPER_VERSION@">galaxy2</token>
     <token name="@ATTRIBUTION@"><![CDATA[
 **Attribution**
-This Galaxy tool relies on the JBrowse2, maintained by the GMOD Community. The Galaxy wrapper is maintained by Ross Lazarus
-until the IUC complete their own.
+This Galaxy tool relies on the JBrowse2, maintained by the GMOD Community. The Galaxy wrapper is 
+maintained by Ross Lazarus and Bjoern Gruening until the IUC complete their own.
 ]]>
     </token>
     <xml name="genome_selector"
@@ -157,7 +157,7 @@
             <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="Session name" type="text" name="session_name" value="New JB2 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" />
 
             <param name="primary_color" type="color" label="Primary color" value="#0D233F">
b
diff -r efd1d41f11b4 -r 408781c080fc test-data/jbrowse2_result02.zip
b
Binary file test-data/jbrowse2_result02.zip has changed