changeset 50:f350467f9433 draft

planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
author fubar
date Thu, 07 Mar 2024 04:51:43 +0000
parents 7e867ff86e44
children e18f2d6c4dbe
files jb2_webserver.py jbrowse2.py klBraLanc5.haps_combined.decontam.20230620.fasta.fa.gz more readme.rst
diffstat 5 files changed, 61 insertions(+), 200 deletions(-) [+]
line wrap: on
line diff
--- a/jb2_webserver.py	Thu Mar 07 00:27:48 2024 +0000
+++ b/jb2_webserver.py	Thu Mar 07 04:51:43 2024 +0000
@@ -38,12 +38,11 @@
 import os
 import re
 import socketserver
-import ssl
 import webbrowser
 from http.server import SimpleHTTPRequestHandler
 
 
-DEFAULT_PORT = 8443
+DEFAULT_PORT = 8081
 
 
 def copy_byte_range(infile, outfile, start=None, stop=None, bufsize=16 * 1024):
@@ -154,17 +153,6 @@
 class ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
     allow_reuse_address = True
 
-    def server_bind(self):
-        ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
-        ctx.load_cert_chain('cert.pem', 'key.pem')
-        socketserver.TCPServer.server_bind(self)
-        self.socket = ctx.wrap_socket(  self.socket, server_hostname = "127.0.0.1", server_side=False,)
-
-
-    def get_request(self):
-        (socket, addr) = socketserver.TCPServer.get_request(self)
-        socket.do_handshake()
-        return (socket, addr)
 
 if __name__ == "__main__":
     parser = argparse.ArgumentParser(
@@ -184,16 +172,16 @@
     parser.add_argument(
         "--bind",
         default="127.0.0.1",
-        help="IP address to bind to (default: 127.0.0.1)",
+        help="IP address to bind to (default: 127.0.0.1 - use 0.0.0.0 to allow access on your network)",
     )
     args = parser.parse_args()
 
     handler = functools.partial(RangeRequestHandler, directory=args.root)
 
-    webbrowser.open(f"https://{args.bind}:{args.port}")
+    webbrowser.open(f"http://{args.bind}:{args.port}")
 
     with ThreadedTCPServer((args.bind, args.port), handler) as httpd:
         print(
-            f"Serving HTTPS on {args.bind} port {args.port} (https://{args.bind}:{args.port}/)"
+            f"Serving HTTP on {args.bind} port {args.port} (http://{args.bind}:{args.port}/)"
         )
         httpd.serve_forever()
--- a/jbrowse2.py	Thu Mar 07 00:27:48 2024 +0000
+++ b/jbrowse2.py	Thu Mar 07 04:51:43 2024 +0000
@@ -602,23 +602,17 @@
         useuri = trackData["useuri"].lower() == "yes"
         if useuri:
             uri = data
-            adapt = {
-                "type": "HicAdapter",
-                "hicLocation": uri,
-                "locationType": "UriLocation",
-            },
         else:
             uri = trackData["hic_url"]
-            adapt = {
-                "type": "HicAdapter",
-                "hicLocation": uri,
-            },
         trackDict = {
             "type": "HicTrack",
             "trackId": tId,
             "name": uri,
             "assemblyNames": [self.genome_name],
-            "adapter":  adapt,
+            "adapter": {
+                "type": "HicAdapter",
+                "hicLocation": uri,
+            },
             "displays": [
                 {
                     "type": "LinearHicDisplay",
@@ -787,21 +781,13 @@
         useuri = trackData["useuri"].lower() == "yes"
         if useuri:
             url = data
-            adapt = {
-                "type": "BigWigAdapter",
-                "bigWigLocation": {"uri": url},
-                "locationType": "UriLocation",
-            }
         else:
             url = "%s.bigwig" % trackData["label"]
             # slashes in names cause path trouble
             dest = os.path.join(self.outdir, url)
             cmd = ["cp", data, dest]
             self.subprocess_check_call(cmd)
-            adapt = {
-                "type": "BigWigAdapter",
-                "bigWigLocation": {"uri": url},
-            }
+        bwloc = {"uri": url}
         tId = trackData["label"]
         trackDict = {
             "type": "QuantitativeTrack",
@@ -810,7 +796,10 @@
             "assemblyNames": [
                 self.genome_name,
             ],
-            "adapter":  adapt,
+            "adapter": {
+                "type": "BigWigAdapter",
+                "bigWigLocation": bwloc,
+            },
             "displays": [
                 {
                     "type": "LinearWiggleDisplay",
@@ -829,31 +818,12 @@
         bindex = bam_index
         if useuri:
             url = data
-            adapt =  {
-                "type": "BamAdapter",
-                "bamLocation": {"uri": url},
-                "index": {
-                    "location": {
-                        "uri": bindex,
-                       "locationType": "UriLocation",
-                       }
-                }
-            }
         else:
             fname = "%s.bam" % trackData["label"]
             dest = "%s/%s" % (self.outdir, fname)
             url = fname
             bindex = fname + '.bai'
             self.subprocess_check_call(["cp", data, dest])
-            adapt =  {
-                "type": "BamAdapter",
-                "bamLocation": {"uri": url},
-                "index": {
-                    "location": {
-                        "uri": bindex,
-                       }
-                    }
-                }
             if bam_index is not None and os.path.exists(bam_index):
                 if not os.path.exists(bindex):
                     # bai most probably made by galaxy and stored in galaxy dirs, need to copy it to dest
@@ -874,7 +844,15 @@
             "trackId": tId,
             "name": trackData["name"],
             "assemblyNames": [self.genome_name],
-            "adapter": adapt,
+            "adapter": {
+                "type": "BamAdapter",
+                "bamLocation": {"uri": url},
+                "index": {
+                    "location": {
+                        "uri": bindex,
+                    }
+                },
+            },
             "displays": [
                 {
                     "type": "LinearAlignmentsDisplay",
@@ -893,29 +871,13 @@
         bindex = cram_index
         if useuri:
             url = data
-            adapt =  {
-                "type": "CramAdapter",
-                "cramLocation": {"uri": url},
-                "craiLocation": {
-                    "uri": bindex,
-                    "locationType": "UriLocation",
-                },
-                "sequenceAdapter": self.genome_sequence_adapter,
-               }
         else:
             fname = "%s.cram" % trackData["label"]
             dest = "%s/%s" % (self.outdir, fname)
             bindex = fname + '.bai'
             url = fname
             self.subprocess_check_call(["cp", data, dest])
-            adapt =  {
-                "type": "CramAdapter",
-                "cramLocation": {"uri": url},
-                "craiLocation": {
-                    "uri": bindex,
-                },
-                "sequenceAdapter": self.genome_sequence_adapter,
-               }
+
             if bindex is not None and os.path.exists(bindex):
                 if not os.path.exists(dest+'.crai'):
                     # most probably made by galaxy and stored in galaxy dirs, need to copy it to dest
@@ -938,7 +900,14 @@
             "trackId": tId,
             "name": trackData["name"],
             "assemblyNames": [self.genome_name],
-            "adapter": adapt,
+            "adapter": {
+                "type": "CramAdapter",
+                "cramLocation": {"uri": url},
+                "craiLocation": {
+                    "uri": bindex,
+                },
+                "sequenceAdapter": self.genome_sequence_adapter,
+            },
             "displays": [
                 {
                     "type": "LinearAlignmentsDisplay",
@@ -961,19 +930,6 @@
         useuri = trackData["useuri"].lower() == "yes"
         if useuri:
             url = data
-            adapt = {
-                "type": "VcfTabixAdapter",
-                "vcfGzLocation": {
-                    "uri": url,
-                    "locationType": "UriLocation",
-                },
-                "index": {
-                    "location": {
-                        "uri": url + ".tbi",
-                        "locationType": "UriLocation",
-                    }
-                },
-            },
         else:
             url = "%s.vcf.gz" % tId
             dest = "%s/%s" % (self.outdir, url)
@@ -981,7 +937,12 @@
             self.subprocess_popen(cmd)
             cmd = ["tabix", "-f", "-p", "vcf", dest]
             self.subprocess_check_call(cmd)
-            adapt = {
+        trackDict = {
+            "type": "VariantTrack",
+            "trackId": tId,
+            "name": trackData["name"],
+            "assemblyNames": [self.genome_name],
+            "adapter": {
                 "type": "VcfTabixAdapter",
                 "vcfGzLocation": {
                     "uri": url
@@ -991,13 +952,7 @@
                         "uri": url + ".tbi",
                     }
                 },
-            }
-        trackDict = {
-            "type": "VariantTrack",
-            "trackId": tId,
-            "name": trackData["name"],
-            "assemblyNames": [self.genome_name],
-            "adapter": adapt,
+            },
             "displays": [
                 {
                     "type": "LinearVariantDisplay",
@@ -1040,24 +995,17 @@
         useuri = trackData["useuri"].lower() == "yes"
         if useuri:
             url = trackData["path"]
-            adapter = {
-                "type": "Gff3TabixAdapter",
-                "gffGzLocation": {
-                    "uri": url,
-                    "locationType": "UriLocation",
-                },
-                "index": {
-                    "location": {
-                        "uri": url + ".tbi",
-                        "locationType": "UriLocation",
-                    }
-                },
-            }
         else:
             url = "%s.%s.gz" % (trackData["label"], ext)
             dest = "%s/%s" % (self.outdir, url)
             self._sort_gff(data, dest)
-            adapter = {
+        tId = trackData["label"]
+        trackDict = {
+            "type": "FeatureTrack",
+            "trackId": tId,
+            "name": trackData["name"],
+            "assemblyNames": [self.genome_name],
+            "adapter": {
                 "type": "Gff3TabixAdapter",
                 "gffGzLocation": {
                     "uri": url,
@@ -1067,14 +1015,7 @@
                         "uri": url + ".tbi",
                     }
                 },
-            }
-        tId = trackData["label"]
-        trackDict = {
-            "type": "FeatureTrack",
-            "trackId": tId,
-            "name": trackData["name"],
-            "assemblyNames": [self.genome_name],
-            "adapter": adapt,
+            },
             "displays": [
                 {
                     "type": "LinearBasicDisplay",
@@ -1096,24 +1037,16 @@
         useuri = trackData["useuri"].lower() == "yes"
         if useuri:
             url = data
-            adapt = {
-                "type": "BedTabixAdapter",
-                "bedGzLocation": {
-                    "uri": url,
-                    "locationType": "UriLocation",
-                },
-                "index": {
-                    "location": {
-                        "uri": url + ".tbi",
-                        "locationType": "UriLocation",
-                    }
-                },
-            }
         else:
             url = "%s.%s.gz" % (trackData["label"], ext)
             dest = "%s/%s" % (self.outdir, url)
             self._sort_bed(data, dest)
-            adapt = {
+        trackDict = {
+            "type": "FeatureTrack",
+            "trackId": tId,
+            "name": trackData["name"],
+            "assemblyNames": [self.genome_name],
+            "adapter": {
                 "type": "BedTabixAdapter",
                 "bedGzLocation": {
                     "uri": url,
@@ -1123,13 +1056,7 @@
                         "uri": url + ".tbi",
                     }
                 },
-            }
-        trackDict = {
-            "type": "FeatureTrack",
-            "trackId": tId,
-            "name": trackData["name"],
-            "assemblyNames": [self.genome_name],
-            "adapter": adapt,
+            },
             "displays": [
                 {
                     "type": "LinearBasicDisplay",
@@ -1179,7 +1106,11 @@
             "trackId": tId,
             "assemblyNames": passnames,
             "name": tname,
-            "adapter": adapt,
+            "adapter": {
+                "type": "PAFAdapter",
+                "pafLocation": {"uri": url},
+                "assemblyNames": passnames,
+            },
             # "displays": [
             # {
             # "type": "LinearSyntenyDisplay",
Binary file klBraLanc5.haps_combined.decontam.20230620.fasta.fa.gz has changed
--- a/more	Thu Mar 07 00:27:48 2024 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-jbrowse2.py:2:80: E501 line too long (94 > 79 characters)
-jbrowse2.py:84:80: E501 line too long (124 > 79 characters)
-jbrowse2.py:85:80: E501 line too long (83 > 79 characters)
-jbrowse2.py:88:80: E501 line too long (83 > 79 characters)
-jbrowse2.py:102:80: E501 line too long (86 > 79 characters)
-jbrowse2.py:234:80: E501 line too long (87 > 79 characters)
-jbrowse2.py:261:80: E501 line too long (84 > 79 characters)
-jbrowse2.py:266:80: E501 line too long (84 > 79 characters)
-jbrowse2.py:267:80: E501 line too long (85 > 79 characters)
-jbrowse2.py:275:80: E501 line too long (85 > 79 characters)
-jbrowse2.py:283:80: E501 line too long (85 > 79 characters)
-jbrowse2.py:295:80: E501 line too long (84 > 79 characters)
-jbrowse2.py:348:80: E501 line too long (87 > 79 characters)
-jbrowse2.py:351:80: E501 line too long (83 > 79 characters)
-jbrowse2.py:357:80: E501 line too long (107 > 79 characters)
-jbrowse2.py:367:80: E501 line too long (118 > 79 characters)
-jbrowse2.py:392:80: E501 line too long (82 > 79 characters)
-jbrowse2.py:461:80: E501 line too long (80 > 79 characters)
-jbrowse2.py:554:80: E501 line too long (101 > 79 characters)
-jbrowse2.py:558:80: E501 line too long (90 > 79 characters)
-jbrowse2.py:560:80: E501 line too long (94 > 79 characters)
-jbrowse2.py:562:80: E501 line too long (94 > 79 characters)
-jbrowse2.py:563:80: E501 line too long (123 > 79 characters)
-jbrowse2.py:597:80: E501 line too long (133 > 79 characters)
-jbrowse2.py:605:80: E501 line too long (124 > 79 characters)
-jbrowse2.py:624:80: E501 line too long (87 > 79 characters)
-jbrowse2.py:783:80: E501 line too long (81 > 79 characters)
-jbrowse2.py:784:80: E501 line too long (97 > 79 characters)
-jbrowse2.py:790:80: E501 line too long (102 > 79 characters)
-jbrowse2.py:791:80: E501 line too long (101 > 79 characters)
-jbrowse2.py:792:80: E501 line too long (99 > 79 characters)
-jbrowse2.py:794:80: E501 line too long (84 > 79 characters)
-jbrowse2.py:830:80: E501 line too long (83 > 79 characters)
-jbrowse2.py:831:80: E501 line too long (93 > 79 characters)
-jbrowse2.py:837:80: E501 line too long (102 > 79 characters)
-jbrowse2.py:838:80: E501 line too long (101 > 79 characters)
-jbrowse2.py:839:80: E501 line too long (99 > 79 characters)
-jbrowse2.py:841:80: E501 line too long (86 > 79 characters)
-jbrowse2.py:843:80: E501 line too long (81 > 79 characters)
-jbrowse2.py:925:80: E501 line too long (82 > 79 characters)
-jbrowse2.py:1126:80: E501 line too long (84 > 79 characters)
-jbrowse2.py:1193:80: E501 line too long (81 > 79 characters)
-jbrowse2.py:1206:80: E501 line too long (80 > 79 characters)
-jbrowse2.py:1243:80: E501 line too long (146 > 79 characters)
-jbrowse2.py:1245:80: E501 line too long (83 > 79 characters)
-jbrowse2.py:1260:80: E501 line too long (123 > 79 characters)
-jbrowse2.py:1295:80: E501 line too long (107 > 79 characters)
-jbrowse2.py:1301:80: E501 line too long (106 > 79 characters)
-jbrowse2.py:1309:80: E501 line too long (80 > 79 characters)
-jbrowse2.py:1314:80: E501 line too long (87 > 79 characters)
-jbrowse2.py:1347:80: E501 line too long (82 > 79 characters)
-jbrowse2.py:1354:80: E501 line too long (80 > 79 characters)
-jbrowse2.py:1408:80: E501 line too long (86 > 79 characters)
-jbrowse2.py:1432:80: E501 line too long (117 > 79 characters)
-jbrowse2.py:1494:80: E501 line too long (94 > 79 characters)
-jbrowse2.py:1504:80: E501 line too long (88 > 79 characters)
-jbrowse2.py:1517:80: E501 line too long (86 > 79 characters)
-jbrowse2.py:1549:80: E501 line too long (80 > 79 characters)
--- a/readme.rst	Thu Mar 07 00:27:48 2024 +0000
+++ b/readme.rst	Thu Mar 07 04:51:43 2024 +0000
@@ -2,9 +2,9 @@
 ==================
 
 Added Mar 3:
-- optional tracks at last for JB2
-    - dotted noodles from optional inputs now ignored without harm
-- autogenJB2.
+ - optional tracks at last for JB2
+ - dotted noodles from optional inputs now ignored without harm
+ - autogenJB2.
     - Takes a collection of bam/vcf etc and turns them into tracks in a normal JB2 history item.
     - Uses the JbrowseConnector, but the XML tool drives it from the contents of the collection.
     - Collection can be built from any source or with optional noodles in a WF