changeset 3:2de9f585505b draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b30d2e277cc360437a02fa812c577c0c8d997cff-dirty
author fubar
date Tue, 09 Jan 2024 02:35:52 +0000
parents 37b2c26c7b9b
children 54396f0323f4
files apache2_license.txt jbrowse2.py jbrowse2.xml macros.xml maf2bed.pl servejb2.py static/images/bam.png static/images/bigwig.png static/images/blast.png static/images/opacity.png static/images/sections.png static/images/styling.png test-data/blastxml/test.xml test-data/bw/test.xml test-data/index.html test-data/merlin.fa test-data/vcf/test.xml tool_data_table_conf.xml.sample webserver.py
diffstat 18 files changed, 695 insertions(+), 289 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apache2_license.txt	Tue Jan 09 02:35:52 2024 +0000
@@ -0,0 +1,201 @@
+Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   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.
+
+   Copyright 2023 Dan Vanderkam
+
+   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.
--- a/jbrowse2.py	Mon Jan 08 09:23:19 2024 +0000
+++ b/jbrowse2.py	Tue Jan 09 02:35:52 2024 +0000
@@ -19,6 +19,9 @@
 log = logging.getLogger("jbrowse")
 TODAY = datetime.datetime.now().strftime("%Y-%m-%d")
 GALAXY_INFRASTRUCTURE_URL = None
+JB2REL="v2.10.0"
+# version pinned for cloning
+
 mapped_chars = {
     ">": "__gt__",
     "<": "__lt__",
@@ -451,7 +454,9 @@
             assemblies.append(assem)
             self.genome_names.append(genome_name)
             if self.genome_name is None:
-                self.genome_name = genome_name  # first one for all tracks - other than paf
+                self.genome_name = (
+                    genome_name  # first one for all tracks - other than paf
+                )
             if self.config_json.get("assemblies", None):
                 self.config_json["assemblies"] += assemblies
             else:
@@ -506,8 +511,6 @@
             "-v",
             " LinearGenomeView",
         ]
-        if self.debug:
-            log.info("### calling set-default-session with cmd=%s" % "  ".join(cmd))
         self.subprocess_check_call(cmd)
 
     def write_config(self):
@@ -592,7 +595,7 @@
             "plugins": [
                 {
                     "name": "MafViewer",
-                    "url": "https://unpkg.com/jbrowse-plugin-mafviewer/dist/jbrowse-plugin-mafviewer.umd.production.min.js",
+                    "url": "https://unpkg.com/browse/jbrowse-plugin-mafviewer@1.0.6/dist/jbrowse-plugin-mafviewer.umd.production.min.js",
                 }
             ]
         }
@@ -935,13 +938,17 @@
         tId = trackData["label"]
         pgname = pafOpts["genome_label"]
         if len(pgname.split() > 1):
-            pgname = pgname.split()[0]  # trouble from spacey names in command lines avoidance
+            pgname = pgname.split()[
+                0
+            ]  # trouble from spacey names in command lines avoidance
         asstrack, gname = self.make_assembly(pafOpts["genome"], pgname)
         self.genome_names.append(pgname)
         if self.config_json.get("assemblies", None):
             self.config_json["assemblies"].append(asstrack)
         else:
-            self.config_json["assemblies"] = [asstrack,]
+            self.config_json["assemblies"] = [
+                asstrack,
+            ]
 
         style_json = self._prepare_track_style(trackData)
         url = "%s.paf" % (trackData["label"])
@@ -1256,7 +1263,7 @@
     def clone_jbrowse(self):
         """Clone a JBrowse directory into a destination directory."""
         dest = self.outdir
-        cmd = ["jbrowse", "create", "-f", dest]
+        cmd = ["jbrowse", "create", "-t",JB2REL, "-f", dest]
         self.subprocess_check_call(cmd)
         for fn in [
             "asset-manifest.json",
@@ -1268,7 +1275,7 @@
         ]:
             cmd = ["rm", "-rf", os.path.join(self.outdir, fn)]
             self.subprocess_check_call(cmd)
-        cmd = ["cp", os.path.join(INSTALLED_TO, "servejb2.py"), self.outdir]
+        cmd = ["cp", os.path.join(INSTALLED_TO, "webserver.py"), self.outdir]
         self.subprocess_check_call(cmd)
 
 
