diff jbrowse2.py @ 110:c017111e976a draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 9de1453a009c254ab11b16ae8a56cb5c22b131bf-dirty
author fubar
date Sat, 29 Jun 2024 09:10:04 +0000
parents 27e9ddaaf325
children 56f9a6e0fe80
line wrap: on
line diff
--- a/jbrowse2.py	Sat Jun 29 07:22:18 2024 +0000
+++ b/jbrowse2.py	Sat Jun 29 09:10:04 2024 +0000
@@ -1363,10 +1363,24 @@
                 tId = track_conf["trackId"]
                 if tId in default_data[gnome]["visibility"]["default_on"]:
                     track_types[tId] = track_conf["type"]
-                    display = {"type": "linearBasicDisplay"}
+                    style_data = default_data[gnome]["style"].get(tId, {})
+                    if not style_data:
+                        logging.debug(
+                            "No style data for %s in available default data %s"
+                            % (tId, default_data)
+                        )
+                    else:
+                        logging.debug(
+                            "style data for %s = %s"
+                            % (tId, style_data)
+                        )
+                    if style_data.get('type',None) == None:
+                        style_data["type"] = "LinearBasicDisplay"
+                    if "displays" in track_conf:
+                        disp = track_conf["displays"][0]["type"]
+                        style_data["type"] = disp
                     if track_conf.get("displays", None):
-                        display["type"] = track_conf["displays"][0]["type"]
-                        display["configuration"] = track_conf["displays"][0]["displayId"]
+                        style_data["configuration"] = track_conf["displays"][0]["displayId"]
                     else:
                         logging.debug("no display in track_conf for %s" % tId)
                     if track_conf.get("style_labels", None):
@@ -1377,7 +1391,7 @@
                         {
                             "type": track_types[tId],
                             "configuration": tId,
-                            "displays": [display],
+                            "displays": [style_data],
                         }
                     )
             first = [x for x in self.ass_first_contigs if x[0] == gnome]
@@ -1395,7 +1409,7 @@
                 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
+                    # allow commas like 100,000 but ignore as integer 
                     if loc_match:
                         refName = loc_match.group(1)
                         drdict["refName"] = refName
@@ -1701,6 +1715,17 @@
                     if not vis:
                         vis = "default_off"
                     default_session_data[primaryGenome]["visibility"][vis].append(key)
+                    trakdat = jc.tracksToAdd[primaryGenome]
+                    stile = {}
+                    for trak in trakdat:
+                        if trak["trackId"] == key:
+                            stile = trak.get("style", {})
+                    if track.find("options/style"):
+                        for item in track.find("options/style"):
+                            if item.text:
+                                stile[item.tag] = parse_style_conf(item)
+                    logging.debug("stile=%s" % stile)
+                    default_session_data[primaryGenome]["style"][key] = stile
                     default_session_data[primaryGenome]["tracks"].append(key)
     default_session_data["defaultLocation"] = root.find(
         "metadata/general/defaultLocation"