# HG changeset patch # User fubar # Date 1711964167 0 # Node ID 14ecbe46ae9f24ad83b11182ba6f9cc4cdc4a838 # Parent 7bb6259ea52f1165bfb9987d77a81788c9f129c3 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty diff -r 7bb6259ea52f -r 14ecbe46ae9f jbrowse2.py --- a/jbrowse2.py Mon Apr 01 05:40:29 2024 +0000 +++ b/jbrowse2.py Mon Apr 01 09:36:07 2024 +0000 @@ -403,7 +403,9 @@ def __init__(self, outdir, jbrowse2path): self.assemblies = [] # these require more than a few line diff. self.assmeta = {} - self.ass_first_contigs = [] # for default session - these are read as first line of the assembly .fai + self.ass_first_contigs = ( + [] + ) # for default session - these are read as first line of the assembly .fai self.giURL = GALAXY_INFRASTRUCTURE_URL self.outdir = outdir self.jbrowse2path = jbrowse2path @@ -1402,20 +1404,27 @@ ) # paf genomes have no tracks associated so nothing for the view if len(tracks_data) > 0: - view_json = {"type": "LinearGenomeView", "tracks": tracks_data} - logging.debug("Looking for %s in self.ass_ %s" % (gnome, self.ass_first_contigs)) + view_json = { + "type": "LinearGenomeView", + "offsetPx": 0, + "minimized": False, + "tracks": tracks_data, + } + logging.debug( + "Looking for %s in self.ass_ %s" % (gnome, self.ass_first_contigs) + ) first = [x for x in self.ass_first_contigs if x[0] == gnome] if len(first) > 0: [gnome, refName, end] = first[0] - start = 1 + start = 0 end = int(end) refName = self.assmeta[gnome][0].get("genome_firstcontig", None) drdict = { + "refName": refName, + "start": start, + "end": end, "reversed": False, "assemblyName": gnome, - "start": start, - "end": end, - "refName": refName, } else: ddl = default_data.get("defaultLocation", None) @@ -1426,7 +1435,9 @@ refName = loc_match.group(1) drdict["refName"] = refName if loc_match.group(2) > "": - drdict["start"] = int(loc_match.group(2).replace(",", "")) + drdict["start"] = int( + loc_match.group(2).replace(",", "") + ) if loc_match.group(3) > "": drdict["end"] = int(loc_match.group(3).replace(",", "")) else: @@ -1463,8 +1474,15 @@ def add_defsess_to_index(self, data): """ - Broken in Anthony's PR because only ever dealt with the first assembly. + This was included on request of the new codeowner from Anthony's IUC PR. + Now fixed to deal with each assembly and tracks separately. + Originally used only the first assembly, putting all tracks there and + generally falling apart when tested with 2 or more. Seems ironic that + this vital feature was never tested given the rejection of my original IUC PR + because it was not there. And no, reviewer, I do not want this important piece of history + removed. I prefer that it remain here since it has caused me considerable discomfort. + ---------------------------------------------------------- Add some default session settings: set some assemblies/tracks on/off This allows to select a default view: @@ -1748,6 +1766,7 @@ jc.config_json["assemblies"] = assconf logging.debug("assemblies=%s, gnames=%s" % (assconf, jc.genome_names)) jc.write_config() - jc.add_default_session(default_session_data) + # jc.add_default_session(default_session_data) + # note that this can be left in the config.json but has NO EFFECT if add_defsess_to_index is called. jc.add_defsess_to_index(default_session_data) # jc.text_index() not sure what broke here.