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

Changeset 68:c4eb6a85db70 (2024-03-29)
Previous changeset 67:cefe9dbf1d80 (2024-03-28) Next changeset 69:7230a2422507 (2024-03-29)
Commit message:
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit bd958a96352bf8dbd1fdb5a2e994d57a42446f33-dirty
modified:
jbrowse2.py
macros.xml
added:
jb210demotracks.jpg
jb210demotracks.png
b
diff -r cefe9dbf1d80 -r c4eb6a85db70 jb210demotracks.jpg
b
Binary file jb210demotracks.jpg has changed
b
diff -r cefe9dbf1d80 -r c4eb6a85db70 jb210demotracks.png
b
Binary file jb210demotracks.png has changed
b
diff -r cefe9dbf1d80 -r c4eb6a85db70 jbrowse2.py
--- a/jbrowse2.py Thu Mar 28 12:17:24 2024 +0000
+++ b/jbrowse2.py Fri Mar 29 07:27:20 2024 +0000
[
@@ -503,10 +503,6 @@
         self.assemblies += assembly
         self.assmeta[genome_names[0]] = assmeta
         self.tracksToAdd[genome_names[0]] = []
-        if self.config_json.get("assemblies", None):
-            self.config_json["assemblies"] += assembly
-        else:
-            self.config_json["assemblies"] = assembly
         self.genome_names += genome_names
         return this_genome["genome_name"]
 
@@ -1124,6 +1120,7 @@
             % (pafOpts, pgnames, pgpaths, tId)
         )
         for i, gname in enumerate(pgnames):
+            lab = trackData["label"]
             if len(gname.split()) > 1:
                 gname = gname.split()[0]
             passnames.append(gname)
@@ -1135,16 +1132,14 @@
                 )
                 asstrack = self.make_assembly(pgpaths[i], gname, useuri)
                 self.genome_names.append(gname)
-                if self.config_json.get("assemblies", None):
-                    self.config_json["assemblies"].append(asstrack)
+                self.tracksToAdd[gname] = []
+                self.assemblies.append(asstrack)
+                if not useuri:
+                    url = "%s.paf" % (lab)
+                    dest = "%s/%s" % (self.outdir, url)
+                    self.symlink_or_copy(os.path.realpath(data), dest)
                 else:
-                    self.config_json["assemblies"] = [
-                        asstrack,
-                    ]
-        lab = trackData["label"]
-        url = "%s.paf" % (lab)
-        dest = "%s/%s" % (self.outdir, url)
-        self.symlink_or_copy(os.path.realpath(data), dest)
+                    url = data
         trackDict = {
             "type": "SyntenyTrack",
             "trackId": tId,
@@ -1159,6 +1154,10 @@
                 "assemblyNames": passnames,
             },
             "displays": [
+                {
+                    "type": "LGVSyntenyDisplay",
+                    "displayId": "%s-LGVSyntenyDisplay" % lab,
+                },
                 {"type": "DotplotDisplay", "displayId": "%s-DotplotDisplay" % lab},
                 {
                     "type": "LinearComparativeDisplay",
@@ -1168,17 +1167,13 @@
                     "type": "LinearSyntenyDisplay",
                     "displayId": "%s-LinearSyntenyDisplay" % lab,
                 },
-                {
-                    "type": "LGVSyntenyDisplay",
-                    "displayId": "%s-LGVSyntenyDisplay" % lab,
-                },
             ],
         }
         style_json = {
             "displays": [
                 {
-                    "type": "SyntenyDisplay",
-                    "displayId": "%s-SyntenyDisplay" % lab,
+                    "type": "LGVSyntenyDisplay",
+                    "displayId": "%s-LGVSyntenyDisplay" % lab,
                 }
             ]
         }
@@ -1341,43 +1336,44 @@
                         "displays": [style_data],
                     }
                 )
