Previous changeset 79:14ecbe46ae9f (2024-04-01) Next changeset 81:e9bcbed05108 (2024-04-03) |
Commit message:
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f |
modified:
jbrowse2.py macros.xml |
b |
diff -r 14ecbe46ae9f -r dff27c9f6d72 jbrowse2.py --- a/jbrowse2.py Mon Apr 01 09:36:07 2024 +0000 +++ b/jbrowse2.py Wed Apr 03 01:00:21 2024 +0000 |
[ |
b'@@ -20,7 +20,7 @@\n log = logging.getLogger("jbrowse")\n \n JB2VER = "v2.10.3"\n-# version pinned for cloning\n+# version pinned if cloning - but not cloning now\n \n TODAY = datetime.datetime.now().strftime("%Y-%m-%d")\n SELF_LOCATION = os.path.dirname(os.path.realpath(__file__))\n@@ -401,6 +401,7 @@\n \n class JbrowseConnector(object):\n def __init__(self, outdir, jbrowse2path):\n+ self.trackCounter = 0 # to avoid name clashes\n self.assemblies = [] # these require more than a few line diff.\n self.assmeta = {}\n self.ass_first_contigs = (\n@@ -481,21 +482,22 @@\n }\n return wstyle\n \n- def urllib_get_2018():\n- # Using a protected member like this is not any more fragile\n- # than extending the class and using it. I would use it.\n- url = "https://localhost:6667/my-endpoint"\n- ssl._create_default_https_context = ssl._create_unverified_context\n- with urllib.request.urlopen(url=url) as f:\n- print(f.read().decode("utf-8"))\n-\n- def urllib_get_2022():\n- # Finally! Able to use the publice API. Happy happy!\n- url = "https://localhost:6667/my-endpoint"\n- scontext = ssl.SSLContext(ssl.PROTOCOL_TLS)\n- scontext.verify_mode = ssl.VerifyMode.CERT_NONE\n- with urllib.request.urlopen(url=url, context=scontext) as f:\n- print(f.read().decode("utf-8"))\n+ def getNrow(self, url):\n+ useuri = url.startswith("https://") or url.startswith("http://")\n+ if not useuri:\n+ fl = open(url, "r").readlines()\n+ nrow = len(fl)\n+ else:\n+ try:\n+ scontext = ssl.SSLContext(ssl.PROTOCOL_TLS)\n+ scontext.verify_mode = ssl.VerifyMode.CERT_NONE\n+ with urllib.request.urlopen(url, context=scontext) as f:\n+ fl = f.readlines()\n+ nrow = len(fl)\n+ except Exception:\n+ nrow = 0\n+ logging.debug("### getNrow returning %d" % nrow)\n+ return nrow\n \n def process_genomes(self, genomes):\n assembly = []\n@@ -507,6 +509,8 @@\n if genome_node["useuri"] == "yes":\n useuri = True\n genome_name = genome_node["label"].strip()\n+ if len(genome_name) == 0:\n+ genome_name = os.path.splitext(os.path.basename(genome_node["path"]))[0]\n if len(genome_name.split()) > 1:\n genome_name = genome_name.split()[0]\n # spaces and cruft break scripts when substituted\n@@ -684,7 +688,7 @@\n if useuri:\n uri = data\n else:\n- uri = "%s.hic" % trackData["label"]\n+ uri = tId\n # slashes in names cause path trouble\n dest = os.path.join(self.outdir, uri)\n cmd = ["cp", data, dest]\n@@ -720,7 +724,7 @@\n ]\n }\n categ = trackData["category"]\n- fname = "%s" % tId\n+ fname = tId\n dest = "%s/%s" % (self.outdir, fname)\n gname = trackData["assemblyNames"]\n \n@@ -811,59 +815,20 @@\n # Replace original gff3 file\n shutil.copy(gff3_rebased.name, gff3)\n os.unlink(gff3_rebased.name)\n- url = "%s.gff3.gz" % trackData["label"]\n- dest = "%s/%s" % (self.outdir, url)\n- self._sort_gff(gff3, dest)\n- tId = trackData["label"]\n- categ = trackData["category"]\n- trackDict = {\n- "type": "FeatureTrack",\n- "trackId": tId,\n- "name": trackData["name"],\n- "assemblyNames": [trackData["assemblyNames"]],\n- "category": [\n- categ,\n- ],\n- "adapter": {\n- "type": "Gff3TabixAdapter",\n- "gffGzLocation": {\n- "uri": url,\n- },\n- "index": {\n- "location": {\n- "uri": url + ".tbi",\n- }\n- },\n- '..b'\n style_data = {"type": "LinearBasicDisplay"}\n- if "displays" in track_conf:\n- disp = track_conf["displays"][0]["type"]\n- style_data["type"] = disp\n+ if "displays" in track_conf:\n+ disp = track_conf["displays"][0]["type"]\n+ style_data["type"] = disp\n if track_conf.get("style_labels", None):\n # TODO fix this: it should probably go in a renderer block (SvgFeatureRenderer) but still does not work\n # TODO move this to per track displays?\n@@ -1418,7 +1397,6 @@\n [gnome, refName, end] = first[0]\n start = 0\n end = int(end)\n- refName = self.assmeta[gnome][0].get("genome_firstcontig", None)\n drdict = {\n "refName": refName,\n "start": start,\n@@ -1474,13 +1452,20 @@\n \n def add_defsess_to_index(self, data):\n """\n- This was included on request of the new codeowner from Anthony\'s IUC PR.\n- Now fixed to deal with each assembly and tracks separately.\n- Originally used only the first assembly, putting all tracks there and\n- generally falling apart when tested with 2 or more. Seems ironic that\n- this vital feature was never tested given the rejection of my original IUC PR\n- because it was not there. And no, reviewer, I do not want this important piece of history\n- removed. I prefer that it remain here since it has caused me considerable discomfort.\n+ Included on request of the new codeowner, from Anthony\'s IUC PR.\n+ Had to be fixed to keep each assembly with the associated tracks for a default view.\n+ Originally used only the first assembly, putting all tracks there and so breaking some\n+ when tested with 2 or more. Seems ironic that this vital feature could not have ever been tested\n+ given that my declining to add it was the basis for a reviewer\'s rejection of my original IUC PR.\n+ A simple 2 line diff apparently.\n+\n+ The technical problem is that this index.html hack breaks the promise of all the form fields\n+ for track controls such as visibility default that were working mostly. They need to be removed from the form by whoever\n+ thought this method was a good solution to the JB2 bug breaking config.json style default\n+ view coordinates.\n+\n+ And no, dear reviewer of this code, please leave this piece of history.\n+ It is true and I prefer that it remain here to document my considerable discomfort at this unfair treatment.\n \n ----------------------------------------------------------\n Add some default session settings: set some assemblies/tracks on/off\n@@ -1626,7 +1611,6 @@\n jc = JbrowseConnector(outdir=args.outdir, jbrowse2path=args.jbrowse2path)\n \n default_session_data = {}\n-\n for ass in root.findall("assembly"):\n genomes = [\n {\n@@ -1666,7 +1650,6 @@\n if trackfiles:\n for x in track.findall("files/trackFile"):\n track_conf["label"] = x.attrib["label"]\n- trackkey = track_conf["label"]\n track_conf["useuri"] = x.attrib["useuri"]\n if is_multi_bigwig:\n multi_bigwig_paths.append(\n@@ -1766,7 +1749,7 @@\n jc.config_json["assemblies"] = assconf\n logging.debug("assemblies=%s, gnames=%s" % (assconf, jc.genome_names))\n jc.write_config()\n- # jc.add_default_session(default_session_data)\n+ jc.add_default_session(default_session_data)\n # note that this can be left in the config.json but has NO EFFECT if add_defsess_to_index is called.\n- jc.add_defsess_to_index(default_session_data)\n+ # jc.add_defsess_to_index(default_session_data)\n # jc.text_index() not sure what broke here.\n' |
b |
diff -r 14ecbe46ae9f -r dff27c9f6d72 macros.xml --- a/macros.xml Mon Apr 01 09:36:07 2024 +0000 +++ b/macros.xml Wed Apr 03 01:00:21 2024 +0000 |
b |
@@ -557,7 +557,8 @@ <when value="history"> <repeat name="refgenomes" title="PAF reference comparison genome used to make the PAF" min="1"> <param label="@LABEL@" format="@FORMAT@" name="annotation" multiple="True" optional="true" type="data" /> - <param label="Short name for track display" name="annoname" type="text" help="No spaces allowed here"> + <param label="Please provide a short name for track display" name="annoname" type="text" + help="Short names take less track space. No spaces allowed here"> <sanitizer invalid_char="_"> <valid initial="string.printable" > <remove value=" " /> |