Previous changeset 6:79f7265f90bd (2024-01-09) Next changeset 8:9a168aa68f06 (2024-01-18) |
Commit message:
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717 |
modified:
jbrowse2.py jbrowse2.xml plants.sh readme.rst |
added:
4f27993eab7751041e8c72047be3ea53_0.bw apache2_licence.txt jb2_webserver.py |
removed:
webserver.py |
b |
diff -r 79f7265f90bd -r b04fd993b31e 4f27993eab7751041e8c72047be3ea53_0.bw --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/4f27993eab7751041e8c72047be3ea53_0.bw Wed Jan 17 07:50:52 2024 +0000 |
[ |
@@ -0,0 +1,82 @@ + +<!DOCTYPE HTML> +<html lang="en"> + <!--js-app.mako--> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + + <!-- Set meta description --> + + <meta name="description" content="Log in to Galaxy to get access to more tools and resources. Register now for a free account." /> + + <title> + Galaxy + | ToolFactoryDev + </title> + + <link rel="index" href="/"/> + + <link href="/static/dist/base.css?v=1704404015" media="screen" rel="stylesheet" type="text/css" /> + <link href="/static/style/jquery-ui/smoothness/jquery-ui.css?v=1704404015" media="screen" rel="stylesheet" type="text/css" /> + </head> + + <body scroll="no" class="full-content"> + <!-- Provide mount point for application --> + <main> + <div id="app"></div> + </main> + + + <noscript> + <div class="overlay overlay-background noscript-overlay"> + <div> + <h3 class="title">Javascript Required for Galaxy</h3> + <div> + The Galaxy analysis interface requires a browser with Javascript enabled.<br> + Please enable Javascript and refresh this page. + </div> + </div> + </div> + </noscript> + + + <script src="/static/dist/libs.bundled.js?v=1704404015" type="text/javascript"></script> +<script src="/static/dist/analysis.bundled.js?v=1704404015" type="text/javascript"></script> + + + + <script type="text/javascript"> + console.debug("Initializing javascript application:", "app"); + + // js-app.mako + var options = {"root": "/", "user": {"id": null, "total_disk_usage": 0.0, "nice_total_disk_usage": "0 bytes", "quota_percent": null}, "config": {"enable_notification_system": false, "welcome_directory": "plugins/welcome_page/new_user/static/topics/", "enable_celery_tasks": false, "admin_tool_recommendations_path": "/evol/galaxytf23.1.3/config/tool_recommendations_overwrite.yml", "version_extra": null, "tool_training_recommendations_api_url": "https://training.galaxyproject.org/training-material/api/top-tools.json", "expose_user_email": false, "simplified_workflow_run_ui_job_cache": "off", "toolbox_auto_sort": true, "is_admin_user": false, "message_box_class": "info", "show_welcome_with_login": true, "default_locale": "auto", "visualizations_visible": true, "interactivetools_enable": false, "ga_code": null, "allow_user_creation": false, "enable_account_interface": true, "nginx_upload_path": null, "quota_url": "https://galaxyproject.org/support/account-quotas/", "matomo_site_id": null, "object_store_ids_allowing_selection": [], "wiki_url": "https://galaxyproject.org/", "fixed_delegated_auth": false, "use_remote_user": null, "brand": "ToolFactoryDev", "screencasts_url": "https://www.youtube.com/c/galaxyproject", "helpsite_url": "https://help.galaxyproject.org/", "object_store_allows_id_selection": false, "enable_tool_recommendations": false, "oidc": {}, "plausible_domain": null, "simplified_workflow_run_ui": "prefer", "aws_estimate": false, "user_library_import_dir_available": false, "ftp_upload_site": null, "quota_source_labels": [], "tool_recommendation_model_path": "https://github.com/galaxyproject/galaxy-test-data/raw/master/tool_recommendation_model_v_0.2.hdf5", "enable_quotas": false, "markdown_to_pdf_available": false, "post_user_logout_href": "/root/login?is_logout_redirect=true", "enable_unique_workflow_defaults": false, "enable_oidc": false, "citations_export_message_html": "When writing up your analysis, remember to include all references that should be cited in order to completely describe your work. Also, please remember to <a href=\"https://galaxyproject.org/citing-galaxy\">cite Galaxy<\/a>.", "single_user": false, "python": [3, 10], "enable_beacon_integration": false, "logo_src": "/static/toolfactorylogo.png", "enable_tool_source_display": false, "require_login": true, "datatypes_disable_auto": false, "inactivity_box_content": "Your account has not been activated yet. Feel free to browse around and see what's available, but you won't be able to upload data or run jobs until you have verified your email address.", "mailing_join_addr": null, "topk_recommendations": 20, "terms_url": null, "logo_url": "/", "server_startttime": 1704404015, "panel_views": {"default": {"id": "default", "model_class": "type", "name": "Full Tool Panel", "description": "Galaxy's fully configured toolbox panel with all sections, tools, and configured workflows loaded.", "view_type": "default", "searchable": true}, "ontology:edam_operations": {"id": "ontology:edam_operations", "model_class": "EdamToolPanelView", "name": "EDAM Operations", "description": "Tools are grouped using annotated EDAM operation information (if available).", "view_type": "ontology", "searchable": true}, "ontology:edam_topics": {"id": "ontology:edam_topics", "model_class": "EdamToolPanelView", "name": "EDAM Topics", "description": "Tools are grouped using annotated EDAM topic information (if available).", "view_type": "ontology", "searchable": true}}, "message_box_visible": false, "cookie_domain": null, "allow_user_dataset_purge": true, "file_sources_configured": false, "overwrite_model_recommendations": false, "upload_from_form_button": "always-off", "message_box_content": null, "prefer_custos_login": false, "version_minor": "3", "support_url": "https://galaxyproject.org/support/", "registration_warning_message": "Please register only one account - we provide this service free of charge and have limited computational resources. Multi-accounts are tracked and will be subjected to account termination and data deletion.", "select_type_workflow_threshold": -1, "release_doc_base_url": "https://docs.galaxyproject.org/en/release_", "plausible_server": null, "lims_doc_url": "https://usegalaxy.org/u/rkchak/p/sts", "tool_training_recommendations_link": "https://training.galaxyproject.org/training-material/by-tool/{training_tool_identifier}.html", "citation_url": "https://galaxyproject.org/citing-galaxy", "matomo_server": null, "chunk_upload_size": 10485760, "welcome_url": "/static/welcome.html", "logo_src_secondary": null, "has_user_tool_filters": true, "remote_user_logout_href": null, "version_major": "23.1", "server_mail_configured": false, "default_panel_view": "default", "tool_training_recommendations": true, "simplified_workflow_run_ui_target_history": "prefer_current", "enable_beta_markdown_export": false, "allow_user_impersonation": false, "themes": {}, "active_view": "analysis", "enable_webhooks": true, "show_inactivity_warning": false, "tool_shed_urls": ["https://toolshed.g2.bx.psu.edu/"], "tool_dynamic_configs": ["/evol/galaxytf23.1.3/local_tools/local_tool_conf.xml"], "stored_workflow_menu_entries": []}, "params": {"redirect": "/datasets/cc4287507a7e4aae/display/4f27993eab7751041e8c72047be3ea53_0.bw"}, "session_csrf_token": "a403b55f14053e4e", "redirect": "/datasets/cc4287507a7e4aae/display/4f27993eab7751041e8c72047be3ea53_0.bw"}; + var bootstrapped = {}; + + config.set({ + options: options, + bootstrapped: bootstrapped, + form_input_auto_focus: false + }); + </script> + + + + <script type="text/javascript"> + + var sentry = {}; + + config.set({ + sentry: sentry + }); + + </script> + + + </body> +</html> + + + + + + |
b |
diff -r 79f7265f90bd -r b04fd993b31e apache2_licence.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/apache2_licence.txt Wed Jan 17 07:50:52 2024 +0000 |
b |
b'@@ -0,0 +1,178 @@\n+\n+ Apache License\n+ Version 2.0, January 2004\n+ http://www.apache.org/licenses/\n+\n+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n+\n+ 1. Definitions.\n+\n+ "License" shall mean the terms and conditions for use, reproduction,\n+ and distribution as defined by Sections 1 through 9 of this document.\n+\n+ "Licensor" shall mean the copyright owner or entity authorized by\n+ the copyright owner that is granting the License.\n+\n+ "Legal Entity" shall mean the union of the acting entity and all\n+ other entities that control, are controlled by, or are under common\n+ control with that entity. For the purposes of this definition,\n+ "control" means (i) the power, direct or indirect, to cause the\n+ direction or management of such entity, whether by contract or\n+ otherwise, or (ii) ownership of fifty percent (50%) or more of the\n+ outstanding shares, or (iii) beneficial ownership of such entity.\n+\n+ "You" (or "Your") shall mean an individual or Legal Entity\n+ exercising permissions granted by this License.\n+\n+ "Source" form shall mean the preferred form for making modifications,\n+ including but not limited to software source code, documentation\n+ source, and configuration files.\n+\n+ "Object" form shall mean any form resulting from mechanical\n+ transformation or translation of a Source form, including but\n+ not limited to compiled object code, generated documentation,\n+ and conversions to other media types.\n+\n+ "Work" shall mean the work of authorship, whether in Source or\n+ Object form, made available under the License, as indicated by a\n+ copyright notice that is included in or attached to the work\n+ (an example is provided in the Appendix below).\n+\n+ "Derivative Works" shall mean any work, whether in Source or Object\n+ form, that is based on (or derived from) the Work and for which the\n+ editorial revisions, annotations, elaborations, or other modifications\n+ represent, as a whole, an original work of authorship. For the purposes\n+ of this License, Derivative Works shall not include works that remain\n+ separable from, or merely link (or bind by name) to the interfaces of,\n+ the Work and Derivative Works thereof.\n+\n+ "Contribution" shall mean any work of authorship, including\n+ the original version of the Work and any modifications or additions\n+ to that Work or Derivative Works thereof, that is intentionally\n+ submitted to Licensor for inclusion in the Work by the copyright owner\n+ or by an individual or Legal Entity authorized to submit on behalf of\n+ the copyright owner. For the purposes of this definition, "submitted"\n+ means any form of electronic, verbal, or written communication sent\n+ to the Licensor or its representatives, including but not limited to\n+ communication on electronic mailing lists, source code control systems,\n+ and issue tracking systems that are managed by, or on behalf of, the\n+ Licensor for the purpose of discussing and improving the Work, but\n+ excluding communication that is conspicuously marked or otherwise\n+ designated in writing by the copyright owner as "Not a Contribution."\n+\n+ "Contributor" shall mean Licensor and any individual or Legal Entity\n+ on behalf of whom a Contribution has been received by Licensor and\n+ subsequently incorporated within the Work.\n+\n+ 2. Grant of Copyright License. Subject to the terms and conditions of\n+ this License, each Contributor hereby grants to You a perpetual,\n+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n+ copyright license to reproduce, prepare Derivative Works of,\n+ publicly display, publicly perform, sublicense, and distribute the\n+ Work and such Derivative Works in Source or Obj'..b' or\n+ documentation, if provided along with the Derivative Works; or,\n+ within a display generated by the Derivative Works, if and\n+ wherever such third-party notices normally appear. The contents\n+ of the NOTICE file are for informational purposes only and\n+ do not modify the License. You may add Your own attribution\n+ notices within Derivative Works that You distribute, alongside\n+ or as an addendum to the NOTICE text from the Work, provided\n+ that such additional attribution notices cannot be construed\n+ as modifying the License.\n+\n+ You may add Your own copyright statement to Your modifications and\n+ may provide additional or different license terms and conditions\n+ for use, reproduction, or distribution of Your modifications, or\n+ for any such Derivative Works as a whole, provided Your use,\n+ reproduction, and distribution of the Work otherwise complies with\n+ the conditions stated in this License.\n+\n+ 5. Submission of Contributions. Unless You explicitly state otherwise,\n+ any Contribution intentionally submitted for inclusion in the Work\n+ by You to the Licensor shall be under the terms and conditions of\n+ this License, without any additional terms or conditions.\n+ Notwithstanding the above, nothing herein shall supersede or modify\n+ the terms of any separate license agreement you may have executed\n+ with Licensor regarding such Contributions.\n+\n+ 6. Trademarks. This License does not grant permission to use the trade\n+ names, trademarks, service marks, or product names of the Licensor,\n+ except as required for reasonable and customary use in describing the\n+ origin of the Work and reproducing the content of the NOTICE file.\n+\n+ 7. Disclaimer of Warranty. Unless required by applicable law or\n+ agreed to in writing, Licensor provides the Work (and each\n+ Contributor provides its Contributions) on an "AS IS" BASIS,\n+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n+ implied, including, without limitation, any warranties or conditions\n+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n+ PARTICULAR PURPOSE. You are solely responsible for determining the\n+ appropriateness of using or redistributing the Work and assume any\n+ risks associated with Your exercise of permissions under this License.\n+\n+ 8. Limitation of Liability. In no event and under no legal theory,\n+ whether in tort (including negligence), contract, or otherwise,\n+ unless required by applicable law (such as deliberate and grossly\n+ negligent acts) or agreed to in writing, shall any Contributor be\n+ liable to You for damages, including any direct, indirect, special,\n+ incidental, or consequential damages of any character arising as a\n+ result of this License or out of the use or inability to use the\n+ Work (including but not limited to damages for loss of goodwill,\n+ work stoppage, computer failure or malfunction, or any and all\n+ other commercial damages or losses), even if such Contributor\n+ has been advised of the possibility of such damages.\n+\n+ 9. Accepting Warranty or Additional Liability. While redistributing\n+ the Work or Derivative Works thereof, You may choose to offer,\n+ and charge a fee for, acceptance of support, warranty, indemnity,\n+ or other liability obligations and/or rights consistent with this\n+ License. However, in accepting such obligations, You may act only\n+ on Your own behalf and on Your sole responsibility, not on behalf\n+ of any other Contributor, and only if You agree to indemnify,\n+ defend, and hold each Contributor harmless for any liability\n+ incurred by, or claims asserted against, such Contributor by reason\n+ of your accepting any such warranty or additional liability.\n+\n+ END OF TERMS AND CONDITIONS\n+\n' |
b |
diff -r 79f7265f90bd -r b04fd993b31e jb2_webserver.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jb2_webserver.py Wed Jan 17 07:50:52 2024 +0000 |
[ |
@@ -0,0 +1,184 @@ +#!/usr/bin/env python3# spec: simplest python web server with range support and multithreading that takes root path, +# port and bind address as command line arguments; by default uses the current dir as webroot, +# port 8000 and bind address of 0.0.0.0 +# borrowed from https://github.com/danvk/RangeHTTPServer +# and reborrowed from https://gist.github.com/glowinthedark/b99900abe935e4ab4857314d647a9068 +# +# The Apache 2.0 license copy in this repository is distributed with this code in accordance with that licence. +# https://www.apache.org/licenses/LICENSE-2.0.txt +# This part is not MIT licenced like the other components. + +# APPENDIX: How to apply the Apache License to your work. + +# To apply the Apache License to your work, attach the following +# boilerplate notice, with the fields enclosed by brackets "[]" +# replaced with your own identifying information. (Don't include +# the brackets!) The text should be enclosed in the appropriate +# comment syntax for the file format. We also recommend that a +# file or class name and description of purpose be included on the +# same "printed page" as the copyright notice for easier +# identification within third-party archives. + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +import argparse +import functools +import os +import re +import socketserver +import webbrowser +from http.server import SimpleHTTPRequestHandler + + +DEFAULT_PORT = 8080 + + +def copy_byte_range(infile, outfile, start=None, stop=None, bufsize=16 * 1024): + """Like shutil.copyfileobj, but only copy a range of the streams. + + Both start and stop are inclusive. + """ + if start is not None: + infile.seek(start) + while 1: + to_read = min(bufsize, stop + 1 - infile.tell() if stop else bufsize) + buf = infile.read(to_read) + if not buf: + break + outfile.write(buf) + + +BYTE_RANGE_RE = re.compile(r"bytes=(\d+)-(\d+)?$") + + +def parse_byte_range(byte_range): + """Returns the two numbers in 'bytes=123-456' or throws ValueError. + + The last number or both numbers may be None. + """ + if byte_range.strip() == "": + return None, None + + m = BYTE_RANGE_RE.match(byte_range) + if not m: + raise ValueError("Invalid byte range %s" % byte_range) + + first, last = [x and int(x) for x in m.groups()] + if last and last < first: + raise ValueError("Invalid byte range %s" % byte_range) + return first, last + + +class RangeRequestHandler(SimpleHTTPRequestHandler): + """Adds support for HTTP 'Range' requests to SimpleHTTPRequestHandler + + The approach is to: + - Override send_head to look for 'Range' and respond appropriately. + - Override copyfile to only transmit a range when requested. + """ + + def handle(self): + try: + SimpleHTTPRequestHandler.handle(self) + except Exception: + # ignored, thrown whenever the client aborts streaming (broken pipe) + pass + + def send_head(self): + if "Range" not in self.headers: + self.range = None + return SimpleHTTPRequestHandler.send_head(self) + try: + self.range = parse_byte_range(self.headers["Range"]) + except ValueError: + self.send_error(400, "Invalid byte range") + return None + first, last = self.range + + # Mirroring SimpleHTTPServer.py here + path = self.translate_path(self.path) + f = None + ctype = self.guess_type(path) + try: + f = open(path, "rb") + except IOError: + self.send_error(404, "File not found") + return None + + fs = os.fstat(f.fileno()) + file_len = fs[6] + if first >= file_len: + self.send_error(416, "Requested Range Not Satisfiable") + return None + + self.send_response(206) + self.send_header("Content-type", ctype) + + if last is None or last >= file_len: + last = file_len - 1 + response_length = last - first + 1 + + self.send_header("Content-Range", "bytes %s-%s/%s" % (first, last, file_len)) + self.send_header("Content-Length", str(response_length)) + self.send_header("Last-Modified", self.date_time_string(fs.st_mtime)) + self.end_headers() + return f + + def end_headers(self): + self.send_header("Accept-Ranges", "bytes") + return SimpleHTTPRequestHandler.end_headers(self) + + def copyfile(self, source, outputfile): + if not self.range: + return SimpleHTTPRequestHandler.copyfile(self, source, outputfile) + + # SimpleHTTPRequestHandler uses shutil.copyfileobj, which doesn't let + # you stop the copying before the end of the file. + start, stop = self.range # set in send_head() + copy_byte_range(source, outputfile, start, stop) + + +class ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer): + allow_reuse_address = True + + +if __name__ == "__main__": + parser = argparse.ArgumentParser( + description="Simple Python Web Server with Range Support" + ) + parser.add_argument( + "--root", + default=os.getcwd(), + help="Root path to serve files from (default: current working directory)", + ) + parser.add_argument( + "--port", + type=int, + default=DEFAULT_PORT, + help=f"Port to listen on (default: {DEFAULT_PORT})", + ) + parser.add_argument( + "--bind", default="0.0.0.0", help="IP address to bind to (default: 0.0.0.0)" + ) + args = parser.parse_args() + + handler = functools.partial(RangeRequestHandler, directory=args.root) + + webbrowser.open(f"http://{args.bind}:{args.port}") + + with ThreadedTCPServer((args.bind, args.port), handler) as httpd: + print( + f"Serving HTTP on {args.bind} port {args.port} (http://{args.bind}:{args.port}/)" + ) + httpd.serve_forever() |
b |
diff -r 79f7265f90bd -r b04fd993b31e jbrowse2.py --- a/jbrowse2.py Tue Jan 09 06:55:34 2024 +0000 +++ b/jbrowse2.py Wed Jan 17 07:50:52 2024 +0000 |
[ |
b'@@ -17,6 +17,10 @@\n \n logging.basicConfig(level=logging.INFO)\n log = logging.getLogger("jbrowse")\n+\n+JB2VER = "v2.10.0"\n+# version pinned for cloning\n+\n TODAY = datetime.datetime.now().strftime("%Y-%m-%d")\n GALAXY_INFRASTRUCTURE_URL = None\n JB2REL = "v2.10.0"\n@@ -371,7 +375,6 @@\n \n class JbrowseConnector(object):\n def __init__(self, outdir, genomes):\n- self.debug = False\n self.usejson = True\n self.giURL = GALAXY_INFRASTRUCTURE_URL\n self.outdir = outdir\n@@ -387,16 +390,14 @@\n \n def subprocess_check_call(self, command, output=None):\n if output:\n- if self.debug:\n- log.debug("cd %s && %s > %s", self.outdir, " ".join(command), output)\n+ log.debug("cd %s && %s > %s", self.outdir, " ".join(command), output)\n subprocess.check_call(command, cwd=self.outdir, stdout=output)\n else:\n log.debug("cd %s && %s", self.outdir, " ".join(command))\n subprocess.check_call(command, cwd=self.outdir)\n \n def subprocess_popen(self, command):\n- if self.debug:\n- log.debug(command)\n+ log.debug(command)\n p = subprocess.Popen(\n command,\n cwd=self.outdir,\n@@ -414,8 +415,7 @@\n raise RuntimeError("Command failed with exit code %s" % (retcode))\n \n def subprocess_check_output(self, command):\n- if self.debug:\n- log.debug(" ".join(command))\n+ log.debug(" ".join(command))\n return subprocess.check_output(command, cwd=self.outdir)\n \n def symlink_or_copy(self, src, dest):\n@@ -465,9 +465,14 @@\n self.config_json["assemblies"] = assemblies\n \n def make_assembly(self, fapath, gname):\n- faname = gname + ".fa.gz"\n+ hashData = [\n+ fapath,\n+ gname,\n+ ]\n+ hashData = "|".join(hashData).encode("utf-8")\n+ ghash = hashlib.md5(hashData).hexdigest()\n+ faname = ghash + ".fa.gz"\n fadest = os.path.join(self.outdir, faname)\n- # fadest = os.path.realpath(os.path.join(self.outdir, faname))\n cmd = "bgzip -i -c %s -I %s.gzi > %s && samtools faidx %s" % (\n fapath,\n fadest,\n@@ -556,7 +561,7 @@\n # can be served - if public.\n # dsId = trackData["metadata"]["dataset_id"]\n # url = "%s/api/datasets/%s/display?to_ext=hic " % (self.giURL, dsId)\n- hname = trackData["name"]\n+ hname = trackData["label"]\n dest = os.path.join(self.outdir, hname)\n cmd = ["cp", data, dest]\n # these can be very big.\n@@ -603,8 +608,6 @@\n tId = trackData["label"]\n fname = "%s.bed" % tId\n dest = "%s/%s" % (self.outdir, fname)\n- # self.symlink_or_copy(data, dest)\n- # Process MAF to bed-like. Need build to munge chromosomes\n gname = self.genome_name\n cmd = [\n "bash",\n@@ -722,11 +725,11 @@\n trackDict["style"] = style_json\n self.tracksToAdd.append(trackDict)\n self.trackIdlist.append(tId)\n-\n os.unlink(gff3)\n \n def add_bigwig(self, data, trackData):\n- url = "%s.bw" % trackData["name"]\n+ url = "%s.bigwig" % trackData["label"]\n+ # slashes in names cause path trouble\n dest = os.path.join(self.outdir, url)\n cmd = ["cp", data, dest]\n self.subprocess_check_call(cmd)\n@@ -735,7 +738,7 @@\n trackDict = {\n "type": "QuantitativeTrack",\n "trackId": tId,\n- "name": url,\n+ "name": trackData["name"],\n "assemblyNames": [\n self.genome_name,\n ],\n@@ -754,6 +757,7 @@\n trackDict["style"] = style_json\n self.tracksToAdd.append(trackDict)\n self.trackIdlist.append(tId)\n+ logging.debug("#### wig trackData=%s" % str(trackData))\n \n def add_bam(self, data, trackData, bamOpts, bam_index=None, **kwargs):\n tId = trackData["label"]\n@@ -959,35 +963,24 @@\n '..b'ack_types[tId],\n+ "configuration": tId,\n+ "displays": [style_data],\n+ }\n+ )\n \n # The view for the assembly we\'re adding\n view_json = {"type": "LinearGenomeView", "tracks": tracks_data}\n@@ -1199,7 +1181,7 @@\n elif self.genome_name is not None:\n refName = self.genome_name\n start = 0\n- end = 100000 # Booh, hard coded! waiting for https://github.com/GMOD/jbrowse-components/issues/2708\n+ end = 10000 # Booh, hard coded! waiting for https://github.com/GMOD/jbrowse-components/issues/2708\n \n if refName is not None:\n # TODO displayedRegions is not just zooming to the region, it hides the rest of the chromosome\n@@ -1265,8 +1247,11 @@\n \n def clone_jbrowse(self):\n """Clone a JBrowse directory into a destination directory."""\n+ # dest = os.path.realpath(self.outdir)\n dest = self.outdir\n- cmd = ["jbrowse", "create", "-t", JB2REL, "-f", dest]\n+ cmd = ["rm", "-rf", dest + "/*"]\n+ self.subprocess_check_call(cmd)\n+ cmd = ["jbrowse", "create", dest, "-t", JB2VER, "-f"]\n self.subprocess_check_call(cmd)\n for fn in [\n "asset-manifest.json",\n@@ -1278,7 +1263,7 @@\n ]:\n cmd = ["rm", "-rf", os.path.join(self.outdir, fn)]\n self.subprocess_check_call(cmd)\n- cmd = ["cp", os.path.join(INSTALLED_TO, "webserver.py"), self.outdir]\n+ cmd = ["cp", os.path.join(INSTALLED_TO, "jb2_webserver.py"), self.outdir]\n self.subprocess_check_call(cmd)\n \n \n@@ -1386,21 +1371,17 @@\n {}, # No metadata for multiple bigwig\n )\n )\n-\n track_conf["category"] = track.attrib["cat"]\n track_conf["format"] = track.attrib["format"]\n- track_conf["style"] = {\n- item.tag: parse_style_conf(item) for item in track.find("options/style")\n- }\n-\n- track_conf["style"] = {\n- item.tag: parse_style_conf(item) for item in track.find("options/style")\n- }\n-\n- track_conf["style_labels"] = {\n- item.tag: parse_style_conf(item)\n- for item in track.find("options/style_labels")\n- }\n+ if track.find("options/style"):\n+ track_conf["style"] = {\n+ item.tag: parse_style_conf(item) for item in track.find("options/style")\n+ }\n+ if track.find("options/style_labels"):\n+ track_conf["style_labels"] = {\n+ item.tag: parse_style_conf(item)\n+ for item in track.find("options/style_labels")\n+ }\n \n track_conf["conf"] = etree_to_dict(track.find("options"))\n keys = jc.process_annotations(track_conf)\n@@ -1410,10 +1391,14 @@\n default_session_data["visibility"][\n track.attrib.get("visibility", "default_off")\n ].append(key)\n- default_session_data["style"][key] = track_conf[\n- "style"\n- ] # TODO do we need this anymore?\n- default_session_data["style_labels"][key] = track_conf["style_labels"]\n+ if track_conf.get("style", None):\n+ default_session_data["style"][key] = track_conf[\n+ "style"\n+ ] # TODO do we need this anymore?\n+ if track_conf.get("style_lables", None):\n+ default_session_data["style_labels"][key] = track_conf.get(\n+ "style_labels", None\n+ )\n \n default_session_data["defaultLocation"] = root.find(\n "metadata/general/defaultLocation"\n@@ -1444,7 +1429,6 @@\n jc.config_json["tracks"] = jc.tracksToAdd\n if jc.usejson:\n jc.write_config()\n- # jc.add_default_view()\n jc.add_default_session(default_session_data)\n \n # jc.text_index() not sure what broke here.\n' |
b |
diff -r 79f7265f90bd -r b04fd993b31e jbrowse2.xml --- a/jbrowse2.xml Tue Jan 09 06:55:34 2024 +0000 +++ b/jbrowse2.xml Wed Jan 17 07:50:52 2024 +0000 |
[ |
b'@@ -130,145 +130,9 @@\n #end if\n \n <options>\n- <style>\n- <display>${track.data_format.jbstyle.track_style.display}</display>\n- ## TODO change this to a for loop?\n- #if \'show_labels\' in $track.data_format.jbstyle.track_style\n- <trackShowLabels type="boolean">${track.data_format.jbstyle.track_style.show_labels}</trackShowLabels>\n- #end if\n- #if \'show_descriptions\' in $track.data_format.jbstyle.track_style\n- <trackShowDescriptions type="boolean">${track.data_format.jbstyle.track_style.show_descriptions}</trackShowDescriptions>\n- #end if\n- #if \'display_mode\' in $track.data_format.jbstyle.track_style\n- <trackDisplayMode>${track.data_format.jbstyle.track_style.display_mode}</trackDisplayMode>\n- #end if\n- #if \'max_height\' in $track.data_format.jbstyle.track_style\n- <trackMaxHeight type="integer">${track.data_format.jbstyle.track_style.max_height}</trackMaxHeight>\n- #end if\n- #if \'autoscale\' in $track.data_format.jbstyle.track_style\n- <autoscale>${track.data_format.jbstyle.track_style.autoscale}</autoscale>\n- #end if\n- #if \'resolution\' in $track.data_format.jbstyle.track_style\n- <resolution type="integer">${track.data_format.jbstyle.track_style.resolution}</resolution>\n- #end if\n- #if \'summaryScoreMode\' in $track.data_format.jbstyle.track_style\n- <summaryScoreMode>${track.data_format.jbstyle.track_style.summaryScoreMode}</summaryScoreMode>\n- #end if\n- #if \'scaleType\' in $track.data_format.jbstyle.track_style\n- <scaleType>${track.data_format.jbstyle.track_style.scaleType}</scaleType>\n- #end if\n- #if \'filled\' in $track.data_format.jbstyle.track_style\n- <filled type="boolean">${track.data_format.jbstyle.track_style.filled}</filled>\n- #end if\n- #if \'displayCrossHatches\' in $track.data_format.jbstyle.track_style\n- <displayCrossHatches type="boolean">${track.data_format.jbstyle.track_style.displayCrossHatches}</displayCrossHatches>\n- #end if\n- #if \'minScore\' in $track.data_format.jbstyle.track_style and $track.data_format.jbstyle.track_style.minScore\n- <minScore type="integer">${track.data_format.jbstyle.track_style.minScore}</minScore>\n- #end if\n- #if \'maxScore\' in $track.data_format.jbstyle.track_style and $track.data_format.jbstyle.track_style.maxScore\n- <maxScore type="integer">${track.data_format.jbstyle.track_style.maxScore}</maxScore>\n- #end if\n- ## TODO other coloring/etc options in each renderer (e.g https://github.com/GMOD/jbrowse-components/blob/main/plugins/svg/src/SvgFeatureRenderer/configSchema.ts)\n- </style>\n- <style_labels>\n- ## TODO other label options: https://github.com/GMOD/jbrowse-components/blob/main/plugins/svg/src/SvgFeatureRenderer/configSchema.ts\n- #if \'label\' in $track.data_format.jbstyle.track_style\n- <name>${track.data_format.jbstyle.track_style.label}</name>\n- #end if\n- #if \'description\' in $track.data_format.jbstyle.track_style\n- <description>${track.data_format.jbstyle.track_style.description}</description>\n- #end if\n- </style_labels>\n- #if str($track.data_format.data_format_select) == "gene_calls" or str($track.data_format.data_form'..b' <param name="index" value="true"/>\n <conditional name="match_part">\n <param name="match_part_select" value="false"/>\n </conditional>\n@@ -928,13 +728,10 @@\n <output name="output">\n <assert_contents>\n <has_text text="With menu or index"/>\n- <has_text text="Some menu item"/>\n- <has_text text="Frame title"/>\n- <has_text text="dijitIconNewTask"/>\n+ <has_text text="gene_calls"/>\n </assert_contents>\n </output>\n </test>\n-\n <!-- TODO add a synteny test -->\n <!-- TODO add a bam and a cram test -->\n <!-- TODO add an hic test -->\n@@ -955,16 +752,22 @@\n Use and local viewing\n =====================\n \n+\n A JBrowse2 history item can be opened by viewing it (the "eye" icon).\n-They can also be downloaded as archives ("floppy disk" icon) to share and for local viewing.\n-One extra step is required before they can be viewed. A local python web server must be started using a script included in each archive.\n-Unzip the archive (*unzip [filename].zip*) and change to the first level directory. It contains a file named "webserver.py"\n+\n+The same browser data and setup can also be downloaded as a compressed zip archive by clicking the download ("floppy disk") icon in the history.\n+This can be shared and viewed without Galaxy.\n \n-Assuming you have python3 installed, running:\n+A replacement application to serve the browser is required without Galaxy. A local python web server can be started using a script included in each archive,\n+assuming that Python3 is already working on your desktop - if not you will have to install it first. Unzip the archive (*unzip [filename].zip*) and change\n+directory to the first level in that zip archive. It contains a file named *jb2_webserver.py*\n \n-*python3 webserver.py*\n+With python3 installed,\n \n-will serve the unarchived JBrowse2 configuration, so it can be browsed by pointing a web browser to localhost:8080\n+*python3 jb2_webserver.py*\n+\n+will serve the unarchived JBrowse2 configuration from the same directory as the python script automatically. If a new browser window does not open,\n+but the script appears to be running, try pointing your web browser to the default of *localhost:8080*\n \n Overview\n --------\n@@ -973,13 +776,9 @@\n JavaScript and HTML5.\n \n The JBrowse-in-Galaxy (JiG) tool was written to help build complex\n-JBrowse installations straight from Galaxy, taking advantage of the\n-latest Galaxy features such as dataset collections, sections, and colour\n-pickers. It allows you to build up a JBrowse instance without worrying\n+JBrowse installations straight from Galaxy. It allows you to build up a JBrowse instance without worrying\n about how to run the command line tools to format your data, and which\n-options need to be supplied and where. Additionally it comes with many\n-javascript functions to handle colouring of features which would be\n-nearly impossible to write without the assistance of this tool.\n+options need to be supplied and where.\n \n The JBrowse-in-Galaxy tool is maintained by `the Galaxy IUC\n <https://github.com/galaxyproject/tools-iuc/issues>`__, who you can help you\n@@ -988,8 +787,8 @@\n Options\n -------\n \n-The first option you encounter is the **Fasta Sequence(s)**. This option\n-now accepts multiple fasta files, allowing you to build JBrowse\n+The first option you encounter is the **Reference sequence(s)** to use. This option\n+now accepts multiple fasta files, allowing you to build JBrowse2\n instances that contain data for multiple genomes or chrosomomes\n (generally known as "landmark features" in gff3 terminology.)\n \n@@ -1046,11 +845,6 @@\n they should adjust feature locations by 3x.\n \n \n-VCFs/SNPs\n-~~~~~~~~~\n-\n-These tracks do not support any special configuration.\n-\n @ATTRIBUTION@\n ]]></help>\n <expand macro="citations"/>\n' |
b |
diff -r 79f7265f90bd -r b04fd993b31e plants.sh --- a/plants.sh Tue Jan 09 06:55:34 2024 +0000 +++ b/plants.sh Wed Jan 17 07:50:52 2024 +0000 |
b |
@@ -1,1 +1,1 @@ -planemo shed_update --shed_target toolshed --owner fubar --name jbrowse2 --shed_key 8d01f2f35d48a0405f72d6d37aedde60 jbrowse2 +planemo shed_update --shed_target toolshed --owner fubar --name jbrowse2 --shed_key 8d01f2f35d48a0405f72d6d37aedde60 ./ |
b |
diff -r 79f7265f90bd -r b04fd993b31e readme.rst --- a/readme.rst Tue Jan 09 06:55:34 2024 +0000 +++ b/readme.rst Wed Jan 17 07:50:52 2024 +0000 |
b |
@@ -8,92 +8,40 @@ workflow summary. E.g. annotate a genome, then visualise all of the associated datasets as an interactive HTML page. This tool MUST be whitelisted (or ``sanitize_all_html=False`` in galaxy.ini) to function correctly. -gunicorn does not support byte range requests, so this tool must be served by nginx -or other web server, correctly configured to support range requests. +The built-in Galaxy gunicorn server does not support byte range requests, so this tool must be proxied by nginx +or another web server, correctly configured to support range requests. A tiny web server is bundled +with each JBrowse2 archive - see below. Installation ============ -It is recommended to install this wrapper via the Galaxy Tool Shed. +This wrapper is normally installed by a server administrator from the Galaxy Tool Shed IUC JBrowse2 repository. -Running Locally -=============== +Local display +============= -The Galaxy tool interface writes out a xml file which is then used to generate -the visualizations. An example used during development/testing can be seen in -`test-data/*/test.xml`. The format is in no way rigorously defined and is -likely to change at any time! Beware. ;) +Each JBrowse2 history item can be downloaded ("floppy disk" icon) to your local disk. There, it can be unzipped into a new directory. +That directory includes a python script, *jb2_webserver.py* that will run a local web server able to serve byte range requests, +giving the same view as seen when viewed from the Galaxy history. + +From the newly unzipped directory where that file can be found, and with Python3 installed and working, + +`python3 jb2_webserver.py` + +will open the preconfigured browser using the default web browser application. History ======= - 2.10.0+galaxy2 - - UPDATED to JBrowse 2.10.0 - - REMOVED most colour and track control from XML and script. + - UPDATED existing JBrowse1.16.11 code to JBrowse 2.10.0 - seems to work well with defaults. - need to document and implement track settings by running the browser locally. - works well enough to be useful in workflows such as TreeValGal. - JB2 seems to set defaults wisely. - not yet ideal for users who need fine grained track control. -- 1.16.11+galaxy0 - - - UPDATED to JBrowse 1.16.11 - -- 1.16.10+galaxy0 - - - UPDATED to JBrowse 1.16.10 - - ADDED GALAXY_JBROWSE_SYMLINKS environment variable: if set, the tool will make symlinks to bam/bigwig files instead of copying them - -- 1.16.9+galaxy0 - - - UPDATED to JBrowse 1.16.9 - -- 1.16.8+galaxy0 - - - UPDATED to JBrowse 1.16.8 - -- 1.16.5+galaxy0 - - - UPDATED to JBrowse 1.16.5 - -- 1.16.4+galaxy0 - - - UPDATED to JBrowse 1.16.4 - - ADDED filter too big metadata - - CHANGED default value for topLevelFeatures (gene subfeatures are now inferred) and style.className (feature style was fixed) - -- 1.16.2+galaxy0 - - - UPDATED to JBrowse 1.16.2 - - ADDED support for NeatHTMLFeatures and NeatCanvasFeatures track types - -- 1.16.1+galaxy0 - - - UPDATED to JBrowse 1.16.1 - - ADDED support for MultiBigWig plugin - - ADDED support for tabix indexing of fasta and gff - - ADDED support for REST and SPARQL endpoints - - ADDED option to change chunk size for BAM tracks - - FIXED loading of VCF files. They were gzipped and the URLs were incorrect - - FIXED metadata on tracks types other than GFF+HTML - - FIXED infrastructure URL parsing (and embedding in links) for some tracks - - REMOVED support for selecting multiple genomes as input due to tracking of track metadata - - REMOVED support for themes as JBrowse no longer allow runtime loading of plugins - -- 0.7 Support for plugins (currently GC Content, Bookmarks, ComboTrackSelector), - track metadata -- 0.5.2 Support for CanvasFeatures options. -- 0.5.1 Support for contextual menus. Conda tests. -- 0.5 Update existing instances on disk. Index names. Support HTML tracks - instead of Canvas. Support default tracks. General JBrowse optinos -- 0.4 Support for dataset collections and customisation of tracks including - labelling, colours, styling. Added support for genetic code selection. - Fixed package installation recipe issues. -- 0.3 Added support for BigWig, etc. -- 0.2 Added support for BAM, Blast, VCF. -- 0.1 Initial public release. Wrapper License (MIT/BSD Style) =============================== |
b |
diff -r 79f7265f90bd -r b04fd993b31e webserver.py --- a/webserver.py Tue Jan 09 06:55:34 2024 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,159 +0,0 @@ -#!/usr/bin/env python3 - -# spec: simplest python web server with range support and multithreading that takes root path, -# port and bind address as command line arguments; by default uses the current dir as webroot, -# port 8000 and bind address of 0.0.0.0 -# borrowed from https://github.com/danvk/RangeHTTPServer -# and reborrowed from https://gist.github.com/glowinthedark/b99900abe935e4ab4857314d647a9068 - - -import argparse -import functools -import os -import re -import socketserver -import webbrowser -from http.server import SimpleHTTPRequestHandler - - -DEFAULT_PORT = 8080 - - -def copy_byte_range(infile, outfile, start=None, stop=None, bufsize=16 * 1024): - """Like shutil.copyfileobj, but only copy a range of the streams. - - Both start and stop are inclusive. - """ - if start is not None: - infile.seek(start) - while 1: - to_read = min(bufsize, stop + 1 - infile.tell() if stop else bufsize) - buf = infile.read(to_read) - if not buf: - break - outfile.write(buf) - - -BYTE_RANGE_RE = re.compile(r"bytes=(\d+)-(\d+)?$") - - -def parse_byte_range(byte_range): - """Returns the two numbers in 'bytes=123-456' or throws ValueError. - - The last number or both numbers may be None. - """ - if byte_range.strip() == "": - return None, None - - m = BYTE_RANGE_RE.match(byte_range) - if not m: - raise ValueError("Invalid byte range %s" % byte_range) - - first, last = [x and int(x) for x in m.groups()] - if last and last < first: - raise ValueError("Invalid byte range %s" % byte_range) - return first, last - - -class RangeRequestHandler(SimpleHTTPRequestHandler): - """Adds support for HTTP 'Range' requests to SimpleHTTPRequestHandler - - The approach is to: - - Override send_head to look for 'Range' and respond appropriately. - - Override copyfile to only transmit a range when requested. - """ - - def handle(self): - try: - SimpleHTTPRequestHandler.handle(self) - except Exception: - # ignored, thrown whenever the client aborts streaming (broken pipe) - pass - - def send_head(self): - if "Range" not in self.headers: - self.range = None - return SimpleHTTPRequestHandler.send_head(self) - try: - self.range = parse_byte_range(self.headers["Range"]) - except ValueError: - self.send_error(400, "Invalid byte range") - return None - first, last = self.range - - # Mirroring SimpleHTTPServer.py here - path = self.translate_path(self.path) - f = None - ctype = self.guess_type(path) - try: - f = open(path, "rb") - except IOError: - self.send_error(404, "File not found") - return None - - fs = os.fstat(f.fileno()) - file_len = fs[6] - if first >= file_len: - self.send_error(416, "Requested Range Not Satisfiable") - return None - - self.send_response(206) - self.send_header("Content-type", ctype) - - if last is None or last >= file_len: - last = file_len - 1 - response_length = last - first + 1 - - self.send_header("Content-Range", "bytes %s-%s/%s" % (first, last, file_len)) - self.send_header("Content-Length", str(response_length)) - self.send_header("Last-Modified", self.date_time_string(fs.st_mtime)) - self.end_headers() - return f - - def end_headers(self): - self.send_header("Accept-Ranges", "bytes") - return SimpleHTTPRequestHandler.end_headers(self) - - def copyfile(self, source, outputfile): - if not self.range: - return SimpleHTTPRequestHandler.copyfile(self, source, outputfile) - - # SimpleHTTPRequestHandler uses shutil.copyfileobj, which doesn't let - # you stop the copying before the end of the file. - start, stop = self.range # set in send_head() - copy_byte_range(source, outputfile, start, stop) - - -class ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer): - allow_reuse_address = True - - -if __name__ == "__main__": - parser = argparse.ArgumentParser( - description="Simple Python Web Server with Range Support" - ) - parser.add_argument( - "--root", - default=os.getcwd(), - help="Root path to serve files from (default: current working directory)", - ) - parser.add_argument( - "--port", - type=int, - default=DEFAULT_PORT, - help=f"Port to listen on (default: {DEFAULT_PORT})", - ) - parser.add_argument( - "--bind", default="0.0.0.0", help="IP address to bind to (default: 0.0.0.0)" - ) - args = parser.parse_args() - - handler = functools.partial(RangeRequestHandler, directory=args.root) - - webbrowser.open(f"http://{args.bind}:{args.port}") - - with ThreadedTCPServer((args.bind, args.port), handler) as httpd: - print( - f"Serving HTTP on {args.bind} port {args.port} (http://{args.bind}:{args.port}/)" - ) - httpd.serve_forever() |