Mercurial > repos > fubar > jbrowse2
changeset 48:460d5b6c5d98 draft
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a-dirty
author | fubar |
---|---|
date | Wed, 06 Mar 2024 10:37:49 +0000 |
parents | 3e53204c2419 |
children | 7e867ff86e44 |
files | autogenJB2.py cert.pem jb2_urlconf.py jb2_webserver.py jbrowse2.py jbrowse2.xml key.pem macros.xml |
diffstat | 8 files changed, 118 insertions(+), 46 deletions(-) [+] |
line wrap: on
line diff
--- a/autogenJB2.py Wed Mar 06 00:23:02 2024 +0000 +++ b/autogenJB2.py Wed Mar 06 10:37:49 2024 +0000 @@ -90,13 +90,14 @@ "style": {}, "style_labels": {}, } - + track_conf = {} listtracks = trackList # foo.paf must have a foo_paf.fasta or fasta.gz to match tnames = [x[2] for x in listtracks] texts = [x[1] for x in listtracks] for i, track in enumerate(listtracks): tpath, trext, trackname = track[:3] + track_conf["dataset_id"] = trackname if trext == "paf": refname = trackname + "_paf.fasta" refdat = [x[2] for x in listtracks if x[2] == refname] @@ -107,13 +108,13 @@ ) sys.exit(3) else: - track_conf = { + track_conf.update({ "conf": { "options": { "paf": {"genome": refdat, "genome_label": trackname} } } - } + }) elif trext == "bam": ipath = track[3] if not os.path.exists(ipath): @@ -121,7 +122,7 @@ cmd = ["samtools", "index", "-b", "-o", ipath, os.path.realpath(track[0])] sys.stdout.write('#### calling %s' % ' '.join(cmd)) jc.subprocess_check_call(cmd) - track_conf = {"conf": {"options": {"bam": {"bam_index": ipath}}}} + track_conf.update({"conf": {"options": {"bam": {"bam_index": ipath}}}}) elif trext == "cram": ipath = track[3] if not os.path.exists(ipath): @@ -130,9 +131,8 @@ cmd = ["samtools", "index", "-c", "-o", ipath, os.path.realpath(track[0])] sys.stdout.write('#### calling %s' % ' '.join(cmd)) jc.subprocess_check_call(cmd) - track_conf = {"conf": {"options": {"cram": {"cram_index": ipath}}}} - else: - track_conf = {} + track_conf.update({"conf": {"options": {"cram": {"cram_index": ipath}}}}) + track_conf["path"] = tpath track_conf["format"] = trext track_conf["name"] = trackname track_conf["label"] = trackname @@ -140,9 +140,9 @@ useuri = 'no' if useu: useuri = 'yes' - track_conf["trackfiles"] = [ - (tpath, trext, useuri, trackname, {}), - ] + track_conf["trackfiles"] = [ + (tpath, trext, useuri, trackname, {}), + ] track_conf["category"] = "Autogenerated" keys = jc.process_annotations(track_conf)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cert.pem Wed Mar 06 10:37:49 2024 +0000 @@ -0,0 +1,22 @@ +-----BEGIN CERTIFICATE----- +MIIDkzCCAnugAwIBAgIUPkTIC1+gbjdym20znN2BGDFoqywwDQYJKoZIhvcNAQEL +BQAwWTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM +GEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDESMBAGA1UEAwwJMTI3LjAuMC4xMB4X +DTI0MDMwNjAxMjk0NVoXDTI1MDMwNjAxMjk0NVowWTELMAkGA1UEBhMCQVUxEzAR +BgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoMGEludGVybmV0IFdpZGdpdHMgUHR5 +IEx0ZDESMBAGA1UEAwwJMTI3LjAuMC4xMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A +MIIBCgKCAQEAz3FqW3iKpF7PhAwPXL7H6EvkbGgI5yoYhKqFmBHSjR2CC9sGCx62 +U/PZKkckFZO5gwYyrZ5DVYFjMlQjw7XsekuDGkHhCRWU7iLQDj+7KZZM+kjIfzb7 +LXcmkq5MnbsxdaSZrJ9rr+stczVqTdmY/WSdwz9areNsziSugiuk3G6IwqONgrW+ +uFVByiC6SDp3Wfk7X5KooI/iWVYZlDkO4lDFJ1je3g/MutCQ8pNh7q/XxYcnjonH +bWR/01HXuwrUI2cyzPS3Ngk9J6RRCxRlfurf5bgh5m0H4ThA8krEULR1xAoFjCGZ +Zw/1p2CtoaqRMsaemuUx/kjfXov9bCD45wIDAQABo1MwUTAdBgNVHQ4EFgQUXblV +0dWUZEBKMrR9POoZaP3THGEwHwYDVR0jBBgwFoAUXblV0dWUZEBKMrR9POoZaP3T +HGEwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAlTkK79w3db8H +7h0AvKs+rQxECjG3jgMvnFTUvFc6UBULIgnHmLcBUgeSQGWByo7bMildtcEbV1uk +rvPlNaferhgIilzKi6L9Enk7ji3sSkmFYLJWZitf2n0tx1uK5I3udxRQQDa8Ah65 +6HNOr3Cfz9bY2rUfVuYjRYvtQq/m4a9WFSG+ZzCpRU87H9EcPU3DymJt8hBD+f++ +WgPXRRrIslUB/h/MnUxK5tFQwHxk+gj9nOyvGXdG64kUZxhKMzc9Gk5iaXplG3hY +RfFo47gsuFh2ycHLapKavYbuELYpjziSj9rn/GdnT6RmWQ7ay5j8vmoEElg0bLDx +xG190t5wBQ== +-----END CERTIFICATE-----
--- a/jb2_urlconf.py Wed Mar 06 00:23:02 2024 +0000 +++ b/jb2_urlconf.py Wed Mar 06 10:37:49 2024 +0000 @@ -1,6 +1,6 @@ inconf = open('config.json', 'r').readlines() with open('config.json.local', 'w') as bak: - bak.write('\n'.join(inconf)) + bak.write(''.join(inconf)) urlbase = "https://galaxy.genomicsvl-students.cloud.edu.au/jbrowse/hum/" utag = '"uri":' for i, row in enumerate(inconf): @@ -10,7 +10,7 @@ parth = row.split(utag)[1].strip() inconf[i] = '%s%s' % (urlbase, parth) with open('config.json', 'w') as outconf: - outconf.write('\n'.join(inconf)) + outconf.write(''.join(inconf))
--- a/jb2_webserver.py Wed Mar 06 00:23:02 2024 +0000 +++ b/jb2_webserver.py Wed Mar 06 10:37:49 2024 +0000 @@ -38,11 +38,12 @@ import os import re import socketserver +import ssl import webbrowser from http.server import SimpleHTTPRequestHandler -DEFAULT_PORT = 8081 +DEFAULT_PORT = 8443 def copy_byte_range(infile, outfile, start=None, stop=None, bufsize=16 * 1024): @@ -153,6 +154,17 @@ 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( @@ -171,17 +183,17 @@ ) parser.add_argument( "--bind", - default="0.0.0.0", - help="IP address to bind to (default: 0.0.0.0)", + default="127.0.0.1", + help="IP address to bind to (default: 127.0.0.1)", ) args = parser.parse_args() handler = functools.partial(RangeRequestHandler, directory=args.root) - webbrowser.open(f"http://{args.bind}:{args.port}") + webbrowser.open(f"https://{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}/)" + f"Serving HTTPS on {args.bind} port {args.port} (https://{args.bind}:{args.port}/)" ) httpd.serve_forever()
--- a/jbrowse2.py Wed Mar 06 00:23:02 2024 +0000 +++ b/jbrowse2.py Wed Mar 06 10:37:49 2024 +0000 @@ -1148,6 +1148,8 @@ outputTrackConfig["key"] = track_human_label outputTrackConfig["useuri"] = useuri + outputTrackConfig["path"] = dataset_path + outputTrackConfig["ext"] = dataset_ext outputTrackConfig["trackset"] = track.get("trackset", {}) outputTrackConfig["label"] = "%s_%i_%s" % (
--- a/jbrowse2.xml Wed Mar 06 00:23:02 2024 +0000 +++ b/jbrowse2.xml Wed Mar 06 10:37:49 2024 +0000 @@ -138,7 +138,18 @@ <tracks> #for $tg in $track_groups: #for $track in $tg.data_tracks: - #if $track.data_format.useuri.insource == "history": + #if $track.data_format.useuri.insource == "uri": + <track cat="${tg.category}" format="${track.data_format.data_format_select}" visibility="${track.data_format.track_visibility}"> + <files> + <trackFile path="${track.data_format.useuri.annouri}" ext="${track.data_format.data_format_select}" label="${track.data_format.useuri.annoname}" useuri="yes"> + <metadata> + <dataset id = "${track.data_format.useuri.annouri}" /> + </metadata> + </trackFile> + </files> + <options/> + </track> + #else if $track.data_format.useuri.insource == "history": #if $track.data_format.useuri.annotation: <track cat="${tg.category}" format="${track.data_format.data_format_select}" visibility="${track.data_format.track_visibility}"> <files> @@ -204,7 +215,7 @@ <protein>${track.data_format.is_protein}</protein> <min_gap>${track.data_format.min_gap}</min_gap> </blast> - #else if str($track.data_format.data_format_select) == "gene_calls": + #else if str($track.data_format.data_format_select) == "gff": <gff> #if $track.data_format.match_part.match_part_select == "true": <match>${track.data_format.match_part.name}</match> @@ -229,6 +240,9 @@ #else if str($track.data_format.data_format_select) == "cool": <cool> </cool> + #else if str($track.data_format.data_format_select) == "bed": + <bed> + </bed> #else if str($track.data_format.data_format_select) == "sparql": <label>${track.data_format.label}</label> <sparql> @@ -240,17 +254,6 @@ </options> </track> #end if - #else if track.data_format.useuri.annouri: - <track cat="${tg.category}" format="${track.data_format.data_format_select}" visibility="${track.data_format.track_visibility}"> - <files> - <trackFile path="${track.data_format.useuri.annouri}" ext="${track.data_format.data_format_select}" label="${track.data_format.useuri.annoname}" useuri="yes"> - <metadata> - <dataset id = "${track.data_format.useuri.annouri}" /> - </metadata> - </trackFile> - </files> - <options/> - </track> #end if #end for #end for @@ -312,11 +315,12 @@ <conditional name="data_format" label="Track Data Selection Options"> <param type="select" label="Track Type" name="data_format_select"> <option value="bam">BAM Pileup track</option> + <option value="bed">BED track</option> <option value="bigwig">BigWig track</option> <option value="blastxml">Blast XML track - converted to GFF</option> <option value="cool">HiC as cool/mcool/scool format files</option> <option value="cram">CRAM</option> - <option value="gene_calls" selected="true">GFF/GFF3/BED feature track</option> + <option value="gff" selected="true">GFF/GFF3 feature track</option> <option value="hic">HiC as juicebox_hic format file. Tabular hic_matrix will NOT work.</option> <option value="maf">Multiple alignment format. Reference name must match the MAF name exactly to work correctly</option> <option value="paf">PAF - approximate mapping positions between two set of sequences</option> @@ -350,8 +354,8 @@ <expand macro="track_styling_vcf"/> <expand macro="track_visibility" /> </when> - <when value="gene_calls"> - <expand macro="input_conditional" label="GFF/GFF3/BED Track Data" format="gff,gff3,bed" /> + <when value="gff"> + <expand macro="input_conditional" label="GFF/GFF3 Track Data" format="gff,gff3" /> <conditional name="match_part" label="match/match_part data"> <param help="Match part data selection " label="This is match/match_part data" name="match_part_select" type="select"> <option selected="True" value="false">Not match/match part data</option> @@ -373,6 +377,10 @@ <expand macro="input_conditional" label="BAM Track Data" format="bam" /> <expand macro="track_visibility" /> </when> + <when value="bed"> + <expand macro="input_conditional" label="BED Track Data" format="bed" /> + <expand macro="track_visibility" /> + </when> <when value="cram"> <expand macro="input_conditional" label="CRAM Track Data" format="cram" /> <expand macro="track_visibility" /> @@ -497,7 +505,7 @@ <param name="category" value="Default" /> <repeat name="data_tracks"> <conditional name="data_format"> - <param name="data_format_select" value="gene_calls"/> + <param name="data_format_select" value="bed"/> <conditional name="useuri"> <param name="insource" value="history"/> <param name="annotation" value="bed/test-3.bed"/> @@ -525,7 +533,7 @@ <param name="category" value="Auto Coloured" /> <repeat name="data_tracks"> <conditional name="data_format"> - <param name="data_format_select" value="gene_calls"/> + <param name="data_format_select" value="gff"/> <conditional name="useuri"> <param name="insource" value="history"/> <param name="annotation" value="gff3/A.gff"/> @@ -549,7 +557,7 @@ <param name="category" value="Ignore Scale" /> <repeat name="data_tracks"> <conditional name="data_format"> - <param name="data_format_select" value="gene_calls"/> + <param name="data_format_select" value="gff"/> <conditional name="useuri"> <param name="insource" value="history"/> <param name="annotation" value="gff3/1.gff"/> @@ -574,7 +582,7 @@ <param name="category" value="Scaled Colour" /> <repeat name="data_tracks"> <conditional name="data_format"> - <param name="data_format_select" value="gene_calls"/> + <param name="data_format_select" value="gff"/> <conditional name="useuri"> <param name="insource" value= "history"/> <param name="annotation" value="gff3/C.gff"/> @@ -601,7 +609,7 @@ </repeat> <repeat name="data_tracks"> <conditional name="data_format"> - <param name="data_format_select" value="gene_calls"/> + <param name="data_format_select" value="gff"/> <conditional name="useuri"> <param name="annotation" value="gff3/B.gff"/> <param name="insource" value= "history"/> @@ -629,7 +637,7 @@ </repeat> <repeat name="data_tracks"> <conditional name="data_format"> - <param name="data_format_select" value="gene_calls"/> + <param name="data_format_select" value="gff"/> <conditional name="useuri"> <param name="annotation" value="gff3/A.gff"/> <param name="insource" value= "history"/> @@ -658,7 +666,7 @@ </repeat> <repeat name="data_tracks"> <conditional name="data_format"> - <param name="data_format_select" value="gene_calls"/> + <param name="data_format_select" value="gff"/> <conditional name="useuri"> <param name="annotation" value="gff3/1.gff"/> <param name="insource" value= "history"/> @@ -692,7 +700,7 @@ <param name="category" value="Realistic" /> <repeat name="data_tracks"> <conditional name="data_format"> - <param name="data_format_select" value="gene_calls"/> + <param name="data_format_select" value="gff"/> <conditional name="useuri"> <param name="annotation" value="gff3/interpro.gff"/> <param name="insource" value= "history"/> @@ -712,7 +720,7 @@ </repeat> <repeat name="data_tracks"> <conditional name="data_format"> - <param name="data_format_select" value="gene_calls"/> + <param name="data_format_select" value="gff"/> <conditional name="useuri"> <param name="annotation" value="gff3/2.gff"/> <param name="insource" value= "history"/> @@ -755,7 +763,7 @@ <param name="category" value="With menu or index" /> <repeat name="data_tracks"> <conditional name="data_format"> - <param name="data_format_select" value="gene_calls"/> + <param name="data_format_select" value="gff"/> <conditional name="useuri"> <param name="annotation" value="gff3/1.gff"/> <param name="insource" value= "history"/> @@ -790,7 +798,7 @@ </repeat> <repeat name="data_tracks"> <conditional name="data_format"> - <param name="data_format_select" value="gene_calls"/> + <param name="data_format_select" value="gff"/> <conditional name="useuri"> <param name="annotation" value="gff3/1.gff"/> <param name="insource" value= "history"/> @@ -815,7 +823,7 @@ <output name="output"> <assert_contents> <has_text text="With menu or index"/> - <has_text text="gene_calls"/> + <has_text text="gff"/> </assert_contents> </output> </test>
--- /dev/null Thu Jan 01 00:00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GsnVVT82w3YwsNsgG0RYmtBDOtEoQKxLDVoUNeidkbVd3vRCX/U9nwMebz +XrSEpve5nO9ShIY6fVrVEqnHWz/swy4XaGxtj1nAApf4TUBGH6/bN6BL/ylMLS65 +0OvfAAkexwKBgF/r94xVKTzwCqKN16tv1L8fT9hH0m7AcRmB0pvumarkVi+yLq3i +zsYC1b9MvvV/JQUbqUzcSTfVM68ZC00mZi7JzJqE+ch1xVNL99OQIFbgXFS15RWQ +tfd3npD4kBXnye0qFJMtTyldZnYlZ7hY7hDSkYz4kPyOw9jOPt4b9kSBAoGAAf7n +QuhwLJBh/Ok9GjDN/XhD/kz7rsFbZE2tav8PDkJYAvn2dvgbrL+ZwIpAakH185iP +ZELFouFq8ETCqL3B43l0Gt5C3UK7/GdTs0aaZ0qUAuZ7F6cE66zHq7qz+p1HnLVD +Ai8wHOBpbNPe3kuCscPvY4lCbRSost7GvlETxRUCgYEA2MBujMY9zGTMbxkJX0YT +d1qRr24vD+81rsmjg08XYxBf8GgApH/IdSF73JOyUTxpHJA1lFRWgtrE9+jsKuhS +HsghgDZZ8a0Qh4qqPgRq0cd5PqZbuE3eX+ox/dh5K9LHWu22IqjabGt6n2SPlWgr +wmJiknbrsHBnrnsPNIUweM0= +-----END PRIVATE KEY-----
--- a/macros.xml Wed Mar 06 00:23:02 2024 +0000 +++ b/macros.xml Wed Mar 06 10:37:49 2024 +0000 @@ -528,7 +528,7 @@ <param label="@LABEL@" format="@FORMAT@" name="annotation" multiple="True" optional="true" type="data" /> </when> <when value="uri"> - <param label="@LABEL@" name="annouri" multiple="false" type="text" /> + <param label="@LABEL@" name="annouri" type="text" /> <param label="Short name for track display" name="annoname" type="text" > <sanitizer invalid_char="_"> <valid initial="string.printable" >