--- a/jbrowse2.xml	Mon Jan 08 09:23:19 2024 +0000
+++ b/jbrowse2.xml	Tue Jan 09 02:35:52 2024 +0000
@@ -958,11 +958,11 @@
 A JBrowse2 history item can be opened by viewing it (the "eye" icon).
 They can also be downloaded as archives ("floppy disk" icon) to share and for local viewing.
 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.
-Unzip the archive (*unzip [filename].zip*) and change to the first level directory. It contains a file named "servejb2.py"
+Unzip the archive (*unzip [filename].zip*) and change to the first level directory. It contains a file named "webserver.py"
 
 Assuming you have python3 installed, running:
 
-*python3 servjb2.py*
+*python3 webserver.py*
 
 will serve the unarchived JBrowse2 configuration, so it can be browsed by pointing a web browser to localhost:8080
 
--- a/macros.xml	Mon Jan 08 09:23:19 2024 +0000
+++ b/macros.xml	Tue Jan 09 02:35:52 2024 +0000
@@ -27,7 +27,7 @@
     <token name="@WRAPPER_VERSION@">galaxy0</token>
     <token name="@ATTRIBUTION@"><![CDATA[
 **Attribution**
-This Galaxy tool relies on the JBrowse, maintained by the GMOD Community. The Galaxy wrapper is developed by the IUC
+This Galaxy tool relies on the JBrowse2, maintained by the GMOD Community. The Galaxy wrapper is developed by the IUC
 This xml currently fails silently when profile=22.05 is set.
 ]]>
     </token>
--- a/maf2bed.pl	Mon Jan 08 09:23:19 2024 +0000
+++ b/maf2bed.pl	Tue Jan 09 02:35:52 2024 +0000
@@ -1,4 +1,6 @@
 #!/usr/bin/env perl
+# https://unpkg.com/browse/jbrowse-plugin-mafviewer@1.0.6/dist/
+# license is Apache2_license.txt included here
 use warnings;
 use strict;
 
