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

Changeset 60:81d535970196 (2024-03-25)
Previous changeset 59:f807e219cec3 (2024-03-22) Next changeset 61:e7a6f7a7148d (2024-03-26)
Commit message:
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 403a35e1245fa5e62f4be6116a725b9e4d9c353a
modified:
autogenJB2.py
jbrowse2.py
jbrowse2.xml
macros.xml
b
diff -r f807e219cec3 -r 81d535970196 autogenJB2.py
--- a/autogenJB2.py Fri Mar 22 22:04:08 2024 +0000
+++ b/autogenJB2.py Mon Mar 25 02:10:05 2024 +0000
[
@@ -172,8 +172,7 @@
                     for key in keys:
                         if trext in [
                             "bigwig",
-                            "gff3",
-                            "gff",
+                            "gff", "gff3",
                             "vcf",
                             "maf",
                         ]:
@@ -182,6 +181,16 @@
                             default_session_data["visibility"]["default_off"].append(
                                 key
                             )
+                        if trext in ["gff", "gff3", "bed", "vcf", "maf", "blastxml"]:
+                            ttype = "LinearBasicDisplay"
+                            if trext == "vcf":
+                                ttype = "LinearVariantDisplay"
+                            style_json = {
+                            "type": ttype,
+                            "trackShowLabels": False,
+                            "trackShowDescriptions": False
+                            }
+                            default_session_data["style"][key] = style_json
             # general_data = {
             # "analytics": root.find("metadata/general/analytics").text,
             # "primary_color": root.find("metadata/general/primary_color").text,
b
diff -r f807e219cec3 -r 81d535970196 jbrowse2.py
--- a/jbrowse2.py Fri Mar 22 22:04:08 2024 +0000
+++ b/jbrowse2.py Mon Mar 25 02:10:05 2024 +0000
[
b'@@ -1,5 +1,5 @@\n  #!/usr/bin/env python\n-# change to accumulating all configuration for config.json based on the default from the clone\n+\n import argparse\n import binascii\n import datetime\n@@ -24,8 +24,6 @@\n TODAY = datetime.datetime.now().strftime("%Y-%m-%d")\n GALAXY_INFRASTRUCTURE_URL = None\n \n-# version pinned for cloning\n-\n mapped_chars = {\n     ">": "__gt__",\n     "<": "__lt__",\n@@ -458,7 +456,7 @@\n                 genome_name = genome_name.split()[0]\n                 # spaces and cruft break scripts when substituted\n             if genome_name not in self.genome_names:\n-                # ignore dupes - can have multiple pafs with same references?\n+                # pafs with shared references\n                 fapath = genome_node["path"]\n                 if not useuri:\n                     fapath = os.path.realpath(fapath)\n@@ -467,7 +465,7 @@\n                 self.genome_names.append(genome_name)\n                 if self.genome_name is None:\n                     self.genome_name = (\n-                        genome_name  # first one for all tracks - other than paf\n+                        genome_name  # first one for all tracks\n                     )\n                     self.genome_sequence_adapter = assem["sequence"]["adapter"]\n                     self.genome_firstcontig = None\n@@ -481,11 +479,16 @@\n                             else:\n                                 self.genome_firstcontig = fl\n                     else:\n-                        fl = urllib.request.urlopen(fapath + ".fai").readline()\n+                        try:\n+                            fl = urllib.request.urlopen(fapath + ".fai").readline()\n+                        except:\n+                            fl = None\n                         if fl:  # is first row of the text fai so the first contig name\n                             self.genome_firstcontig = (\n                                 fl.decode("utf8").strip().split()[0]\n                             )\n+                        else:\n+                            self.genome_firstcontig = None\n         if self.config_json.get("assemblies", None):\n             self.config_json["assemblies"] += assemblies\n         else:\n@@ -606,6 +609,8 @@\n             gziLocation:\n             uri: \'https://s3.amazonaws.com/jbrowse.org/genomes/GRCh38/fasta/GRCh38.fa.gz.gzi\',\n         Cool will not be likely to be a good fit - see discussion at https://github.com/GMOD/jbrowse-components/issues/2438\n+\n+\n         """\n         tId = trackData["label"]\n         # can be served - if public.\n@@ -615,29 +620,25 @@\n         if useuri:\n             uri = data\n         else:\n-            uri = trackData["hic_url"]\n+            uri = "%s.hic" % trackData["label"]\n+            # slashes in names cause path trouble\n+            dest = os.path.join(self.outdir, uri)\n+            cmd = ["cp", data, dest]\n+            self.subprocess_check_call(cmd)\n         categ = trackData["category"]\n         trackDict = {\n             "type": "HicTrack",\n             "trackId": tId,\n-            "name": uri,\n+            "name":  trackData["name"],\n             "assemblyNames": [self.genome_name],\n             "category": [\n                 categ,\n             ],\n             "adapter": {\n                 "type": "HicAdapter",\n-                "hicLocation": uri,\n-            },\n-            "displays": [\n-                {\n-                    "type": "LinearHicDisplay",\n-                    "displayId": "%s-LinearHicDisplay" % tId,\n-                },\n-            ],\n+                "hicLocation": { "uri": uri }\n+            }\n         }\n-        style_json = self._prepare_track_style(trackDict)\n-        trackDict["style"] = style_json\n         self.tracksToAdd.append(trackDict)\n         self.trackIdlist.append(tId)\n \n@@ -793,14 +794,6 @@\n         os.unlink(gff3)\n \n     def add_bigwig(self, data, trackData):\n-        """ "type": "LinearWiggleDisplay",\n-        "configuration": {},\n-        "selectedRendering": "",\n-        "resolution": 1,'..b'fault data for %s" % tId)\n+                logging.warn("### No style data in default data %s for %s" % (default_data, tId))\n                 style_data = {"type": "LinearBasicDisplay"}\n             if "displays" in track_conf:\n                 disp = track_conf["displays"][0]["type"]\n@@ -1315,7 +1305,7 @@\n             )\n         # The view for the assembly we\'re adding\n         view_json = {"type": "LinearGenomeView", "tracks": tracks_data}\n-\n+        logging.warn("### view_json=%s" % view_json)\n         refName = None\n         drdict = {\n             "reversed": False,\n@@ -1408,8 +1398,10 @@\n         with open(config_path, "w") as config_file:\n             json.dump(self.config_json, config_file, indent=2)\n \n-    def clone_jbrowse(self, realclone=True):\n-        """Clone a JBrowse directory into a destination directory. This also works in Biocontainer testing now"""\n+    def clone_jbrowse(self, realclone=False):\n+        """Clone a JBrowse directory into a destination directory. This also works in Biocontainer testing now\n+        Leave as True between version updates on temporary tools - requires manual conda trigger :(\n+        """\n         dest = self.outdir\n         if realclone:\n             self.subprocess_check_call(\n@@ -1472,7 +1464,6 @@\n     )\n     jc.process_genomes()\n \n-    # .add_default_view() replace from https://github.com/abretaud/tools-iuc/blob/jbrowse2/tools/jbrowse2/jbrowse2.py\n     default_session_data = {\n         "visibility": {\n             "default_on": [],\n@@ -1500,6 +1491,7 @@\n         if trackfiles:\n             for x in track.findall("files/trackFile"):\n                 track_conf["label"] = x.attrib["label"]\n+                trackkey = track_conf["label"]\n                 track_conf["useuri"] = x.attrib["useuri"]\n                 if is_multi_bigwig:\n                     multi_bigwig_paths.append(\n@@ -1544,18 +1536,6 @@\n             )\n         track_conf["category"] = track.attrib["cat"]\n         track_conf["format"] = track.attrib["format"]\n-        if track.find("options/style"):\n-            track_conf["style"] = {\n-                item.tag: parse_style_conf(item) for item in track.find("options/style")\n-            }\n-        else:\n-            track_conf["style"] = {}\n-        if track.find("options/style_labels"):\n-            track_conf["style_labels"] = {\n-                item.tag: parse_style_conf(item)\n-                for item in track.find("options/style_labels")\n-            }\n-\n         track_conf["conf"] = etree_to_dict(track.find("options"))\n         track_conf["category"] = track.attrib["cat"]\n         track_conf["format"] = track.attrib["format"]\n@@ -1566,12 +1546,20 @@\n                 default_session_data["visibility"][\n                     track.attrib.get("visibility", "default_off")\n                 ].append(key)\n-                if track_conf.get("style", None):\n-                    default_session_data["style"][key] = track_conf["style"]\n-                if track_conf.get("style_lables", None):\n-                    default_session_data["style_labels"][key] = track_conf.get(\n-                        "style_labels", None\n-                    )\n+            if track.find("options/style"):\n+                default_session_data["style"][key] = {\n+                    item.tag: parse_style_conf(item) for item in track.find("options/style")\n+                }\n+                logging.warn("### added %s to defsess %s for %s" % (trackkey, default_session_data, key ))\n+            else:\n+                default_session_data["style"][key] = {}\n+                logging.warn("@@@@ no options/style found for %s" % (key))\n+\n+            if track.find("options/style_labels"):\n+                default_session_data["style_labels"][key] = {\n+                    item.tag: parse_style_conf(item)\n+                    for item in track.find("options/style_labels")\n+                }\n     default_session_data["defaultLocation"] = root.find(\n         "metadata/general/defaultLocation"\n     ).text\n'
b
diff -r f807e219cec3 -r 81d535970196 jbrowse2.xml
--- a/jbrowse2.xml Fri Mar 22 22:04:08 2024 +0000
+++ b/jbrowse2.xml Mon Mar 25 02:10:05 2024 +0000
[
@@ -11,12 +11,8 @@
     <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' &&
-
 export JBROWSE2_PATH=\$(dirname \$(which jbrowse))/../opt/jbrowse2  &&
-
 #if $jbgen.ucol.formcoll=="collect":
     python '$__tool_directory__/autogenJB2.py'
     #for $key in $autoCollection.keys():
@@ -139,17 +135,15 @@
         #for $tg in $track_groups:
             #for $track in $tg.data_tracks:
                 #if $track.data_format.useuri.insource == "uri":
-                    <track cat="${tg.category}" format="paf" visibility="${track.data_format.track_visibility}">
+                    <track cat="${tg.category}" format="${track.data_format.data_format_select}" visibility="${track.data_format.track_visibility}">
                         <files>
-                             <trackFile path="${ $track.data_format.useuri.insource.annouri}" ext="paf"
-                                label="${track.data_format.useuri.insource.annoname}" useuri="yes">
+                             <trackFile path="${track.data_format.useuri.annouri}" ext="${track.data_format.data_format_select}"
+                                label="${track.data_format.useuri.annoname}" useuri="yes">
                                 <metadata>
-                                <dataset id = "${track.data_format.useuri.insource.annouri}" />
+                                <dataset id = "${track.data_format.useuri.annouri}" />
                                 </metadata>
                              </trackFile>
                         </files>
-                        <options/>
-                    </track>
                 #else if $track.data_format.useuri.insource == "history":
                     #if $track.data_format.useuri.annotation:
                     <track cat="${tg.category}" format="${track.data_format.data_format_select}" visibility="${track.data_format.track_visibility}">
@@ -157,7 +151,6 @@
                         #for $dataset in $track.data_format.useuri.annotation:
                               <trackFile path="${dataset}" ext="${dataset.ext}" label="${dataset.name}" useuri="no">
                                 <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}"
@@ -193,23 +186,27 @@
                               </trackFile>
                        #end for
                     </files>
-
-                    <options>
-                        <style>
-                        #if str($track.data_format.data_format_select) in ["gff", "bed", "vcf", "maf", "blastxml"]:
-                            <type>${track.data_format.jbstyle.track_style.display}</type>
-                            #if str($track.data_format.jbstyle.track_style.display) in ["LinearBasicDisplay", "LinearVariantDisplay"]:
-                                <trackShowLabels>${track.data_format.jbstyle.track_style.show_labels}</trackShowLabels>
-                                <trackShowDescriptions>${track.data_format.jbstyle.track_style.show_descriptions}</trackShowDescriptions>
-                            #end if
+                    #end if
+                  #end if
+                  <options>
+                    <style>
+                    #if str($track.data_format.data_format_select) in ["gff", "bed", "vcf", "maf", "blastxml"]:
+                        <type>${track.data_format.jbstyle.track_style.display}</type>
+                        #if str($track.data_format.jbstyle.track_style.display) in ["LinearBasicDisplay", "LinearVariantDisplay"]:
+                            <trackShowLabels>${track.data_format.jbstyle.track_style.show_labels}</trackShowLabels>
+                            <trackShowDescriptions>${track.data_format.jbstyle.track_style.show_descriptions}</trackShowDescriptions>
                         #end if
-                        #if str($track.data_format.data_format_select) in ["bam", "cram"]:
-                            <type>LinearAlignmentsDisplay</type>
-                        #end if
-                        #if str($track.data_format.data_format_select) in ["paf"]:
-                            <type>LinearBasicDisplay</type>
-                        #end if
-                        </style>
+                    #end if
+                    #if str($track.data_format.data_format_select) in ["bam", "cram"]:
+                        <type>LinearAlignmentsDisplay</type>
+                    #end if
+                    #if str($track.data_format.data_format_select) in ["paf"]:
+                        <type>LinearBasicDisplay</type>
+                    #end if
+                    #if str($track.data_format.data_format_select) in ["hic"]:
+                        <type>LinearHicDisplay</type>
+                    #end if
+                    </style>
                     #if str($track.data_format.data_format_select) == "bam":
                         <bam>
                             #for $dataset in $track.data_format.useuri.annotation:
@@ -268,8 +265,6 @@
                     #end if
                     </options>
                   </track>
-                  #end if
-                #end if
             #end for
         #end for
     </tracks>
b
diff -r f807e219cec3 -r 81d535970196 macros.xml
--- a/macros.xml Fri Mar 22 22:04:08 2024 +0000
+++ b/macros.xml Mon Mar 25 02:10:05 2024 +0000
b
@@ -542,12 +542,12 @@
     <xml name="pafref_conditional" token_label="Track Data" token_format="data">
         <conditional name="pafuseuri">
                 <param name="insource" type="select" label="PAF reference data from a history file or an internet URI?"
-                    help="A public URI implies that all the associated tabix files are also in place. They are created for history files">
-                    <option value="history" selected="true">PAF genome reference data from a history file</option>
-                    <option value="uri">PAF genome reference data from tabix data URI - index files must be available at corresponding URI</option>
+                    help="Multiple references can be used for mashmap PAF. A URI source requires all the associated tabix index files to be in place.">
+                    <option value="history" selected="true">PAF reference comparison genome from a history file</option>
+                    <option value="uri">PAF reference comparison genome tabix .gz URI with index files at the corresponding URIs</option>
                 </param>
                 <when value="history">
-                    <repeat name="refgenomes" title="Add one or more comparison genomes used to make the PAF">
+                    <repeat name="refgenomes" title="PAF reference comparison genome used to make the PAF">
                        <param label="@LABEL@" format="@FORMAT@" name="annotation" multiple="True" optional="true" type="data" />
                        <param label="Short name for track display" name="annoname" type="text" >
                              <sanitizer invalid_char="_">
@@ -559,7 +559,7 @@
                     </repeat>
                 </when>
                 <when value="uri">
-                    <repeat name="refgenomes" title="Provide URI for a comparison genomesused to make the PAF">
+                    <repeat name="refgenomes" title="PAF reference comparison genome URI">
                        <param label="@LABEL@" name="annotation"  type="text" />
                        <param label="Short name for track display" name="annoname" type="text" >
                              <sanitizer invalid_char="_">