-            # The view for the assembly we're adding
-            view_json = {"type": "LinearGenomeView", "tracks": tracks_data}
-            refName = self.assmeta[gnome][0].get("genome_firstcontig", None)
-            drdict = {
-                "reversed": False,
-                "assemblyName": gnome,
-                "start": 1,
-                "end": 100000,
-                "refName": refName
-            }
-            ddl = default_data.get("defaultLocation", None)
-            if ddl:
-                loc_match = re.search(r"^([^:]+):([\d,]*)\.*([\d,]*)$", ddl)
-                # allow commas like 100,000 but ignore as integer
-                if loc_match:
-                    refName = loc_match.group(1)
-                    drdict["refName"] = refName
-                    if loc_match.group(2) > "":
-                        drdict["start"] = int(loc_match.group(2).replace(",", ""))
-                    if loc_match.group(3) > "":
-                        drdict["end"] = int(loc_match.group(3).replace(",", ""))
+            # paf genomes have no tracks associated so nothing for the view
+            if len(tracks_data) > 0:
+                view_json = {"type": "LinearGenomeView", "tracks": tracks_data}
+                refName = self.assmeta[gnome][0].get("genome_firstcontig", None)
+                drdict = {
+                    "reversed": False,
+                    "assemblyName": gnome,
+                    "start": 1,
+                    "end": 100000,
+                    "refName": refName
+                }
+                ddl = default_data.get("defaultLocation", None)
+                if ddl:
+                    loc_match = re.search(r"^([^:]+):([\d,]*)\.*([\d,]*)$", ddl)
+                    # allow commas like 100,000 but ignore as integer
+                    if loc_match:
+                        refName = loc_match.group(1)
+                        drdict["refName"] = refName
+                        if loc_match.group(2) > "":
+                            drdict["start"] = int(loc_match.group(2).replace(",", ""))
+                        if loc_match.group(3) > "":
+                            drdict["end"] = int(loc_match.group(3).replace(",", ""))
+                    else:
+                        logging.info(
+                            "@@@ regexp could not match contig:start..end in the supplied location %s - please fix"
+                            % ddl
+                        )
+                if drdict.get("refName", None):
+                    # TODO displayedRegions is not just zooming to the region, it hides the rest of the chromosome
+                    view_json["displayedRegions"] = [
+                        drdict,
+                    ]
+                    logging.info("@@@ defaultlocation %s for default session" % drdict)
                 else:
                     logging.info(
-                        "@@@ regexp could not match contig:start..end in the supplied location %s - please fix"
-                        % ddl
+                        "@@@ no contig name found for default session - please add one!"
                     )
-            if drdict.get("refName", None):
-                # TODO displayedRegions is not just zooming to the region, it hides the rest of the chromosome
-                view_json["displayedRegions"] = [
-                    drdict,
-                ]
-                logging.info("@@@ defaultlocation %s for default session" % drdict)
-            else:
-                logging.info(
-                    "@@@ no contig name found for default session - please add one!"
-                )
-            session_views.append(view_json)
+                session_views.append(view_json)
         session_name = default_data.get("session_name", "New session")
         for key, value in mapped_chars.items():
             session_name = session_name.replace(value, key)
@@ -1611,9 +1607,13 @@
     }
     jc.add_general_configuration(general_data)
     trackconf = jc.config_json.get("tracks", [])
+    logging.warn("genome_names=%s" % jc.genome_names)
     for gnome in jc.genome_names:
         trackconf += jc.tracksToAdd[gnome]
     jc.config_json["tracks"] = trackconf
+    assconf = jc.config_json.get("assemblies", [])
+    assconf += jc.assemblies
+    jc.config_json["assemblies"] = assconf
     jc.write_config()
     jc.add_default_session(default_session_data)
     # jc.text_index() not sure what broke here.
b
diff -r cefe9dbf1d80 -r c4eb6a85db70 macros.xml
--- a/macros.xml Thu Mar 28 12:17:24 2024 +0000
+++ b/macros.xml Fri Mar 29 07:27:20 2024 +0000
b
@@ -558,10 +558,10 @@
                 <when value="history">
                     <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" >
+                       <param label="Short name for track display" name="annoname" type="text" help="No spaces allowed here">
                              <sanitizer invalid_char="_">
                                 <valid initial="string.printable" >
-                                    <remove value="'" />
+                                    <remove value=" " />
                                 </valid>
                               </sanitizer>
                         </param>