--- a/servejb2.py	Mon Jan 08 09:23:19 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()
Binary file static/images/bam.png has changed
Binary file static/images/bigwig.png has changed
Binary file static/images/blast.png has changed
Binary file static/images/opacity.png has changed
Binary file static/images/sections.png has changed
Binary file static/images/styling.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/blastxml/test.xml	Tue Jan 09 02:35:52 2024 +0000
@@ -0,0 +1,138 @@
+<?xml version="1.0"?>
+<root>
+    <metadata>
+        <genomes>
+            <genome>test-data/merlin.fa</genome>
+        </genomes>
+        <general>
+            <defaultLocation></defaultLocation>
+            <trackPadding>40</trackPadding>
+            <shareLink>true</shareLink>
+            <aboutDescription></aboutDescription>
+            <show_tracklist>true</show_tracklist>
+            <show_nav>true</show_nav>
+            <show_overview>false</show_overview>
+            <show_menu>true</show_menu>
+            <hideGenomeOptions>false</hideGenomeOptions>
+        </general>
+    </metadata>
+    <tracks>
+        <track cat="Blah" format="blast">
+            <files>
+                <trackFile path="test-data/blastxml/blast.xml" ext="blastxml" label="BlastP"/>
+            </files>
+
+            <options>
+                <style>
+                    <className>feature</className>
+                    <description></description>
+                    <label>Description</label>
+                    <height>400px</height>
+                </style>
+                <blast>
+                    <parent>test-data/blastxml/merlin.gff</parent>
+                    <protein>true</protein>
+                    <min_gap>10</min_gap>
+                </blast>
+                <scaling>
+                    <method>score</method>
+                    <algo>blast</algo>
+                    <scales>
+                        <type>__auto__</type>
+                    </scales>
+                    <scheme>
+                        <type>opacity</type>
+                        <color>__auto__</color>
+                    </scheme>
+                </scaling>
+            </options>
+        </track>
+        <track cat="Blah" format="blast">
+            <files>
+                <trackFile path="test-data/blastxml/blast.xml" ext="blastxml" label="BlastP, min_gap=3"/>
+            </files>
+
+            <options>
+                <style>
+                    <className>feature</className>
+                    <description></description>
+                    <label>Description</label>
+                    <height>400px</height>
+                </style>
+                <blast>
+                    <parent>test-data/blastxml/merlin.gff</parent>
+                    <protein>true</protein>
+                    <min_gap>3</min_gap>
+                </blast>
+                <scaling>
+                    <method>score</method>
+                    <algo>blast</algo>
+                    <scales>
+                        <type>__auto__</type>
+                    </scales>
+                    <scheme>
+                        <type>opacity</type>
+                        <color>__auto__</color>
+                    </scheme>
+                </scaling>
+            </options>
+        </track>
+
+        <track cat="Blah" format="blast">
+            <files>
+                <trackFile path="test-data/blastxml/blast-gene1.xml" ext="blastxml" label="Non protein match/matchpart"/>
+            </files>
+
+            <options>
+                <style>
+                    <className>feature</className>
+                    <description></description>
+                    <label>Description</label>
+                    <height>400px</height>
+                </style>
+                <blast>
+                    <parent>test-data/blastxml/merlin.gff</parent>
+                    <min_gap>3</min_gap>
+                </blast>
+                <scaling>
+                    <method>ignore</method>
+                    <algo>linear</algo>
+                    <scheme>
+                        <type>opacity</type>
+                        <color>__auto__</color>
+                    </scheme>
+                </scaling>
+            </options>
+        </track>
+
+        <track cat="Blah" format="blast">
+            <files>
+                <trackFile path="test-data/blastxml/blastn-gene1.xml" ext="blastxml" label="Non protein match/matchpart, no parent"/>
+            </files>
+
+            <options>
+                <style>
+                    <className>feature</className>
+                    <description></description>
+                    <label>Description</label>
+                    <height>400px</height>
+                </style>
+                <blast>
+                    <min_gap>40</min_gap>
+                </blast>
+                <scaling>
+                    <method>score</method>
+                    <algo>blast</algo>
+                    <scales>
+                        <type>__auto__</type>
+                    </scales>
+                    <scheme>
+                        <type>opacity</type>
+                        <color>__auto__</color>
+                    </scheme>
+                </scaling>
+            </options>
+        </track>
+
+    </tracks>
+</root>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/bw/test.xml	Tue Jan 09 02:35:52 2024 +0000
@@ -0,0 +1,149 @@
+<?xml version="1.0"?>
+<root>
+    <metadata>
+        <genomes>
+            <genome>test-data/merlin.fa</genome>
+        </genomes>
+        <general>
+            <defaultLocation></defaultLocation>
+            <trackPadding>40</trackPadding>
+            <shareLink>true</shareLink>
+            <aboutDescription></aboutDescription>
+            <show_tracklist>true</show_tracklist>
+            <show_nav>true</show_nav>
+            <show_overview>false</show_overview>
+            <show_menu>true</show_menu>
+            <hideGenomeOptions>false</hideGenomeOptions>
+        </general>
+    </metadata>
+    <tracks>
+        <track cat="Scaling" format="wiggle">
+            <files>
+                <trackFile path="test-data/bw/data.bw" ext="bigwig" label="Auto Global"/>
+            </files>
+
+            <options>
+                <wiggle>
+                    <type>JBrowse/View/Track/Wiggle/XYPlot</type>
+                    <variance_band>true</variance_band>
+                    <autoscale>global</autoscale>
+                    <color_pos>__auto__</color_pos>
+                    <color_neg>__auto__</color_neg>
+                    <bicolor_pivot>zero</bicolor_pivot>
+                    <scale>linear</scale>
+                </wiggle>
+            </options>
+        </track>
+        <track cat="Scaling" format="wiggle">
+            <files>
+                <trackFile path="test-data/bw/data.bw" ext="bigwig" label="Auto Local"/>
+            </files>
+
+            <options>
+                <wiggle>
+                    <type>JBrowse/View/Track/Wiggle/XYPlot</type>
+                    <variance_band>true</variance_band>
+                    <autoscale>local</autoscale>
+                    <color_pos>__auto__</color_pos>
+                    <color_neg>__auto__</color_neg>
+                    <bicolor_pivot>zero</bicolor_pivot>
+                    <scale>linear</scale>
+                </wiggle>
+            </options>
+        </track>
+        <track cat="Scaling" format="wiggle">
+            <files>
+                <trackFile path="test-data/bw/data.bw" ext="bigwig" label="Manual"/>
+            </files>
+
+            <options>
+                <wiggle>
+                    <type>JBrowse/View/Track/Wiggle/XYPlot</type>
+                    <variance_band>false</variance_band>
+                    <autoscale>fixed</autoscale>
+                    <min>20</min>
+                    <max>60</max>
+                    <color_pos>__auto__</color_pos>
+                    <color_neg>__auto__</color_neg>
+                    <bicolor_pivot>zero</bicolor_pivot>
+                    <scale>linear</scale>
+                </wiggle>
+            </options>
+        </track>
+
+
+        <track cat="Colouring" format="wiggle">
+            <files>
+                <trackFile path="test-data/bw/data.bw" ext="bigwig" label="Auto A"/>
+                <trackFile path="test-data/bw/data.bw" ext="bigwig" label="Auto B"/>
+            </files>
+
+            <options>
+                <wiggle>
+                    <type>JBrowse/View/Track/Wiggle/XYPlot</type>
+                    <variance_band>false</variance_band>
+                    <autoscale>local</autoscale>
+
+                    <color_pos>__auto__</color_pos>
+                    <color_neg>__auto__</color_neg>
+                    <bicolor_pivot>mean</bicolor_pivot>
+                    <scale>linear</scale>
+                </wiggle>
+            </options>
+        </track>
+        <track cat="Colouring" format="wiggle">
+            <files>
+                <trackFile path="test-data/bw/data.bw" ext="bigwig" label="Manual"/>
+            </files>
+
+            <options>
+                <wiggle>
+                    <type>JBrowse/View/Track/Wiggle/XYPlot</type>
+                    <variance_band>false</variance_band>
+                    <autoscale>local</autoscale>
+
+                    <color_pos>#0000ff</color_pos>
+                    <color_neg>#ff0000</color_neg>
+                    <bicolor_pivot>mean</bicolor_pivot>
+                    <scale>linear</scale>
+                </wiggle>
+            </options>
+        </track>
+        <track cat="Colouring" format="wiggle">
+            <files>
+                <trackFile path="test-data/bw/data.bw" ext="bigwig" label="Manual - Inverted"/>
+            </files>
+
+            <options>
+                <wiggle>
+                    <type>JBrowse/View/Track/Wiggle/XYPlot</type>
+                    <variance_band>false</variance_band>
+                    <autoscale>local</autoscale>
+
+                    <color_pos>#ff0000</color_pos>
+                    <color_neg>#0000ff</color_neg>
+                    <bicolor_pivot>mean</bicolor_pivot>
+                    <scale>log</scale>
+                </wiggle>
+            </options>
+        </track>
+        <track cat="Colouring" format="wiggle">
+            <files>
+                <trackFile path="test-data/bw/data.bw" ext="bigwig" label="Nonstandard Pivot"/>
+            </files>
+
+            <options>
+                <wiggle>
+                    <type>JBrowse/View/Track/Wiggle/XYPlot</type>
+                    <variance_band>false</variance_band>
+                    <autoscale>local</autoscale>
+
+                    <color_pos>#0000ff</color_pos>
+                    <color_neg>#ff0000</color_neg>
+                    <bicolor_pivot>100</bicolor_pivot>
+                    <scale>linear</scale>
+                </wiggle>
+            </options>
+        </track>
+    </tracks>
+</root>
--- a/test-data/index.html	Mon Jan 08 09:23:19 2024 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <head>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-    <title>JBrowse</title>
-    <link rel="stylesheet" type="text/css" href="css/genome.css">
-</head>
-<body>
-
-    <script type="text/javascript">
-            // jshint unused: false
-            var dojoConfig = {
-                async: true,
-                baseUrl: './src',
-                has: {
-                    'host-node': false // Prevent dojo from being fooled by Electron
-                }
-            };
-            // Move Electron's require out before loading Dojo
-            if(window.process&&process.versions&&process.versions.electron) {
-                window.electronRequire = require;
-                delete window.require;
-            }
-    </script>
-    <script type="text/javascript" src="src/dojo/dojo.js"></script>
-    <script type="text/javascript" src="src/JBrowse/init.js"></script>
-    <script type="text/javascript">
-        window.onerror=function(msg){
-            if( document.body )
-                document.body.setAttribute("JSError",msg);
-        }
-
-        // puts the main Browser object in this for convenience.  feel
-        // free to move it into function scope if you want to keep it
-        // out of the global namespace
-        var JBrowse;
-        require(['JBrowse/Browser', 'dojo/io-query', 'dojo/json' ],
-             function (Browser,ioQuery,JSON) {
-                   // the initial configuration of this JBrowse
-                   // instance
-
-                   // NOTE: this initial config is the same as any
-                   // other JBrowse config in any other file.  this
-                   // one just sets defaults from URL query params.
-                   // If you are embedding JBrowse in some other app,
-                   // you might as well just set this initial config
-                   // to something like { include: '../my/dynamic/conf.json' },
-                   // or you could put the entire
-                   // dynamically-generated JBrowse config here.
-
-                   // parse the query vars in the page URL
-                   var queryParams = ioQuery.queryToObject( window.location.search.slice(1) );
-
-                   var config = {
-                       containerID: "GenomeBrowser",
-
-                       dataRoot: queryParams.data,
-                       queryParams: queryParams,
-                       location: queryParams.loc,
-                       forceTracks: queryParams.tracks,
-                       initialHighlight: queryParams.highlight,
-                       show_nav: queryParams.nav,
-                       show_tracklist: queryParams.tracklist,
-                       show_overview: queryParams.overview,
-                       show_menu: queryParams.menu,
-                       show_tracklabels: queryParams.tracklabels,
-                       highResolutionMode: queryParams.highres,
-                       stores: { url: { type: "JBrowse/Store/SeqFeature/FromConfig", features: [] } },
-                       makeFullViewURL: function( browser ) {
-
-                           // the URL for the 'Full view' link
-                           // in embedded mode should be the current
-                           // view URL, except with 'nav', 'tracklist',
-                           // and 'overview' parameters forced to 1.
-
-                           return browser.makeCurrentViewURL({ nav: 1, tracklist: 1, overview: 1 });
-                       },
-                       updateBrowserURL: true
-                   };
-
-                   //if there is ?addFeatures in the query params,
-                   //define a store for data from the URL
-                   if( queryParams.addFeatures ) {
-                       config.stores.url.features = JSON.parse( queryParams.addFeatures );
-                   }
-
-                   // if there is ?addTracks in the query params, add
-                   // those track configurations to our initial
-                   // configuration
-                   if( queryParams.addTracks ) {
-                       config.tracks = JSON.parse( queryParams.addTracks );
-                   }
-
-                   // if there is ?addStores in the query params, add
-                   // those store configurations to our initial
-                   // configuration
-                   if( queryParams.addStores ) {
-                       config.stores = JSON.parse( queryParams.addStores );
-                   }
-
-                   // create a JBrowse global variable holding the JBrowse instance
-                   JBrowse = new Browser( config );
-        });
-    </script>
-
-  </head>
-
-  <body>
-    <div id="GenomeBrowser" style="height: 100%; width: 100%; padding: 0; border: 0;"></div>
-    <div style="display: none">JBrowseDefaultMainPage</div>
-  </body>
-</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/vcf/test.xml	Tue Jan 09 02:35:52 2024 +0000
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<root>
+    <metadata>
+        <genomes>
+            <genome>test-data/merlin.fa</genome>
+        </genomes>
+        <general>
+            <defaultLocation></defaultLocation>
+            <trackPadding>40</trackPadding>
+            <shareLink>true</shareLink>
+            <aboutDescription></aboutDescription>
+            <show_tracklist>true</show_tracklist>
+            <show_nav>true</show_nav>
+            <show_overview>false</show_overview>
+            <show_menu>true</show_menu>
+            <hideGenomeOptions>false</hideGenomeOptions>
+        </general>
+    </metadata>
+    <tracks>
+        <track cat="Default" format="vcf">
+            <files>
+                <trackFile path="test-data/vcf/test.vcf" ext="vcf" label="Basic"/>
+            </files>
+            <options>
+            </options>
+        </track>
+    </tracks>
+</root>
--- a/tool_data_table_conf.xml.sample	Mon Jan 08 09:23:19 2024 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-<tables>
-    <!-- Locations of all fasta files under genome directory -->
-    <table name="all_fasta" comment_char="#">
-        <columns>value, dbkey, name, path</columns>
-        <file path="tool-data/all_fasta.loc" />
-    </table>
-</tables>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webserver.py	Tue Jan 09 02:35:52 2024 +0000
@@ -0,0 +1,159 @@
+#!/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()