comparison 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
comparison
equal deleted inserted replaced
109:27e9ddaaf325 110:c017111e976a
1361 tracks_data = [] 1361 tracks_data = []
1362 for track_conf in self.tracksToAdd[gnome]: 1362 for track_conf in self.tracksToAdd[gnome]:
1363 tId = track_conf["trackId"] 1363 tId = track_conf["trackId"]
1364 if tId in default_data[gnome]["visibility"]["default_on"]: 1364 if tId in default_data[gnome]["visibility"]["default_on"]:
1365 track_types[tId] = track_conf["type"] 1365 track_types[tId] = track_conf["type"]
1366 display = {"type": "linearBasicDisplay"} 1366 style_data = default_data[gnome]["style"].get(tId, {})
1367 if not style_data:
1368 logging.debug(
1369 "No style data for %s in available default data %s"
1370 % (tId, default_data)
1371 )
1372 else:
1373 logging.debug(
1374 "style data for %s = %s"
1375 % (tId, style_data)
1376 )
1377 if style_data.get('type',None) == None:
1378 style_data["type"] = "LinearBasicDisplay"
1379 if "displays" in track_conf:
1380 disp = track_conf["displays"][0]["type"]
1381 style_data["type"] = disp
1367 if track_conf.get("displays", None): 1382 if track_conf.get("displays", None):
1368 display["type"] = track_conf["displays"][0]["type"] 1383 style_data["configuration"] = track_conf["displays"][0]["displayId"]
1369 display["configuration"] = track_conf["displays"][0]["displayId"]
1370 else: 1384 else:
1371 logging.debug("no display in track_conf for %s" % tId) 1385 logging.debug("no display in track_conf for %s" % tId)
1372 if track_conf.get("style_labels", None): 1386 if track_conf.get("style_labels", None):
1373 # TODO fix this: it should probably go in a renderer block (SvgFeatureRenderer) but still does not work 1387 # TODO fix this: it should probably go in a renderer block (SvgFeatureRenderer) but still does not work
1374 # TODO move this to per track displays? 1388 # TODO move this to per track displays?
1375 style_data["labels"] = track_conf["style_labels"] 1389 style_data["labels"] = track_conf["style_labels"]
1376 tracks_data.append( 1390 tracks_data.append(
1377 { 1391 {
1378 "type": track_types[tId], 1392 "type": track_types[tId],
1379 "configuration": tId, 1393 "configuration": tId,
1380 "displays": [display], 1394 "displays": [style_data],
1381 } 1395 }
1382 ) 1396 )
1383 first = [x for x in self.ass_first_contigs if x[0] == gnome] 1397 first = [x for x in self.ass_first_contigs if x[0] == gnome]
1384 drdict = { 1398 drdict = {
1385 "reversed": False, 1399 "reversed": False,
1393 drdict["end"] = end 1407 drdict["end"] = end
1394 else: 1408 else:
1395 ddl = default_data.get("defaultLocation", None) 1409 ddl = default_data.get("defaultLocation", None)
1396 if ddl: 1410 if ddl:
1397 loc_match = re.search(r"^([^:]+):([\d,]*)\.*([\d,]*)$", ddl) 1411 loc_match = re.search(r"^([^:]+):([\d,]*)\.*([\d,]*)$", ddl)
1398 # allow commas like 100,000 but ignore as integer 1412 # allow commas like 100,000 but ignore as integer
1399 if loc_match: 1413 if loc_match:
1400 refName = loc_match.group(1) 1414 refName = loc_match.group(1)
1401 drdict["refName"] = refName 1415 drdict["refName"] = refName
1402 if loc_match.group(2) > "": 1416 if loc_match.group(2) > "":
1403 drdict["start"] = int(loc_match.group(2).replace(",", "")) 1417 drdict["start"] = int(loc_match.group(2).replace(",", ""))
1699 for key in keys: 1713 for key in keys:
1700 vis = track.attrib.get("visibility", "default_off") 1714 vis = track.attrib.get("visibility", "default_off")
1701 if not vis: 1715 if not vis:
1702 vis = "default_off" 1716 vis = "default_off"
1703 default_session_data[primaryGenome]["visibility"][vis].append(key) 1717 default_session_data[primaryGenome]["visibility"][vis].append(key)
1718 trakdat = jc.tracksToAdd[primaryGenome]
1719 stile = {}
1720 for trak in trakdat:
1721 if trak["trackId"] == key:
1722 stile = trak.get("style", {})
1723 if track.find("options/style"):
1724 for item in track.find("options/style"):
1725 if item.text:
1726 stile[item.tag] = parse_style_conf(item)
1727 logging.debug("stile=%s" % stile)
1728 default_session_data[primaryGenome]["style"][key] = stile
1704 default_session_data[primaryGenome]["tracks"].append(key) 1729 default_session_data[primaryGenome]["tracks"].append(key)
1705 default_session_data["defaultLocation"] = root.find( 1730 default_session_data["defaultLocation"] = root.find(
1706 "metadata/general/defaultLocation" 1731 "metadata/general/defaultLocation"
1707 ).text 1732 ).text
1708 default_session_data["session_name"] = root.find( 1733 default_session_data["session_name"] = root.find(