comparison jbrowse2.py @ 101:e4ba5f1da6ef draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit a1537aea75fc902d0e38c0b7c698830a939648b1-dirty
author fubar
date Sat, 22 Jun 2024 03:52:09 +0000
parents 990291e918c7
children 099370690407
comparison
equal deleted inserted replaced
100:666c07b60cd2 101:e4ba5f1da6ef
401 return metadata 401 return metadata
402 402
403 403
404 class JbrowseConnector(object): 404 class JbrowseConnector(object):
405 def __init__(self, outdir, jbrowse2path): 405 def __init__(self, outdir, jbrowse2path):
406 self.bpPerPx = 50
406 self.trackCounter = 0 # to avoid name clashes 407 self.trackCounter = 0 # to avoid name clashes
407 self.assemblies = [] # these require more than a few line diff. 408 self.assemblies = [] # these require more than a few line diff.
408 self.assmeta = {} 409 self.assmeta = {}
409 self.ass_first_contigs = ( 410 self.ass_first_contigs = (
410 [] 411 []
1317 default session settings are hard and fragile. 1318 default session settings are hard and fragile.
1318 .add_default_view() and other configuration code adapted from 1319 .add_default_view() and other configuration code adapted from
1319 https://github.com/abretaud/tools-iuc/blob/jbrowse2/tools/jbrowse2/jbrowse2.py 1320 https://github.com/abretaud/tools-iuc/blob/jbrowse2/tools/jbrowse2/jbrowse2.py
1320 """ 1321 """
1321 # TODO using the default session for now, but check out session specs in the future https://github.com/GMOD/jbrowse-components/issues/2708 1322 # TODO using the default session for now, but check out session specs in the future https://github.com/GMOD/jbrowse-components/issues/2708
1322 bpPerPx = 50 # this is tricky since browser window width is unknown - this seems a compromise that sort of works.... 1323 bpPerPx = self.bpPerPx # Browser window width is unknown and apparently cannot be figured out in JB2 code so could be 200-2000+ pixels.
1323 track_types = {} 1324 track_types = {}
1324 with open(self.config_json_file, "r") as config_file: 1325 with open(self.config_json_file, "r") as config_file:
1325 config_json = json.load(config_file) 1326 config_json = json.load(config_file)
1326 if self.config_json: 1327 if self.config_json:
1327 config_json.update(self.config_json) 1328 config_json.update(self.config_json)
1667 ) 1668 )
1668 1669
1669 track_conf["category"] = track.attrib["cat"] 1670 track_conf["category"] = track.attrib["cat"]
1670 track_conf["format"] = track.attrib["format"] 1671 track_conf["format"] = track.attrib["format"]
1671 track_conf["conf"] = etree_to_dict(track.find("options")) 1672 track_conf["conf"] = etree_to_dict(track.find("options"))
1673 logging
1672 keys = jc.process_annotations(track_conf) 1674 keys = jc.process_annotations(track_conf)
1673 if keys: 1675 if keys:
1674 for key in keys: 1676 for key in keys:
1675 vis = track.attrib.get("visibility", "default_off") 1677 vis = track.attrib.get("visibility", "default_off")
1676 if not vis: 1678 if not vis:
1700 default_session_data["session_name"] = root.find( 1702 default_session_data["session_name"] = root.find(
1701 "metadata/general/session_name" 1703 "metadata/general/session_name"
1702 ).text 1704 ).text
1703 logging.debug("default_session=%s" % (json.dumps(default_session_data, indent=2))) 1705 logging.debug("default_session=%s" % (json.dumps(default_session_data, indent=2)))
1704 jc.zipOut = root.find("metadata/general/zipOut").text == "true" 1706 jc.zipOut = root.find("metadata/general/zipOut").text == "true"
1707 jc.bpPerPx = root.find("metadata/general/bpPerPx").text
1705 general_data = { 1708 general_data = {
1706 "analytics": root.find("metadata/general/analytics").text, 1709 "analytics": root.find("metadata/general/analytics").text,
1707 "primary_color": root.find("metadata/general/primary_color").text, 1710 "primary_color": root.find("metadata/general/primary_color").text,
1708 "secondary_color": root.find("metadata/general/secondary_color").text, 1711 "secondary_color": root.find("metadata/general/secondary_color").text,
1709 "tertiary_color": root.find("metadata/general/tertiary_color").text, 1712 "tertiary_color": root.find("metadata/general/tertiary_color").text,