Mercurial > repos > fubar > jbrowse2
comparison jbrowse2.py @ 71:e26a8a6d2d2e draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cf208cecf0140ff43d145a44713ab7108057fb8b
author | fubar |
---|---|
date | Sat, 30 Mar 2024 07:15:04 +0000 |
parents | 5f0ee87daef4 |
children | 2bdb748df098 |
comparison
equal
deleted
inserted
replaced
70:5f0ee87daef4 | 71:e26a8a6d2d2e |
---|---|
376 def __init__(self, outdir, jbrowse2path): | 376 def __init__(self, outdir, jbrowse2path): |
377 self.assemblies = [] # these require more than a few line diff. | 377 self.assemblies = [] # these require more than a few line diff. |
378 self.assmeta = {} | 378 self.assmeta = {} |
379 self.giURL = GALAXY_INFRASTRUCTURE_URL | 379 self.giURL = GALAXY_INFRASTRUCTURE_URL |
380 self.outdir = outdir | 380 self.outdir = outdir |
381 self.genome_firstcontig = None | |
382 self.jbrowse2path = jbrowse2path | 381 self.jbrowse2path = jbrowse2path |
383 os.makedirs(self.outdir, exist_ok=True) | 382 os.makedirs(self.outdir, exist_ok=True) |
384 self.genome_names = [] | 383 self.genome_names = [] |
385 self.trackIdlist = [] | 384 self.trackIdlist = [] |
386 self.tracksToAdd = {} | 385 self.tracksToAdd = {} |
1123 lab = trackData["label"] | 1122 lab = trackData["label"] |
1124 if len(gname.split()) > 1: | 1123 if len(gname.split()) > 1: |
1125 gname = gname.split()[0] | 1124 gname = gname.split()[0] |
1126 passnames.append(gname) | 1125 passnames.append(gname) |
1127 # trouble from spacey names in command lines avoidance | 1126 # trouble from spacey names in command lines avoidance |
1127 useuri = pgpaths[i].startswith("http://") or pgpaths[i].startswith( | |
1128 "https://" | |
1129 ) | |
1130 if not useuri: | |
1131 url = "%s.paf" % (lab) | |
1132 else: | |
1133 url = data | |
1128 if gname not in self.genome_names: | 1134 if gname not in self.genome_names: |
1129 # ignore if already there - eg for duplicates among pafs. | 1135 # ignore if already there - eg for duplicates among pafs. |
1130 useuri = pgpaths[i].startswith("http://") or pgpaths[i].startswith( | |
1131 "https://" | |
1132 ) | |
1133 asstrack = self.make_assembly(pgpaths[i], gname, useuri) | 1136 asstrack = self.make_assembly(pgpaths[i], gname, useuri) |
1134 self.genome_names.append(gname) | 1137 self.genome_names.append(gname) |
1135 self.tracksToAdd[gname] = [] | 1138 self.tracksToAdd[gname] = [] |
1136 self.assemblies.append(asstrack) | 1139 self.assemblies.append(asstrack) |
1137 if not useuri: | 1140 if not useuri: |
1138 url = "%s.paf" % (lab) | |
1139 dest = "%s/%s" % (self.outdir, url) | 1141 dest = "%s/%s" % (self.outdir, url) |
1140 self.symlink_or_copy(os.path.realpath(data), dest) | 1142 self.symlink_or_copy(os.path.realpath(data), dest) |
1141 else: | |
1142 url = data | |
1143 trackDict = { | 1143 trackDict = { |
1144 "type": "SyntenyTrack", | 1144 "type": "SyntenyTrack", |
1145 "trackId": tId, | 1145 "trackId": tId, |
1146 "assemblyNames": passnames, | 1146 "assemblyNames": passnames, |
1147 "category": [ | 1147 "category": [ |
1580 item.tag: parse_style_conf(item) | 1580 item.tag: parse_style_conf(item) |
1581 for item in track.find("options/style") | 1581 for item in track.find("options/style") |
1582 } | 1582 } |
1583 else: | 1583 else: |
1584 default_session_data["style"][key] = {} | 1584 default_session_data["style"][key] = {} |
1585 logging.warn("@@@@ no options/style found for %s" % (key)) | 1585 logging.debug("@@@@ no options/style found for %s" % (key)) |
1586 | 1586 |
1587 if track.find("options/style_labels"): | 1587 if track.find("options/style_labels"): |
1588 default_session_data["style_labels"][key] = { | 1588 default_session_data["style_labels"][key] = { |
1589 item.tag: parse_style_conf(item) | 1589 item.tag: parse_style_conf(item) |
1590 for item in track.find("options/style_labels") | 1590 for item in track.find("options/style_labels") |
1605 "quaternary_color": root.find("metadata/general/quaternary_color").text, | 1605 "quaternary_color": root.find("metadata/general/quaternary_color").text, |
1606 "font_size": root.find("metadata/general/font_size").text, | 1606 "font_size": root.find("metadata/general/font_size").text, |
1607 } | 1607 } |
1608 jc.add_general_configuration(general_data) | 1608 jc.add_general_configuration(general_data) |
1609 trackconf = jc.config_json.get("tracks", []) | 1609 trackconf = jc.config_json.get("tracks", []) |
1610 logging.warn("++++++++++++ genome_names=%s" % jc.genome_names) | |
1611 for gnome in jc.genome_names: | 1610 for gnome in jc.genome_names: |
1612 trackconf += jc.tracksToAdd[gnome] | 1611 trackconf += jc.tracksToAdd[gnome] |
1613 jc.config_json["tracks"] = trackconf | 1612 jc.config_json["tracks"] = trackconf |
1614 assconf = jc.config_json.get("assemblies", []) | 1613 assconf = jc.config_json.get("assemblies", []) |
1615 assconf += jc.assemblies | 1614 assconf += jc.assemblies |
1616 jc.config_json["assemblies"] = assconf | 1615 jc.config_json["assemblies"] = assconf |
1617 logging.warn("&&&assemblies=%s, gnames=%s" % (assconf, jc.genome_names)) | 1616 logging.debug("&&&assemblies=%s, gnames=%s" % (assconf, jc.genome_names)) |
1618 jc.write_config() | 1617 jc.write_config() |
1619 jc.add_default_session(default_session_data) | 1618 jc.add_default_session(default_session_data) |
1620 # jc.text_index() not sure what broke here. | 1619 # jc.text_index() not sure what broke here. |