annotate jbrowse2.py @ 81:e9bcbed05108 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f-dirty
author fubar
date Wed, 03 Apr 2024 01:25:22 +0000
parents dff27c9f6d72
children 746eae952c18
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1 #!/usr/bin/env python
60
81d535970196 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 403a35e1245fa5e62f4be6116a725b9e4d9c353a
fubar
parents: 59
diff changeset
2
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
3 import argparse
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
4 import binascii
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
5 import datetime
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
6 import json
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
7 import logging
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
8 import os
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
9 import re
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
10 import shutil
73
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
11 import ssl
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
12 import struct
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
13 import subprocess
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
14 import tempfile
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
15 import urllib.request
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
16 import xml.etree.ElementTree as ET
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
17 from collections import defaultdict
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
18
65
c81902830900 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 6dac6d6debf44c68eae2785e926fb8420f76958e
fubar
parents: 64
diff changeset
19 logging.basicConfig(level=logging.DEBUG)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
20 log = logging.getLogger("jbrowse")
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
21
56
c0097a584a8a planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674
fubar
parents: 55
diff changeset
22 JB2VER = "v2.10.3"
80
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
23 # version pinned if cloning - but not cloning now
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
24
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
25 TODAY = datetime.datetime.now().strftime("%Y-%m-%d")
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
26 SELF_LOCATION = os.path.dirname(os.path.realpath(__file__))
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
27 GALAXY_INFRASTRUCTURE_URL = None
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
28 mapped_chars = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
29 ">": "__gt__",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
30 "<": "__lt__",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
31 "'": "__sq__",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
32 '"': "__dq__",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
33 "[": "__ob__",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
34 "]": "__cb__",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
35 "{": "__oc__",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
36 "}": "__cc__",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
37 "@": "__at__",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
38 "#": "__pd__",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
39 "": "__cn__",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
40 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
41
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
42
73
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
43 INDEX_TEMPLATE = """<!doctype html>
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
44 <html lang="en" style="height:100%">
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
45 <head>
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
46 <meta charset="utf-8"/>
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
47 <link rel="shortcut icon" href="./favicon.ico"/>
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
48 <meta name="viewport" content="width=device-width,initial-scale=1"/>
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
49 <meta name="theme-color" content="#000000"/>
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
50 <meta name="description" content="A fast and flexible genome browser"/>
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
51 <link rel="manifest" href="./manifest.json"/>
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
52 <title>JBrowse</title>
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
53 </script>
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
54 </head>
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
55 <body style="overscroll-behavior:none; height:100%; margin: 0;">
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
56 <iframe
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
57 id="jbframe"
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
58 title="JBrowse2"
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
59 frameborder="0"
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
60 width="100%"
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
61 height="100%"
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
62 src='index_noview.html?config=config.json__SESSION_SPEC__'>
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
63 </iframe>
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
64 </body>
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
65 </html>
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
66 """
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
67
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
68
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
69 class ColorScaling(object):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
70
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
71 COLOR_FUNCTION_TEMPLATE = """
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
72 function(feature, variableName, glyphObject, track) {{
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
73 var score = {score};
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
74 {opacity}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
75 return 'rgba({red}, {green}, {blue}, ' + opacity + ')';
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
76 }}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
77 """
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
78
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
79 COLOR_FUNCTION_TEMPLATE_QUAL = r"""
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
80 function(feature, variableName, glyphObject, track) {{
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
81 var search_up = function self(sf, attr){{
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
82 if(sf.get(attr) !== undefined){{
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
83 return sf.get(attr);
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
84 }}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
85 if(sf.parent() === undefined) {{
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
86 return;
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
87 }}else{{
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
88 return self(sf.parent(), attr);
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
89 }}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
90 }};
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
91
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
92 var search_down = function self(sf, attr){{
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
93 if(sf.get(attr) !== undefined){{
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
94 return sf.get(attr);
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
95 }}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
96 if(sf.children() === undefined) {{
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
97 return;
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
98 }}else{{
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
99 var kids = sf.children();
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
100 for(var child_idx in kids){{
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
101 var x = self(kids[child_idx], attr);
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
102 if(x !== undefined){{
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
103 return x;
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
104 }}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
105 }}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
106 return;
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
107 }}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
108 }};
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
109
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
110 var color = ({user_spec_color} || search_up(feature, 'color') || search_down(feature, 'color') || {auto_gen_color});
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
111 var score = (search_up(feature, 'score') || search_down(feature, 'score'));
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
112 {opacity}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
113 if(score === undefined){{ opacity = 1; }}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
114 var result = /^#?([a-f\d]{{2}})([a-f\d]{{2}})([a-f\d]{{2}})$/i.exec(color);
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
115 var red = parseInt(result[1], 16);
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
116 var green = parseInt(result[2], 16);
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
117 var blue = parseInt(result[3], 16);
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
118 if(isNaN(opacity) || opacity < 0){{ opacity = 0; }}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
119 return 'rgba(' + red + ',' + green + ',' + blue + ',' + opacity + ')';
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
120 }}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
121 """
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
122
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
123 OPACITY_MATH = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
124 "linear": """
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
125 var opacity = (score - ({min})) / (({max}) - ({min}));
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
126 """,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
127 "logarithmic": """
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
128 var opacity = Math.log10(score - ({min})) / Math.log10(({max}) - ({min}));
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
129 """,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
130 "blast": """
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
131 var opacity = 0;
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
132 if(score == 0.0) {{
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
133 opacity = 1;
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
134 }} else {{
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
135 opacity = (20 - Math.log10(score)) / 180;
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
136 }}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
137 """,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
138 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
139
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
140 BREWER_COLOUR_IDX = 0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
141 BREWER_COLOUR_SCHEMES = [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
142 (166, 206, 227),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
143 (31, 120, 180),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
144 (178, 223, 138),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
145 (51, 160, 44),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
146 (251, 154, 153),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
147 (227, 26, 28),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
148 (253, 191, 111),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
149 (255, 127, 0),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
150 (202, 178, 214),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
151 (106, 61, 154),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
152 (255, 255, 153),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
153 (177, 89, 40),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
154 (228, 26, 28),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
155 (55, 126, 184),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
156 (77, 175, 74),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
157 (152, 78, 163),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
158 (255, 127, 0),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
159 ]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
160
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
161 BREWER_DIVERGING_PALLETES = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
162 "BrBg": ("#543005", "#003c30"),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
163 "PiYg": ("#8e0152", "#276419"),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
164 "PRGn": ("#40004b", "#00441b"),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
165 "PuOr": ("#7f3b08", "#2d004b"),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
166 "RdBu": ("#67001f", "#053061"),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
167 "RdGy": ("#67001f", "#1a1a1a"),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
168 "RdYlBu": ("#a50026", "#313695"),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
169 "RdYlGn": ("#a50026", "#006837"),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
170 "Spectral": ("#9e0142", "#5e4fa2"),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
171 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
172
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
173 def __init__(self):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
174 self.brewer_colour_idx = 0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
175
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
176 def rgb_from_hex(self, hexstr):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
177 # http://stackoverflow.com/questions/4296249/how-do-i-convert-a-hex-triplet-to-an-rgb-tuple-and-back
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
178 return struct.unpack("BBB", binascii.unhexlify(hexstr))
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
179
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
180 def min_max_gff(self, gff_file):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
181 min_val = None
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
182 max_val = None
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
183 with open(gff_file, "r") as handle:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
184 for line in handle:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
185 try:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
186 value = float(line.split("\t")[5])
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
187 min_val = min(value, (min_val or value))
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
188 max_val = max(value, (max_val or value))
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
189
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
190 if value < min_val:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
191 min_val = value
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
192
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
193 if value > max_val:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
194 max_val = value
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
195 except Exception:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
196 pass
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
197 return min_val, max_val
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
198
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
199 def hex_from_rgb(self, r, g, b):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
200 return "#%02x%02x%02x" % (r, g, b)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
201
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
202 def _get_colours(self):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
203 r, g, b = self.BREWER_COLOUR_SCHEMES[
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
204 self.brewer_colour_idx % len(self.BREWER_COLOUR_SCHEMES)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
205 ]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
206 self.brewer_colour_idx += 1
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
207 return r, g, b
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
208
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
209 def parse_menus(self, track):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
210 trackConfig = {"menuTemplate": [{}, {}, {}, {}]}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
211
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
212 if "menu" in track["menus"]:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
213 menu_list = [track["menus"]["menu"]]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
214 if isinstance(track["menus"]["menu"], list):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
215 menu_list = track["menus"]["menu"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
216
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
217 for m in menu_list:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
218 tpl = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
219 "action": m["action"],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
220 "label": m.get("label", "{name}"),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
221 "iconClass": m.get("iconClass", "dijitIconBookmark"),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
222 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
223 if "url" in m:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
224 tpl["url"] = m["url"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
225 if "content" in m:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
226 tpl["content"] = m["content"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
227 if "title" in m:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
228 tpl["title"] = m["title"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
229
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
230 trackConfig["menuTemplate"].append(tpl)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
231
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
232 return trackConfig
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
233
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
234 def parse_colours(self, track, trackFormat, gff3=None):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
235 # Wiggle tracks have a bicolor pallete
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
236 trackConfig = {"style": {}}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
237 if trackFormat == "wiggle":
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
238
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
239 trackConfig["style"]["pos_color"] = track["wiggle"]["color_pos"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
240 trackConfig["style"]["neg_color"] = track["wiggle"]["color_neg"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
241
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
242 if trackConfig["style"]["pos_color"] == "__auto__":
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
243 trackConfig["style"]["neg_color"] = self.hex_from_rgb(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
244 *self._get_colours()
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
245 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
246 trackConfig["style"]["pos_color"] = self.hex_from_rgb(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
247 *self._get_colours()
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
248 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
249
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
250 # Wiggle tracks can change colour at a specified place
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
251 bc_pivot = track["wiggle"]["bicolor_pivot"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
252 if bc_pivot not in ("mean", "zero"):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
253 # The values are either one of those two strings
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
254 # or a number
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
255 bc_pivot = float(bc_pivot)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
256 trackConfig["bicolor_pivot"] = bc_pivot
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
257 elif "scaling" in track:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
258 if track["scaling"]["method"] == "ignore":
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
259 if track["scaling"]["scheme"]["color"] != "__auto__":
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
260 trackConfig["style"]["color"] = track["scaling"]["scheme"]["color"]
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
261 else:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
262 trackConfig["style"]["color"] = self.hex_from_rgb(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
263 *self._get_colours()
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
264 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
265 else:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
266 # Scored method
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
267 algo = track["scaling"]["algo"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
268 # linear, logarithmic, blast
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
269 scales = track["scaling"]["scales"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
270 # type __auto__, manual (min, max)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
271 scheme = track["scaling"]["scheme"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
272 # scheme -> (type (opacity), color)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
273 # ==================================
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
274 # GENE CALLS OR BLAST
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
275 # ==================================
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
276 if trackFormat == "blast":
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
277 red, green, blue = self._get_colours()
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
278 color_function = self.COLOR_FUNCTION_TEMPLATE.format(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
279 **{
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
280 "score": "feature._parent.get('score')",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
281 "opacity": self.OPACITY_MATH["blast"],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
282 "red": red,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
283 "green": green,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
284 "blue": blue,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
285 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
286 )
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
287 trackConfig["style"]["color"] = color_function.replace("\n", "")
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
288 elif trackFormat == "gene_calls":
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
289 # Default values, based on GFF3 spec
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
290 min_val = 0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
291 max_val = 1000
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
292 # Get min/max and build a scoring function since JBrowse doesn't
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
293 if scales["type"] == "automatic" or scales["type"] == "__auto__":
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
294 min_val, max_val = self.min_max_gff(gff3)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
295 else:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
296 min_val = scales.get("min", 0)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
297 max_val = scales.get("max", 1000)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
298
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
299 if scheme["color"] == "__auto__":
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
300 user_color = "undefined"
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
301 auto_color = "'%s'" % self.hex_from_rgb(*self._get_colours())
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
302 elif scheme["color"].startswith("#"):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
303 user_color = "'%s'" % self.hex_from_rgb(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
304 *self.rgb_from_hex(scheme["color"][1:])
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
305 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
306 auto_color = "undefined"
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
307 else:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
308 user_color = "undefined"
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
309 auto_color = "'%s'" % self.hex_from_rgb(*self._get_colours())
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
310
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
311 color_function = self.COLOR_FUNCTION_TEMPLATE_QUAL.format(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
312 **{
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
313 "opacity": self.OPACITY_MATH[algo].format(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
314 **{"max": max_val, "min": min_val}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
315 ),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
316 "user_spec_color": user_color,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
317 "auto_gen_color": auto_color,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
318 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
319 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
320
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
321 trackConfig["style"]["color"] = color_function.replace("\n", "")
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
322 return trackConfig
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
323
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
324
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
325 def etree_to_dict(t):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
326 if t is None:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
327 return {}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
328
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
329 d = {t.tag: {} if t.attrib else None}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
330 children = list(t)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
331 if children:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
332 dd = defaultdict(list)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
333 for dc in map(etree_to_dict, children):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
334 for k, v in dc.items():
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
335 dd[k].append(v)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
336 d = {t.tag: {k: v[0] if len(v) == 1 else v for k, v in dd.items()}}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
337 if t.attrib:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
338 d[t.tag].update(("@" + k, v) for k, v in t.attrib.items())
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
339 if t.text:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
340 text = t.text.strip()
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
341 if children or t.attrib:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
342 if text:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
343 d[t.tag]["#text"] = text
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
344 else:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
345 d[t.tag] = text
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
346 return d
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
347
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
348
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
349 INSTALLED_TO = os.path.dirname(os.path.realpath(__file__))
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
350
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
351
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
352 def metadata_from_node(node):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
353 metadata = {}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
354 try:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
355 if len(node.findall("dataset")) != 1:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
356 # exit early
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
357 return metadata
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
358 except Exception:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
359 return {}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
360
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
361 for (key, value) in node.findall("dataset")[0].attrib.items():
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
362 metadata["dataset_%s" % key] = value
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
363
19
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
364 if node.findall("history"):
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
365 for (key, value) in node.findall("history")[0].attrib.items():
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
366 metadata["history_%s" % key] = value
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
367
19
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
368 if node.findall("metadata"):
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
369 for (key, value) in node.findall("metadata")[0].attrib.items():
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
370 metadata["metadata_%s" % key] = value
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
371 # Additional Mappings applied:
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
372 metadata[
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
373 "dataset_edam_format"
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
374 ] = '<a target="_blank" href="http://edamontology.org/{0}">{1}</a>'.format(
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
375 metadata["dataset_edam_format"], metadata["dataset_file_ext"]
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
376 )
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
377 metadata["history_user_email"] = '<a href="mailto:{0}">{0}</a>'.format(
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
378 metadata["history_user_email"]
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
379 )
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
380 metadata["hist_name"] = metadata["history_display_name"]
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
381 metadata[
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
382 "history_display_name"
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
383 ] = '<a target="_blank" href="{galaxy}/history/view/{encoded_hist_id}">{hist_name}</a>'.format(
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
384 galaxy=GALAXY_INFRASTRUCTURE_URL,
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
385 encoded_hist_id=metadata.get("history_id", "not available"),
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
386 hist_name=metadata.get("history_display_name", "not available"),
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
387 )
19
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
388 if node.findall("tool"):
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
389 for (key, value) in node.findall("tool")[0].attrib.items():
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
390 metadata["tool_%s" % key] = value
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
391 metadata[
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
392 "tool_tool"
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
393 ] = '<a target="_blank" href="{galaxy}/datasets/{encoded_id}/show_params">{tool_id}{tool_version}</a>'.format(
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
394 galaxy=GALAXY_INFRASTRUCTURE_URL,
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
395 encoded_id=metadata.get("dataset_id", ""),
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
396 tool_id=metadata.get("tool_tool_id", ""),
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
397 tool_version=metadata.get("tool_tool_version", ""),
19
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
398 )
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
399 return metadata
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
400
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
401
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
402 class JbrowseConnector(object):
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
403 def __init__(self, outdir, jbrowse2path):
80
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
404 self.trackCounter = 0 # to avoid name clashes
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
405 self.assemblies = [] # these require more than a few line diff.
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
406 self.assmeta = {}
79
14ecbe46ae9f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 78
diff changeset
407 self.ass_first_contigs = (
14ecbe46ae9f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 78
diff changeset
408 []
14ecbe46ae9f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 78
diff changeset
409 ) # for default session - these are read as first line of the assembly .fai
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
410 self.giURL = GALAXY_INFRASTRUCTURE_URL
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
411 self.outdir = outdir
38
07849bf248e3 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a74e469a81b38c7142f63de510ae31d3754d1767
fubar
parents: 37
diff changeset
412 self.jbrowse2path = jbrowse2path
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
413 os.makedirs(self.outdir, exist_ok=True)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
414 self.genome_names = []
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
415 self.trackIdlist = []
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
416 self.tracksToAdd = {}
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
417 self.config_json = {}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
418 self.config_json_file = os.path.join(outdir, "config.json")
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
419 self.clone_jbrowse()
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
420
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
421 def get_cwd(self, cwd):
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
422 if cwd:
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
423 return self.outdir
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
424 else:
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
425 return subprocess.check_output(["pwd"]).decode("utf-8").strip()
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
426 # return None
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
427
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
428 def subprocess_check_call(self, command, output=None, cwd=True):
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
429 if output:
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
430 log.debug("cd %s && %s > %s", self.get_cwd(cwd), " ".join(command), output)
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
431 subprocess.check_call(command, cwd=self.get_cwd(cwd), stdout=output)
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
432 else:
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
433 log.debug("cd %s && %s", self.get_cwd(cwd), " ".join(command))
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
434 subprocess.check_call(command, cwd=self.get_cwd(cwd))
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
435
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
436 def subprocess_popen(self, command, cwd=True):
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
437 log.debug(command)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
438 p = subprocess.Popen(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
439 command,
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
440 cwd=self.get_cwd(cwd),
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
441 shell=True,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
442 stdin=subprocess.PIPE,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
443 stdout=subprocess.PIPE,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
444 stderr=subprocess.PIPE,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
445 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
446 output, err = p.communicate()
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
447 retcode = p.returncode
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
448 if retcode != 0:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
449 log.error(command)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
450 log.error(output)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
451 log.error(err)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
452 raise RuntimeError("Command failed with exit code %s" % (retcode))
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
453
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
454 def subprocess_check_output(self, command):
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
455 log.debug(" ".join(command))
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
456 return subprocess.check_output(command, cwd=self.outdir)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
457
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
458 def symlink_or_copy(self, src, dest):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
459 if "GALAXY_JBROWSE_SYMLINKS" in os.environ and bool(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
460 os.environ["GALAXY_JBROWSE_SYMLINKS"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
461 ):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
462 cmd = ["ln", "-s", src, dest]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
463 else:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
464 cmd = ["cp", src, dest]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
465
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
466 return self.subprocess_check_call(cmd)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
467
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
468 def _prepare_track_style(self, trackDict):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
469
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
470 style_data = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
471 "type": "LinearBasicDisplay",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
472 "displayId": "%s-LinearBasicDisplay" % trackDict["trackId"],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
473 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
474
5
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
475 if trackDict.get("displays", None): # use first if multiple like bed
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
476 style_data["type"] = trackDict["displays"][0]["type"]
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
477 style_data["displayId"] = trackDict["displays"][0]["displayId"]
59
f807e219cec3 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit faada92caf5aaabe58e52b161687a30d542a07b9
fubar
parents: 57
diff changeset
478 wstyle = {
5
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
479 "displays": [
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
480 style_data,
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
481 ]
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
482 }
59
f807e219cec3 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit faada92caf5aaabe58e52b161687a30d542a07b9
fubar
parents: 57
diff changeset
483 return wstyle
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
484
80
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
485 def getNrow(self, url):
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
486 useuri = url.startswith("https://") or url.startswith("http://")
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
487 if not useuri:
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
488 fl = open(url, "r").readlines()
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
489 nrow = len(fl)
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
490 else:
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
491 try:
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
492 scontext = ssl.SSLContext(ssl.PROTOCOL_TLS)
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
493 scontext.verify_mode = ssl.VerifyMode.CERT_NONE
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
494 with urllib.request.urlopen(url, context=scontext) as f:
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
495 fl = f.readlines()
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
496 nrow = len(fl)
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
497 except Exception:
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
498 nrow = 0
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
499 logging.debug("### getNrow returning %d" % nrow)
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
500 return nrow
73
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
501
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
502 def process_genomes(self, genomes):
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
503 assembly = []
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
504 assmeta = []
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
505 useuri = False
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
506 genome_names = []
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
507 for i, genome_node in enumerate(genomes):
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
508 this_genome = {}
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
509 if genome_node["useuri"] == "yes":
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
510 useuri = True
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
511 genome_name = genome_node["label"].strip()
80
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
512 if len(genome_name) == 0:
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
513 genome_name = os.path.splitext(os.path.basename(genome_node["path"]))[0]
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
514 if len(genome_name.split()) > 1:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
515 genome_name = genome_name.split()[0]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
516 # spaces and cruft break scripts when substituted
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
517 if genome_name not in genome_names:
60
81d535970196 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 403a35e1245fa5e62f4be6116a725b9e4d9c353a
fubar
parents: 59
diff changeset
518 # pafs with shared references
31
cb4b32ca9968 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919-dirty
fubar
parents: 30
diff changeset
519 fapath = genome_node["path"]
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
520 if not useuri:
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
521 fapath = os.path.realpath(fapath)
73
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
522 assem, first_contig = self.make_assembly(fapath, genome_name, useuri)
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
523 assembly.append(assem)
73
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
524 self.ass_first_contigs.append(first_contig)
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
525 if len(genome_names) == 0:
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
526 this_genome["genome_name"] = genome_name # first one for all tracks
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
527 genome_names.append(genome_name)
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
528 this_genome["genome_sequence_adapter"] = assem["sequence"][
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
529 "adapter"
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
530 ]
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
531 this_genome["genome_firstcontig"] = None
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
532 if not useuri:
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
533 fl = open(fapath, "r").readline()
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
534 fls = fl.strip().split(">")
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
535 if len(fls) > 1:
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
536 fl = fls[1]
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
537 if len(fl.split()) > 1:
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
538 this_genome["genome_firstcontig"] = fl.split()[
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
539 0
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
540 ].strip()
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
541 else:
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
542 this_genome["genome_firstcontig"] = fl
55
469c0f6d87d7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 0553bb75a96ae401623face516c1cf6e1cfe743f
fubar
parents: 54
diff changeset
543 else:
60
81d535970196 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 403a35e1245fa5e62f4be6116a725b9e4d9c353a
fubar
parents: 59
diff changeset
544 try:
73
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
545 scontext = ssl.SSLContext(ssl.PROTOCOL_TLS)
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
546 scontext.verify_mode = ssl.VerifyMode.CERT_NONE
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
547 with urllib.request.urlopen(
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
548 url=fapath + ".fai", context=scontext
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
549 ) as f:
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
550 fl = f.readline()
63
ac00dcfb5d1d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit f450a9a7bec7ae695a85a061bf59956b73196976
fubar
parents: 62
diff changeset
551 except Exception:
60
81d535970196 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 403a35e1245fa5e62f4be6116a725b9e4d9c353a
fubar
parents: 59
diff changeset
552 fl = None
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
553 if fl: # is first row of the text fai so the first contig name
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
554 this_genome["genome_firstcontig"] = (
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
555 fl.decode("utf8").strip().split()[0]
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
556 )
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
557 assmeta.append(this_genome)
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
558 self.assemblies += assembly
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
559 self.assmeta[genome_names[0]] = assmeta
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
560 self.tracksToAdd[genome_names[0]] = []
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
561 self.genome_names += genome_names
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
562 return this_genome["genome_name"]
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
563
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
564 def make_assembly(self, fapath, gname, useuri):
73
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
565 """added code to grab the first contig name and length for broken default session from Anthony and Helena's code
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
566 that poor Bjoern is trying to figure out.
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
567 """
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
568 if useuri:
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
569 faname = fapath
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
570 adapter = {
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
571 "type": "BgzipFastaAdapter",
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
572 "fastaLocation": {"uri": faname, "locationType": "UriLocation"},
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
573 "faiLocation": {"uri": faname + ".fai", "locationType": "UriLocation"},
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
574 "gziLocation": {"uri": faname + ".gzi", "locationType": "UriLocation"},
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
575 }
73
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
576 scontext = ssl.SSLContext(ssl.PROTOCOL_TLS)
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
577 scontext.verify_mode = ssl.VerifyMode.CERT_NONE
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
578 with urllib.request.urlopen(url=faname + ".fai", context=scontext) as f:
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
579 fl = f.readline()
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
580 contig = fl.decode("utf8").strip()
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
581 # Merlin 172788 8 60 61
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
582 else:
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
583 faname = gname + ".fa.gz"
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
584 fadest = os.path.realpath(os.path.join(self.outdir, faname))
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
585 cmd = "bgzip -i -c %s -I %s.gzi > %s && samtools faidx %s" % (
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
586 fapath,
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
587 fadest,
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
588 fadest,
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
589 fadest,
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
590 )
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
591 self.subprocess_popen(cmd)
19
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
592
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
593 adapter = {
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
594 "type": "BgzipFastaAdapter",
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
595 "fastaLocation": {
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
596 "uri": faname,
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
597 },
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
598 "faiLocation": {
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
599 "uri": faname + ".fai",
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
600 },
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
601 "gziLocation": {
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
602 "uri": faname + ".gzi",
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
603 },
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
604 }
73
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
605 contig = open(fadest + ".fai", "r").readline().strip()
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
606 first_contig = contig.split()[:2]
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
607 first_contig.insert(0, gname)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
608 trackDict = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
609 "name": gname,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
610 "sequence": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
611 "type": "ReferenceSequenceTrack",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
612 "trackId": gname,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
613 "adapter": adapter,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
614 },
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
615 "displays": [
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
616 {
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
617 "type": "LinearReferenceSequenceDisplay",
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
618 "displayId": "%s-LinearReferenceSequenceDisplay" % gname,
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
619 },
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
620 {
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
621 "type": "LinearGCContentDisplay",
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
622 "displayId": "%s-LinearGCContentDisplay" % gname,
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
623 },
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
624 ],
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
625 }
73
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
626 return (trackDict, first_contig)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
627
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
628 def add_default_view(self):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
629 cmd = [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
630 "jbrowse",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
631 "set-default-session",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
632 "-s",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
633 self.config_json_file,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
634 "-t",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
635 ",".join(self.trackIdlist),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
636 "-n",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
637 "JBrowse2 in Galaxy",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
638 "--target",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
639 self.config_json_file,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
640 "-v",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
641 " LinearGenomeView",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
642 ]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
643 self.subprocess_check_call(cmd)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
644
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
645 def write_config(self):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
646 with open(self.config_json_file, "w") as fp:
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
647 json.dump(self.config_json, fp, indent=2)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
648
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
649 def text_index(self):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
650 # Index tracks
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
651 args = [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
652 "jbrowse",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
653 "text-index",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
654 "--target",
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
655 self.outdir,
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
656 "--assemblies",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
657 self.genome_name,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
658 ]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
659
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
660 tracks = ",".join(self.trackIdlist)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
661 if tracks:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
662 args += ["--tracks", tracks]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
663
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
664 self.subprocess_check_call(args)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
665
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
666 def add_hic(self, data, trackData):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
667 """
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
668 HiC adapter.
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
669 https://github.com/aidenlab/hic-format/blob/master/HiCFormatV9.md
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
670 for testing locally, these work:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
671 HiC data is from https://s3.amazonaws.com/igv.broadinstitute.org/data/hic/intra_nofrag_30.hic
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
672 using hg19 reference track as a
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
673 'BgzipFastaAdapter'
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
674 fastaLocation:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
675 uri: 'https://s3.amazonaws.com/jbrowse.org/genomes/GRCh38/fasta/GRCh38.fa.gz',
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
676 faiLocation:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
677 uri: 'https://s3.amazonaws.com/jbrowse.org/genomes/GRCh38/fasta/GRCh38.fa.gz.fai',
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
678 gziLocation:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
679 uri: 'https://s3.amazonaws.com/jbrowse.org/genomes/GRCh38/fasta/GRCh38.fa.gz.gzi',
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
680 Cool will not be likely to be a good fit - see discussion at https://github.com/GMOD/jbrowse-components/issues/2438
60
81d535970196 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 403a35e1245fa5e62f4be6116a725b9e4d9c353a
fubar
parents: 59
diff changeset
681
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
682 """
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
683 tId = trackData["label"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
684 # can be served - if public.
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
685 # dsId = trackData["metadata"]["dataset_id"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
686 # url = "%s/api/datasets/%s/display?to_ext=hic " % (self.giURL, dsId)
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
687 useuri = trackData["useuri"].lower() == "yes"
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
688 if useuri:
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
689 uri = data
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
690 else:
80
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
691 uri = tId
60
81d535970196 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 403a35e1245fa5e62f4be6116a725b9e4d9c353a
fubar
parents: 59
diff changeset
692 # slashes in names cause path trouble
81d535970196 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 403a35e1245fa5e62f4be6116a725b9e4d9c353a
fubar
parents: 59
diff changeset
693 dest = os.path.join(self.outdir, uri)
81d535970196 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 403a35e1245fa5e62f4be6116a725b9e4d9c353a
fubar
parents: 59
diff changeset
694 cmd = ["cp", data, dest]
81d535970196 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 403a35e1245fa5e62f4be6116a725b9e4d9c353a
fubar
parents: 59
diff changeset
695 self.subprocess_check_call(cmd)
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
696 categ = trackData["category"]
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
697 trackDict = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
698 "type": "HicTrack",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
699 "trackId": tId,
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
700 "name": trackData["name"],
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
701 "assemblyNames": [trackData["assemblyNames"]],
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
702 "category": [
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
703 categ,
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
704 ],
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
705 "adapter": {"type": "HicAdapter", "hicLocation": {"uri": uri}},
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
706 }
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
707 self.tracksToAdd[trackData["assemblyNames"]].append(trackDict)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
708 self.trackIdlist.append(tId)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
709
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
710 def add_maf(self, data, trackData):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
711 """
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
712 from https://github.com/cmdcolin/maf2bed
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
713 Note: Both formats start with a MAF as input, and note that your MAF file should contain the species name and chromosome name
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
714 e.g. hg38.chr1 in the sequence identifiers.
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
715 need the reference id - eg hg18, for maf2bed.pl as the first parameter
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
716 """
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
717 tId = trackData["label"]
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
718 mafPlugin = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
719 "plugins": [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
720 {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
721 "name": "MafViewer",
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
722 "url": "https://unpkg.com/jbrowse-plugin-mafviewer/dist/jbrowse-plugin-mafviewer.umd.production.min.js",
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
723 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
724 ]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
725 }
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
726 categ = trackData["category"]
80
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
727 fname = tId
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
728 dest = "%s/%s" % (self.outdir, fname)
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
729 gname = trackData["assemblyNames"]
61
e7a6f7a7148d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 6dde5ad41d63730085116ab2c9a9d3e500a760e4-dirty
fubar
parents: 60
diff changeset
730
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
731 cmd = [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
732 "bash",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
733 os.path.join(INSTALLED_TO, "convertMAF.sh"),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
734 data,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
735 gname,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
736 INSTALLED_TO,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
737 dest,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
738 ]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
739 self.subprocess_check_call(cmd)
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
740 mafs = open(data, "r").readlines()
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
741 mafss = [x for x in mafs if (x.startswith("s\t") or x.startswith("s "))]
61
e7a6f7a7148d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 6dde5ad41d63730085116ab2c9a9d3e500a760e4-dirty
fubar
parents: 60
diff changeset
742 samp = [x.split()[1] for x in mafss if len(x.split()) > 0]
e7a6f7a7148d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 6dde5ad41d63730085116ab2c9a9d3e500a760e4-dirty
fubar
parents: 60
diff changeset
743 sampu = list(dict.fromkeys(samp))
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
744 samples = [x.split(".")[0] for x in sampu]
61
e7a6f7a7148d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 6dde5ad41d63730085116ab2c9a9d3e500a760e4-dirty
fubar
parents: 60
diff changeset
745 samples.sort()
63
ac00dcfb5d1d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit f450a9a7bec7ae695a85a061bf59956b73196976
fubar
parents: 62
diff changeset
746 logging.debug(
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
747 "$$$$ cmd=%s, mafss=%s samp=%s samples=%s"
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
748 % (" ".join(cmd), mafss, samp, samples)
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
749 )
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
750 trackDict = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
751 "type": "MafTrack",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
752 "trackId": tId,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
753 "name": trackData["name"],
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
754 "category": [
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
755 categ,
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
756 ],
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
757 "adapter": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
758 "type": "MafTabixAdapter",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
759 "samples": samples,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
760 "bedGzLocation": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
761 "uri": fname + ".sorted.bed.gz",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
762 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
763 "index": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
764 "location": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
765 "uri": fname + ".sorted.bed.gz.tbi",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
766 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
767 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
768 },
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
769 "assemblyNames": [trackData["assemblyNames"]],
5
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
770 "displays": [
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
771 {
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
772 "type": "LinearBasicDisplay",
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
773 "displayId": "%s-LinearBasicDisplay" % tId,
5
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
774 },
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
775 {"type": "LinearArcDisplay", "displayId": "%s-LinearArcDisplay" % tId},
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
776 ],
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
777 }
59
f807e219cec3 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit faada92caf5aaabe58e52b161687a30d542a07b9
fubar
parents: 57
diff changeset
778 style_json = self._prepare_track_style(trackDict)
f807e219cec3 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit faada92caf5aaabe58e52b161687a30d542a07b9
fubar
parents: 57
diff changeset
779 trackDict["style"] = style_json
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
780 self.tracksToAdd[gname].append(trackDict)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
781 self.trackIdlist.append(tId)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
782 if self.config_json.get("plugins", None):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
783 self.config_json["plugins"].append(mafPlugin[0])
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
784 else:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
785 self.config_json.update(mafPlugin)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
786
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
787 def _blastxml_to_gff3(self, xml, min_gap=10):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
788 gff3_unrebased = tempfile.NamedTemporaryFile(delete=False)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
789 cmd = [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
790 "python",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
791 os.path.join(INSTALLED_TO, "blastxml_to_gapped_gff3.py"),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
792 "--trim",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
793 "--trim_end",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
794 "--include_seq",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
795 "--min_gap",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
796 str(min_gap),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
797 xml,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
798 ]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
799 subprocess.check_call(cmd, cwd=self.outdir, stdout=gff3_unrebased)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
800 gff3_unrebased.close()
63
ac00dcfb5d1d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit f450a9a7bec7ae695a85a061bf59956b73196976
fubar
parents: 62
diff changeset
801 logging.debug("### blastxml to gff3 cmd = %s" % " ".join(cmd))
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
802 return gff3_unrebased.name
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
803
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
804 def add_blastxml(self, data, trackData, blastOpts, **kwargs):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
805 gff3 = self._blastxml_to_gff3(data, min_gap=blastOpts["min_gap"])
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
806 if "parent" in blastOpts and blastOpts["parent"] != "None":
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
807 gff3_rebased = tempfile.NamedTemporaryFile(delete=False)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
808 cmd = ["python", os.path.join(INSTALLED_TO, "gff3_rebase.py")]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
809 if blastOpts.get("protein", "false") == "true":
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
810 cmd.append("--protein2dna")
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
811 cmd.extend([os.path.realpath(blastOpts["parent"]), gff3])
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
812 subprocess.check_call(cmd, cwd=self.outdir, stdout=gff3_rebased)
63
ac00dcfb5d1d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit f450a9a7bec7ae695a85a061bf59956b73196976
fubar
parents: 62
diff changeset
813 logging.debug("### gff3rebase cmd = %s" % " ".join(cmd))
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
814 gff3_rebased.close()
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
815 # Replace original gff3 file
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
816 shutil.copy(gff3_rebased.name, gff3)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
817 os.unlink(gff3_rebased.name)
80
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
818 self.add_gff(gff3, trackData, **kwargs)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
819
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
820 def add_bigwig(self, data, trackData):
80
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
821 tId = trackData["label"]
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
822 useuri = trackData["useuri"].lower() == "yes"
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
823 if useuri:
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
824 url = data
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
825 else:
80
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
826 url = tId
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
827 # slashes in names cause path trouble
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
828 dest = os.path.join(self.outdir, url)
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
829 cmd = ["cp", data, dest]
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
830 self.subprocess_check_call(cmd)
50
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
831 bwloc = {"uri": url}
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
832 categ = trackData["category"]
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
833 trackDict = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
834 "type": "QuantitativeTrack",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
835 "trackId": tId,
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
836 "name": trackData["name"],
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
837 "category": [
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
838 categ,
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
839 ],
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
840 "assemblyNames": [trackData["assemblyNames"]],
50
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
841 "adapter": {
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
842 "type": "BigWigAdapter",
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
843 "bigWigLocation": bwloc,
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
844 },
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
845 "displays": [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
846 {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
847 "type": "LinearWiggleDisplay",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
848 "displayId": "%s-LinearWiggleDisplay" % tId,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
849 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
850 ],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
851 }
59
f807e219cec3 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit faada92caf5aaabe58e52b161687a30d542a07b9
fubar
parents: 57
diff changeset
852 style_json = self._prepare_track_style(trackDict)
f807e219cec3 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit faada92caf5aaabe58e52b161687a30d542a07b9
fubar
parents: 57
diff changeset
853 trackDict["style"] = style_json
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
854 self.tracksToAdd[trackData["assemblyNames"]].append(trackDict)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
855 self.trackIdlist.append(tId)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
856
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
857 def add_bam(self, data, trackData, bam_index=None, **kwargs):
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
858 tId = trackData["label"]
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
859 useuri = trackData["useuri"].lower() == "yes"
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
860 bindex = bam_index
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
861 categ = trackData["category"]
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
862 if useuri:
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
863 url = data
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
864 else:
80
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
865 fname = tId
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
866 dest = "%s/%s" % (self.outdir, fname)
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
867 url = fname
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
868 bindex = fname + ".bai"
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
869 self.subprocess_check_call(["cp", data, dest])
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
870 if bam_index is not None and os.path.exists(bam_index):
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
871 if not os.path.exists(bindex):
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
872 # bai most probably made by galaxy and stored in galaxy dirs, need to copy it to dest
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
873 self.subprocess_check_call(["cp", bam_index, bindex])
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
874 else:
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
875 # Can happen in exotic condition
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
876 # e.g. if bam imported as symlink with datatype=unsorted.bam, then datatype changed to bam
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
877 # => no index generated by galaxy, but there might be one next to the symlink target
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
878 # this trick allows to skip the bam sorting made by galaxy if already done outside
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
879 if os.path.exists(os.path.realpath(data) + ".bai"):
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
880 self.symlink_or_copy(os.path.realpath(data) + ".bai", bindex)
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
881 else:
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
882 log.warn("Could not find a bam index (.bai file) for %s", data)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
883 trackDict = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
884 "type": "AlignmentsTrack",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
885 "trackId": tId,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
886 "name": trackData["name"],
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
887 "category": [
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
888 categ,
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
889 ],
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
890 "assemblyNames": [trackData["assemblyNames"]],
50
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
891 "adapter": {
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
892 "type": "BamAdapter",
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
893 "bamLocation": {"uri": url},
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
894 "index": {
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
895 "location": {
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
896 "uri": bindex,
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
897 }
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
898 },
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
899 },
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
900 "displays": [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
901 {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
902 "type": "LinearAlignmentsDisplay",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
903 "displayId": "%s-LinearAlignmentsDisplay" % tId,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
904 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
905 ],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
906 }
59
f807e219cec3 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit faada92caf5aaabe58e52b161687a30d542a07b9
fubar
parents: 57
diff changeset
907 style_json = self._prepare_track_style(trackDict)
f807e219cec3 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit faada92caf5aaabe58e52b161687a30d542a07b9
fubar
parents: 57
diff changeset
908 trackDict["style"] = style_json
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
909 self.tracksToAdd[trackData["assemblyNames"]].append(trackDict)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
910 self.trackIdlist.append(tId)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
911
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
912 def add_cram(self, data, trackData, cram_index=None, **kwargs):
19
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
913 tId = trackData["label"]
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
914 categ = trackData["category"]
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
915 useuri = trackData["useuri"].lower() == "yes"
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
916 gsa = self.assmeta.get(trackData["assemblyNames"], None)
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
917 if gsa:
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
918 genseqad = gsa[0]["genome_sequence_adapter"]
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
919 else:
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
920 genseqad = "Not found"
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
921 logging.warn("No adapter found for cram %s in gsa=%s" % (tId, gsa))
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
922 if useuri:
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
923 url = data
19
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
924 else:
80
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
925 fname = tId
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
926 dest = os.path.join(self.outdir, fname)
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
927 url = fname
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
928 self.subprocess_check_call(["cp", data, dest])
55
469c0f6d87d7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 0553bb75a96ae401623face516c1cf6e1cfe743f
fubar
parents: 54
diff changeset
929 if cram_index is not None and os.path.exists(cram_index):
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
930 if not os.path.exists(dest + ".crai"):
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
931 # most probably made by galaxy and stored in galaxy dirs, need to copy it to dest
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
932 self.subprocess_check_call(
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
933 ["cp", os.path.realpath(cram_index), dest + ".crai"]
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
934 )
53
bdfa6a7c4543 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4-dirty
fubar
parents: 50
diff changeset
935 else:
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
936 cpath = os.path.realpath(dest) + ".crai"
53
bdfa6a7c4543 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4-dirty
fubar
parents: 50
diff changeset
937 cmd = ["samtools", "index", "-c", "-o", cpath, os.path.realpath(dest)]
bdfa6a7c4543 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4-dirty
fubar
parents: 50
diff changeset
938 self.subprocess_check_call(cmd)
19
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
939 trackDict = {
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
940 "type": "AlignmentsTrack",
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
941 "trackId": tId,
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
942 "name": trackData["name"],
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
943 "category": [
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
944 categ,
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
945 ],
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
946 "assemblyNames": [trackData["assemblyNames"]],
50
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
947 "adapter": {
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
948 "type": "CramAdapter",
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
949 "cramLocation": {"uri": url},
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
950 "craiLocation": {
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
951 "uri": url + ".crai",
50
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
952 },
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
953 "sequenceAdapter": genseqad,
50
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
954 },
19
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
955 "displays": [
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
956 {
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
957 "type": "LinearAlignmentsDisplay",
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
958 "displayId": "%s-LinearAlignmentsDisplay" % tId,
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
959 },
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
960 ],
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
961 }
59
f807e219cec3 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit faada92caf5aaabe58e52b161687a30d542a07b9
fubar
parents: 57
diff changeset
962 style_json = self._prepare_track_style(trackDict)
f807e219cec3 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit faada92caf5aaabe58e52b161687a30d542a07b9
fubar
parents: 57
diff changeset
963 trackDict["style"] = style_json
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
964 self.tracksToAdd[trackData["assemblyNames"]].append(trackDict)
19
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
965 self.trackIdlist.append(tId)
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
966
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
967 def add_vcf(self, data, trackData):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
968 tId = trackData["label"]
19
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
969 # url = "%s/api/datasets/%s/display" % (
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
970 # self.giURL,
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
971 # trackData["metadata"]["dataset_id"],
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
972 # )
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
973 categ = trackData["category"]
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
974 useuri = trackData["useuri"].lower() == "yes"
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
975 if useuri:
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
976 url = data
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
977 else:
80
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
978 url = tId
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
979 dest = "%s/%s" % (self.outdir, url)
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
980 cmd = "bgzip -c %s > %s" % (data, dest)
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
981 self.subprocess_popen(cmd)
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
982 cmd = ["tabix", "-f", "-p", "vcf", dest]
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
983 self.subprocess_check_call(cmd)
50
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
984 trackDict = {
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
985 "type": "VariantTrack",
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
986 "trackId": tId,
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
987 "name": trackData["name"],
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
988 "assemblyNames": [trackData["assemblyNames"]],
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
989 "category": [
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
990 categ,
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
991 ],
50
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
992 "adapter": {
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
993 "type": "VcfTabixAdapter",
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
994 "vcfGzLocation": {"uri": url},
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
995 "index": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
996 "location": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
997 "uri": url + ".tbi",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
998 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
999 },
50
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
1000 },
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1001 "displays": [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1002 {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1003 "type": "LinearVariantDisplay",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1004 "displayId": "%s-LinearVariantDisplay" % tId,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1005 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1006 {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1007 "type": "ChordVariantDisplay",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1008 "displayId": "%s-ChordVariantDisplay" % tId,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1009 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1010 {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1011 "type": "LinearPairedArcDisplay",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1012 "displayId": "%s-LinearPairedArcDisplay" % tId,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1013 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1014 ],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1015 }
59
f807e219cec3 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit faada92caf5aaabe58e52b161687a30d542a07b9
fubar
parents: 57
diff changeset
1016 style_json = self._prepare_track_style(trackDict)
f807e219cec3 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit faada92caf5aaabe58e52b161687a30d542a07b9
fubar
parents: 57
diff changeset
1017 trackDict["style"] = style_json
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1018 self.tracksToAdd[trackData["assemblyNames"]].append(trackDict)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1019 self.trackIdlist.append(tId)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1020
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1021 def _sort_gff(self, data, dest):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1022 # Only index if not already done
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1023 if not os.path.exists(dest):
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1024 cmd = "jbrowse sort-gff '%s' | bgzip -c > '%s'" % (
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1025 data,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1026 dest,
80
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1027 )
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1028 self.subprocess_popen(cmd)
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1029 self.subprocess_check_call(["tabix", "-f", "-p", "gff", dest])
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1030
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1031 def _sort_bed(self, data, dest):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1032 # Only index if not already done
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1033 if not os.path.exists(dest):
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1034 cmd = "sort -k1,1 -k2,2n '%s' | bgzip -c > '%s'" % (data, dest)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1035 self.subprocess_popen(cmd)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1036 cmd = ["tabix", "-f", "-p", "bed", dest]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1037 self.subprocess_check_call(cmd)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1038
80
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1039 def add_gff(self, data, trackData):
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1040 tId = trackData["label"]
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1041 useuri = trackData["useuri"].lower() == "yes"
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1042 if useuri:
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1043 url = trackData["path"]
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1044 else:
80
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1045 url = tId + ".gz"
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1046 dest = "%s/%s" % (self.outdir, url)
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1047 self._sort_gff(data, dest)
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1048 categ = trackData["category"]
50
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
1049 trackDict = {
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
1050 "type": "FeatureTrack",
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
1051 "trackId": tId,
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
1052 "name": trackData["name"],
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1053 "assemblyNames": [trackData["assemblyNames"]],
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1054 "category": [
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1055 categ,
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1056 ],
50
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
1057 "adapter": {
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1058 "type": "Gff3TabixAdapter",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1059 "gffGzLocation": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1060 "uri": url,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1061 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1062 "index": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1063 "location": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1064 "uri": url + ".tbi",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1065 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1066 },
50
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
1067 },
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1068 "displays": [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1069 {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1070 "type": "LinearBasicDisplay",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1071 "displayId": "%s-LinearBasicDisplay" % tId,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1072 },
17
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1073 {
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1074 "type": "LinearArcDisplay",
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1075 "displayId": "%s-LinearArcDisplay" % tId,
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1076 },
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1077 ],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1078 }
59
f807e219cec3 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit faada92caf5aaabe58e52b161687a30d542a07b9
fubar
parents: 57
diff changeset
1079 style_json = self._prepare_track_style(trackDict)
f807e219cec3 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit faada92caf5aaabe58e52b161687a30d542a07b9
fubar
parents: 57
diff changeset
1080 trackDict["style"] = style_json
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1081 self.tracksToAdd[trackData["assemblyNames"]].append(trackDict)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1082 self.trackIdlist.append(tId)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1083
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1084 def add_bed(self, data, ext, trackData):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1085 tId = trackData["label"]
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1086 categ = trackData["category"]
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1087 useuri = trackData["useuri"].lower() == "yes"
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1088 if useuri:
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1089 url = data
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1090 else:
80
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1091 url = tId
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1092 dest = "%s/%s" % (self.outdir, url)
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1093 self._sort_bed(data, dest)
50
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
1094 trackDict = {
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
1095 "type": "FeatureTrack",
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
1096 "trackId": tId,
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
1097 "name": trackData["name"],
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1098 "assemblyNames": [trackData["assemblyNames"]],
50
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
1099 "adapter": {
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1100 "category": [
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1101 categ,
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1102 ],
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1103 "type": "BedTabixAdapter",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1104 "bedGzLocation": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1105 "uri": url,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1106 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1107 "index": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1108 "location": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1109 "uri": url + ".tbi",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1110 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1111 },
50
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
1112 },
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1113 "displays": [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1114 {
9
a26c41e304c3 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1b7e6ba50013775621cbdfdc101152a7f5c5e15b
fubar
parents: 7
diff changeset
1115 "type": "LinearBasicDisplay",
a26c41e304c3 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1b7e6ba50013775621cbdfdc101152a7f5c5e15b
fubar
parents: 7
diff changeset
1116 "displayId": "%s-LinearBasicDisplay" % tId,
a26c41e304c3 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1b7e6ba50013775621cbdfdc101152a7f5c5e15b
fubar
parents: 7
diff changeset
1117 },
a26c41e304c3 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1b7e6ba50013775621cbdfdc101152a7f5c5e15b
fubar
parents: 7
diff changeset
1118 {
5
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
1119 "type": "LinearPileupDisplay",
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
1120 "displayId": "%s-LinearPileupDisplay" % tId,
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
1121 },
17
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1122 {
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1123 "type": "LinearArcDisplay",
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1124 "displayId": "%s-LinearArcDisplay" % tId,
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1125 },
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1126 ],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1127 }
59
f807e219cec3 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit faada92caf5aaabe58e52b161687a30d542a07b9
fubar
parents: 57
diff changeset
1128 style_json = self._prepare_track_style(trackDict)
f807e219cec3 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit faada92caf5aaabe58e52b161687a30d542a07b9
fubar
parents: 57
diff changeset
1129 trackDict["style"] = style_json
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1130 self.tracksToAdd[trackData["assemblyNames"]].append(trackDict)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1131 self.trackIdlist.append(tId)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1132
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1133 def add_paf(self, data, trackData, pafOpts, **kwargs):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1134 tname = trackData["name"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1135 tId = trackData["label"]
80
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1136 url = tId
72
2bdb748df098 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 9d5e563dde653450723415b0fccd2ebb4b82477e
fubar
parents: 71
diff changeset
1137 useuri = data.startswith("http://") or data.startswith("https://")
2bdb748df098 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 9d5e563dde653450723415b0fccd2ebb4b82477e
fubar
parents: 71
diff changeset
1138 if not useuri:
2bdb748df098 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 9d5e563dde653450723415b0fccd2ebb4b82477e
fubar
parents: 71
diff changeset
1139 dest = "%s/%s" % (self.outdir, url)
2bdb748df098 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 9d5e563dde653450723415b0fccd2ebb4b82477e
fubar
parents: 71
diff changeset
1140 self.symlink_or_copy(os.path.realpath(data), dest)
80
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1141 nrow = self.getNrow(dest)
72
2bdb748df098 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 9d5e563dde653450723415b0fccd2ebb4b82477e
fubar
parents: 71
diff changeset
1142 else:
2bdb748df098 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 9d5e563dde653450723415b0fccd2ebb4b82477e
fubar
parents: 71
diff changeset
1143 url = data
80
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1144 nrow = self.getNrow(url)
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1145 categ = trackData["category"]
80
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1146 pgnames = [x.strip() for x in pafOpts["genome_label"].split(",")]
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1147 pgpaths = [
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1148 x.strip() for x in pafOpts["genome"].split(",") if len(x.strip()) > 0
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1149 ]
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1150 passnames = [trackData["assemblyNames"]] # always first
80
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1151 for i, gp in enumerate(pgpaths):
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1152 if len(pgnames[i].strip()) == 0:
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1153 # user may have left it blank - cannot make non-optional if want optional tracks.
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1154 gn = os.path.basename(gp)
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1155 pgnames[i] = os.path.splitext(gn)[0]
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1156 logging.debug(
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1157 "### add_paf got pafOpts=%s, pgnames=%s, pgpaths=%s for %s"
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1158 % (pafOpts, pgnames, pgpaths, tId)
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1159 )
80
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1160 for i, gp in enumerate(pgpaths):
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1161 gname = pgnames[i]
31
cb4b32ca9968 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919-dirty
fubar
parents: 30
diff changeset
1162 if len(gname.split()) > 1:
cb4b32ca9968 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919-dirty
fubar
parents: 30
diff changeset
1163 gname = gname.split()[0]
59
f807e219cec3 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit faada92caf5aaabe58e52b161687a30d542a07b9
fubar
parents: 57
diff changeset
1164 passnames.append(gname)
f807e219cec3 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit faada92caf5aaabe58e52b161687a30d542a07b9
fubar
parents: 57
diff changeset
1165 # trouble from spacey names in command lines avoidance
80
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1166 useuri = gp.startswith("http://") or gp.startswith("https://")
72
2bdb748df098 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 9d5e563dde653450723415b0fccd2ebb4b82477e
fubar
parents: 71
diff changeset
1167
59
f807e219cec3 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit faada92caf5aaabe58e52b161687a30d542a07b9
fubar
parents: 57
diff changeset
1168 if gname not in self.genome_names:
f807e219cec3 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit faada92caf5aaabe58e52b161687a30d542a07b9
fubar
parents: 57
diff changeset
1169 # ignore if already there - eg for duplicates among pafs.
80
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1170 asstrack, first_contig = self.make_assembly(gp, gname, useuri)
59
f807e219cec3 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit faada92caf5aaabe58e52b161687a30d542a07b9
fubar
parents: 57
diff changeset
1171 self.genome_names.append(gname)
68
c4eb6a85db70 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit bd958a96352bf8dbd1fdb5a2e994d57a42446f33-dirty
fubar
parents: 65
diff changeset
1172 self.tracksToAdd[gname] = []
c4eb6a85db70 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit bd958a96352bf8dbd1fdb5a2e994d57a42446f33-dirty
fubar
parents: 65
diff changeset
1173 self.assemblies.append(asstrack)
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1174 trackDict = {
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1175 "type": "SyntenyTrack",
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1176 "trackId": tId,
31
cb4b32ca9968 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919-dirty
fubar
parents: 30
diff changeset
1177 "assemblyNames": passnames,
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1178 "category": [
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1179 categ,
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1180 ],
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1181 "name": tname,
50
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
1182 "adapter": {
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
1183 "type": "PAFAdapter",
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
1184 "pafLocation": {"uri": url},
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
1185 "assemblyNames": passnames,
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1186 },
64
497fd2d27aa2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit f450a9a7bec7ae695a85a061bf59956b73196976-dirty
fubar
parents: 63
diff changeset
1187 "displays": [
68
c4eb6a85db70 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit bd958a96352bf8dbd1fdb5a2e994d57a42446f33-dirty
fubar
parents: 65
diff changeset
1188 {
c4eb6a85db70 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit bd958a96352bf8dbd1fdb5a2e994d57a42446f33-dirty
fubar
parents: 65
diff changeset
1189 "type": "LGVSyntenyDisplay",
72
2bdb748df098 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 9d5e563dde653450723415b0fccd2ebb4b82477e
fubar
parents: 71
diff changeset
1190 "displayId": "%s-LGVSyntenyDisplay" % tId,
68
c4eb6a85db70 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit bd958a96352bf8dbd1fdb5a2e994d57a42446f33-dirty
fubar
parents: 65
diff changeset
1191 },
72
2bdb748df098 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 9d5e563dde653450723415b0fccd2ebb4b82477e
fubar
parents: 71
diff changeset
1192 {
2bdb748df098 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 9d5e563dde653450723415b0fccd2ebb4b82477e
fubar
parents: 71
diff changeset
1193 "type": "DotplotDisplay",
2bdb748df098 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 9d5e563dde653450723415b0fccd2ebb4b82477e
fubar
parents: 71
diff changeset
1194 "displayId": "%s-DotplotDisplay" % tId,
2bdb748df098 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 9d5e563dde653450723415b0fccd2ebb4b82477e
fubar
parents: 71
diff changeset
1195 },
64
497fd2d27aa2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit f450a9a7bec7ae695a85a061bf59956b73196976-dirty
fubar
parents: 63
diff changeset
1196 {
497fd2d27aa2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit f450a9a7bec7ae695a85a061bf59956b73196976-dirty
fubar
parents: 63
diff changeset
1197 "type": "LinearComparativeDisplay",
72
2bdb748df098 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 9d5e563dde653450723415b0fccd2ebb4b82477e
fubar
parents: 71
diff changeset
1198 "displayId": "%s-LinearComparativeDisplay" % tId,
64
497fd2d27aa2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit f450a9a7bec7ae695a85a061bf59956b73196976-dirty
fubar
parents: 63
diff changeset
1199 },
497fd2d27aa2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit f450a9a7bec7ae695a85a061bf59956b73196976-dirty
fubar
parents: 63
diff changeset
1200 {
80
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1201 "type": "LinearBasicDisplay",
72
2bdb748df098 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 9d5e563dde653450723415b0fccd2ebb4b82477e
fubar
parents: 71
diff changeset
1202 "displayId": "%s-LinearSyntenyDisplay" % tId,
64
497fd2d27aa2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit f450a9a7bec7ae695a85a061bf59956b73196976-dirty
fubar
parents: 63
diff changeset
1203 },
497fd2d27aa2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit f450a9a7bec7ae695a85a061bf59956b73196976-dirty
fubar
parents: 63
diff changeset
1204 ],
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1205 }
81
e9bcbed05108 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f-dirty
fubar
parents: 80
diff changeset
1206 if nrow > 20000:
80
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1207 style_json = {
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1208 "displays": [
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1209 {
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1210 "type": "LGVSyntenyDisplay",
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1211 "displayId": "%s-LGVSyntenyDisplay" % tId,
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1212 }
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1213 ]
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1214 }
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1215 else:
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1216 style_json = {
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1217 "displays": [
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1218 {
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1219 "type": "LinearBasicDisplay",
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1220 "displayId": "%s-LinearBasicDisplay" % tId,
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1221 }
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1222 ]
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1223 }
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1224
59
f807e219cec3 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit faada92caf5aaabe58e52b161687a30d542a07b9
fubar
parents: 57
diff changeset
1225 trackDict["style"] = style_json
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1226 self.tracksToAdd[trackData["assemblyNames"]].append(trackDict)
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1227 self.trackIdlist.append(tId)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1228
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1229 def process_annotations(self, track):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1230 category = track["category"].replace("__pd__date__pd__", TODAY)
80
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1231 for trackIndex, (
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1232 dataset_path,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1233 dataset_ext,
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1234 useuri,
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1235 track_human_label,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1236 extra_metadata,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1237 ) in enumerate(track["trackfiles"]):
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1238 if not dataset_path.strip().startswith("http"):
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1239 # Unsanitize labels (element_identifiers are always sanitized by Galaxy)
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1240 for key, value in mapped_chars.items():
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1241 track_human_label = track_human_label.replace(value, key)
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1242 track_human_label = track_human_label.replace(" ", "_")
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1243 outputTrackConfig = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1244 "category": category,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1245 "style": {},
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1246 }
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1247 outputTrackConfig["assemblyNames"] = track["assemblyNames"]
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1248 outputTrackConfig["key"] = track_human_label
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1249 outputTrackConfig["useuri"] = useuri
48
460d5b6c5d98 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a-dirty
fubar
parents: 47
diff changeset
1250 outputTrackConfig["path"] = dataset_path
460d5b6c5d98 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a-dirty
fubar
parents: 47
diff changeset
1251 outputTrackConfig["ext"] = dataset_ext
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1252
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1253 outputTrackConfig["trackset"] = track.get("trackset", {})
80
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1254 outputTrackConfig["label"] = "%s_%d.%s" % (
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1255 track_human_label,
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1256 self.trackCounter,
19
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
1257 dataset_ext,
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
1258 )
80
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1259 self.trackCounter += 1
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1260 outputTrackConfig["metadata"] = extra_metadata
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1261 outputTrackConfig["name"] = track_human_label
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1262
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1263 if dataset_ext in ("gff", "gff3"):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1264 self.add_gff(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1265 dataset_path,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1266 outputTrackConfig,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1267 )
34
2893ef33fba9 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd
fubar
parents: 32
diff changeset
1268 elif dataset_ext in ("hic", "juicebox_hic"):
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1269 self.add_hic(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1270 dataset_path,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1271 outputTrackConfig,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1272 )
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1273 elif dataset_ext in ("cool", "mcool", "scool"):
80
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1274 hic_url = outputTrackConfig["label"]
29
f728cf0df71d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit fe89199bded3f50aefb6958f0c4e85eede77ad81-dirty
fubar
parents: 28
diff changeset
1275 hic_path = os.path.join(self.outdir, hic_url)
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1276 self.subprocess_check_call(
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1277 [
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1278 "hictk",
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1279 "convert",
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1280 "-f",
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1281 "--output-fmt",
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1282 "hic",
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1283 dataset_path,
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1284 hic_path,
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1285 ]
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1286 )
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1287 self.add_hic(
61
e7a6f7a7148d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 6dde5ad41d63730085116ab2c9a9d3e500a760e4-dirty
fubar
parents: 60
diff changeset
1288 hic_url,
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1289 outputTrackConfig,
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1290 )
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1291 elif dataset_ext in ("bed",):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1292 self.add_bed(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1293 dataset_path,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1294 dataset_ext,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1295 outputTrackConfig,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1296 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1297 elif dataset_ext in ("maf",):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1298 self.add_maf(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1299 dataset_path,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1300 outputTrackConfig,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1301 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1302 elif dataset_ext == "bigwig":
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1303 self.add_bigwig(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1304 dataset_path,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1305 outputTrackConfig,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1306 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1307 elif dataset_ext == "bam":
37
7adde511daa1 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 35
diff changeset
1308 real_indexes = track["conf"]["options"]["bam"]["bam_index"]
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1309 self.add_bam(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1310 dataset_path,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1311 outputTrackConfig,
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1312 bam_index=real_indexes,
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1313 )
19
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
1314 elif dataset_ext == "cram":
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1315 real_indexes = track["conf"]["options"]["cram"]["cram_index"]
19
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
1316 self.add_cram(
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
1317 dataset_path,
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
1318 outputTrackConfig,
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1319 cram_index=real_indexes,
19
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
1320 )
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1321 elif dataset_ext == "blastxml":
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1322 self.add_blastxml(
17
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1323 dataset_path,
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1324 outputTrackConfig,
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1325 track["conf"]["options"]["blast"],
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1326 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1327 elif dataset_ext == "vcf":
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1328 self.add_vcf(dataset_path, outputTrackConfig)
15
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1329 elif dataset_ext == "paf":
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1330 self.add_paf(
17
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1331 dataset_path,
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1332 outputTrackConfig,
27
4ff1ed2065cc planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit d733fb18a02929c9e9959ad30bd0f1368118e924-dirty
fubar
parents: 25
diff changeset
1333 track["conf"]["options"]["paf"],
15
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1334 )
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1335 else:
29
f728cf0df71d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit fe89199bded3f50aefb6958f0c4e85eede77ad81-dirty
fubar
parents: 28
diff changeset
1336 logging.warn("Do not know how to handle %s", dataset_ext)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1337 # Return non-human label for use in other fields
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1338 yield outputTrackConfig["label"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1339
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1340 def add_default_session(self, default_data):
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1341 """
60
81d535970196 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 403a35e1245fa5e62f4be6116a725b9e4d9c353a
fubar
parents: 59
diff changeset
1342 default session settings are hard and fragile.
81d535970196 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 403a35e1245fa5e62f4be6116a725b9e4d9c353a
fubar
parents: 59
diff changeset
1343 .add_default_view() and other configuration code adapted from
81d535970196 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 403a35e1245fa5e62f4be6116a725b9e4d9c353a
fubar
parents: 59
diff changeset
1344 https://github.com/abretaud/tools-iuc/blob/jbrowse2/tools/jbrowse2/jbrowse2.py
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1345 """
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1346 # TODO using the default session for now, but check out session specs in the future https://github.com/GMOD/jbrowse-components/issues/2708
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1347 track_types = {}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1348 with open(self.config_json_file, "r") as config_file:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1349 config_json = json.load(config_file)
10
c60b17456297 planemo upload commit 740eeca506257070c95f4e9f1a75911c31db5a04
fubar
parents: 9
diff changeset
1350 if self.config_json:
c60b17456297 planemo upload commit 740eeca506257070c95f4e9f1a75911c31db5a04
fubar
parents: 9
diff changeset
1351 config_json.update(self.config_json)
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1352 if "defaultSession" in config_json:
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1353 session_json = config_json["defaultSession"]
78
7bb6259ea52f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 76
diff changeset
1354 session_views = []
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1355 else:
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1356 session_json = {}
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1357 session_views = []
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1358 for gnome in self.genome_names:
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1359 tracks_data = []
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1360 for track_conf in self.tracksToAdd[gnome]:
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1361 tId = track_conf["trackId"]
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1362 track_types[tId] = track_conf["type"]
73
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1363 style_data = default_data[gnome]["style"].get(tId, None)
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1364 if not style_data:
63
ac00dcfb5d1d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit f450a9a7bec7ae695a85a061bf59956b73196976
fubar
parents: 62
diff changeset
1365 logging.debug(
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1366 "### No style data in default data %s for %s"
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1367 % (default_data, tId)
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1368 )
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1369 style_data = {"type": "LinearBasicDisplay"}
80
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1370 if "displays" in track_conf:
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1371 disp = track_conf["displays"][0]["type"]
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1372 style_data["type"] = disp
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1373 if track_conf.get("style_labels", None):
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1374 # TODO fix this: it should probably go in a renderer block (SvgFeatureRenderer) but still does not work
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1375 # TODO move this to per track displays?
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1376 style_data["labels"] = track_conf["style_labels"]
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1377 tracks_data.append(
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1378 {
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1379 "type": track_types[tId],
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1380 "configuration": tId,
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1381 "displays": [style_data],
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1382 }
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1383 )
68
c4eb6a85db70 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit bd958a96352bf8dbd1fdb5a2e994d57a42446f33-dirty
fubar
parents: 65
diff changeset
1384 # paf genomes have no tracks associated so nothing for the view
c4eb6a85db70 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit bd958a96352bf8dbd1fdb5a2e994d57a42446f33-dirty
fubar
parents: 65
diff changeset
1385 if len(tracks_data) > 0:
79
14ecbe46ae9f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 78
diff changeset
1386 view_json = {
14ecbe46ae9f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 78
diff changeset
1387 "type": "LinearGenomeView",
14ecbe46ae9f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 78
diff changeset
1388 "offsetPx": 0,
14ecbe46ae9f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 78
diff changeset
1389 "minimized": False,
14ecbe46ae9f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 78
diff changeset
1390 "tracks": tracks_data,
14ecbe46ae9f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 78
diff changeset
1391 }
14ecbe46ae9f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 78
diff changeset
1392 logging.debug(
14ecbe46ae9f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 78
diff changeset
1393 "Looking for %s in self.ass_ %s" % (gnome, self.ass_first_contigs)
14ecbe46ae9f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 78
diff changeset
1394 )
78
7bb6259ea52f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 76
diff changeset
1395 first = [x for x in self.ass_first_contigs if x[0] == gnome]
7bb6259ea52f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 76
diff changeset
1396 if len(first) > 0:
7bb6259ea52f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 76
diff changeset
1397 [gnome, refName, end] = first[0]
79
14ecbe46ae9f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 78
diff changeset
1398 start = 0
78
7bb6259ea52f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 76
diff changeset
1399 end = int(end)
7bb6259ea52f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 76
diff changeset
1400 drdict = {
79
14ecbe46ae9f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 78
diff changeset
1401 "refName": refName,
14ecbe46ae9f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 78
diff changeset
1402 "start": start,
14ecbe46ae9f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 78
diff changeset
1403 "end": end,
78
7bb6259ea52f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 76
diff changeset
1404 "reversed": False,
7bb6259ea52f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 76
diff changeset
1405 "assemblyName": gnome,
7bb6259ea52f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 76
diff changeset
1406 }
7bb6259ea52f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 76
diff changeset
1407 else:
7bb6259ea52f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 76
diff changeset
1408 ddl = default_data.get("defaultLocation", None)
7bb6259ea52f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 76
diff changeset
1409 if ddl:
7bb6259ea52f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 76
diff changeset
1410 loc_match = re.search(r"^([^:]+):([\d,]*)\.*([\d,]*)$", ddl)
7bb6259ea52f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 76
diff changeset
1411 # allow commas like 100,000 but ignore as integer
7bb6259ea52f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 76
diff changeset
1412 if loc_match:
7bb6259ea52f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 76
diff changeset
1413 refName = loc_match.group(1)
7bb6259ea52f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 76
diff changeset
1414 drdict["refName"] = refName
7bb6259ea52f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 76
diff changeset
1415 if loc_match.group(2) > "":
79
14ecbe46ae9f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 78
diff changeset
1416 drdict["start"] = int(
14ecbe46ae9f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 78
diff changeset
1417 loc_match.group(2).replace(",", "")
14ecbe46ae9f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 78
diff changeset
1418 )
78
7bb6259ea52f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 76
diff changeset
1419 if loc_match.group(3) > "":
7bb6259ea52f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 76
diff changeset
1420 drdict["end"] = int(loc_match.group(3).replace(",", ""))
7bb6259ea52f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 76
diff changeset
1421 else:
7bb6259ea52f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 76
diff changeset
1422 logging.info(
7bb6259ea52f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 76
diff changeset
1423 "@@@ regexp could not match contig:start..end in the supplied location %s - please fix"
7bb6259ea52f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 76
diff changeset
1424 % ddl
7bb6259ea52f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 76
diff changeset
1425 )
68
c4eb6a85db70 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit bd958a96352bf8dbd1fdb5a2e994d57a42446f33-dirty
fubar
parents: 65
diff changeset
1426 if drdict.get("refName", None):
c4eb6a85db70 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit bd958a96352bf8dbd1fdb5a2e994d57a42446f33-dirty
fubar
parents: 65
diff changeset
1427 # TODO displayedRegions is not just zooming to the region, it hides the rest of the chromosome
c4eb6a85db70 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit bd958a96352bf8dbd1fdb5a2e994d57a42446f33-dirty
fubar
parents: 65
diff changeset
1428 view_json["displayedRegions"] = [
c4eb6a85db70 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit bd958a96352bf8dbd1fdb5a2e994d57a42446f33-dirty
fubar
parents: 65
diff changeset
1429 drdict,
c4eb6a85db70 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit bd958a96352bf8dbd1fdb5a2e994d57a42446f33-dirty
fubar
parents: 65
diff changeset
1430 ]
c4eb6a85db70 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit bd958a96352bf8dbd1fdb5a2e994d57a42446f33-dirty
fubar
parents: 65
diff changeset
1431 logging.info("@@@ defaultlocation %s for default session" % drdict)
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1432 else:
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1433 logging.info(
78
7bb6259ea52f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 76
diff changeset
1434 "@@@ no track location for default session - please add one!"
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1435 )
68
c4eb6a85db70 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit bd958a96352bf8dbd1fdb5a2e994d57a42446f33-dirty
fubar
parents: 65
diff changeset
1436 session_views.append(view_json)
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1437 session_name = default_data.get("session_name", "New session")
10
c60b17456297 planemo upload commit 740eeca506257070c95f4e9f1a75911c31db5a04
fubar
parents: 9
diff changeset
1438 for key, value in mapped_chars.items():
c60b17456297 planemo upload commit 740eeca506257070c95f4e9f1a75911c31db5a04
fubar
parents: 9
diff changeset
1439 session_name = session_name.replace(value, key)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1440 session_json["name"] = session_name
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1441
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1442 if "views" not in session_json:
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1443 session_json["views"] = session_views
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1444 else:
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1445 session_json["views"] += session_views
72
2bdb748df098 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 9d5e563dde653450723415b0fccd2ebb4b82477e
fubar
parents: 71
diff changeset
1446 pp = json.dumps(session_views, indent=2)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1447 config_json["defaultSession"] = session_json
10
c60b17456297 planemo upload commit 740eeca506257070c95f4e9f1a75911c31db5a04
fubar
parents: 9
diff changeset
1448 self.config_json.update(config_json)
72
2bdb748df098 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 9d5e563dde653450723415b0fccd2ebb4b82477e
fubar
parents: 71
diff changeset
1449 logging.debug("defaultSession=%s" % (pp))
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1450 with open(self.config_json_file, "w") as config_file:
10
c60b17456297 planemo upload commit 740eeca506257070c95f4e9f1a75911c31db5a04
fubar
parents: 9
diff changeset
1451 json.dump(self.config_json, config_file, indent=2)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1452
73
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1453 def add_defsess_to_index(self, data):
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1454 """
80
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1455 Included on request of the new codeowner, from Anthony's IUC PR.
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1456 Had to be fixed to keep each assembly with the associated tracks for a default view.
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1457 Originally used only the first assembly, putting all tracks there and so breaking some
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1458 when tested with 2 or more. Seems ironic that this vital feature could not have ever been tested
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1459 given that my declining to add it was the basis for a reviewer's rejection of my original IUC PR.
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1460 A simple 2 line diff apparently.
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1461
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1462 The technical problem is that this index.html hack breaks the promise of all the form fields
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1463 for track controls such as visibility default that were working mostly. They need to be removed from the form by whoever
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1464 thought this method was a good solution to the JB2 bug breaking config.json style default
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1465 view coordinates.
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1466
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1467 And no, dear reviewer of this code, please leave this piece of history.
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1468 It is true and I prefer that it remain here to document my considerable discomfort at this unfair treatment.
73
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1469
79
14ecbe46ae9f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 78
diff changeset
1470 ----------------------------------------------------------
73
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1471 Add some default session settings: set some assemblies/tracks on/off
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1472
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1473 This allows to select a default view:
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1474 - jb type (Linear, Circular, etc)
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1475 - default location on an assembly
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1476 - default tracks
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1477 - ...
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1478
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1479 Different methods to do that were tested/discussed:
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1480 - using a defaultSession item in config.json: this proved to be difficult:
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1481 forced to write a full session block, including hard-coded/hard-to-guess items,
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1482 no good way to let Jbrowse2 display a scaffold without knowing its size
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1483 - using JBrowse2 as an embedded React component in a tool-generated html file:
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1484 it works but it requires generating js code to actually do what we want = chosing default view, assembly, tracks, ...
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1485 - writing a session-spec inside the config.json file: this is not yet supported as of 2.10.2 (see PR 4148 below)
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1486 a session-spec is a kind of simplified defaultSession where you don't need to specify every aspect of the session
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1487 - passing a session-spec through URL params by embedding the JBrowse2 index.html inside an iframe
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1488 we selected this option
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1489
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1490 Xrefs to understand the choices:
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1491 https://github.com/GMOD/jbrowse-components/issues/2708
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1492 https://github.com/GMOD/jbrowse-components/discussions/3568
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1493 https://github.com/GMOD/jbrowse-components/pull/4148
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1494 """
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1495 new_index = "Nothing written"
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1496 session_spec = {"views": []}
74
13ede71c3a4b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b
fubar
parents: 73
diff changeset
1497 logging.debug("def ass_first=%s\ndata=%s" % (self.ass_first_contigs, data))
73
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1498 for first_contig in self.ass_first_contigs:
75
9c8459ce7d88 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 74
diff changeset
1499 logging.debug("first contig=%s" % self.ass_first_contigs)
9c8459ce7d88 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 74
diff changeset
1500 [gnome, refName, end] = first_contig
73
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1501 start = 0
76
9e3eb6b26f85 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 75
diff changeset
1502 aview = {
9e3eb6b26f85 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 75
diff changeset
1503 "assembly": gnome,
9e3eb6b26f85 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 75
diff changeset
1504 "loc": "{}:{}..{}".format(refName, start, end),
9e3eb6b26f85 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 75
diff changeset
1505 "type": "LinearGenomeView",
9e3eb6b26f85 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 75
diff changeset
1506 "tracks": data[gnome]["tracks"],
9e3eb6b26f85 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 75
diff changeset
1507 }
9e3eb6b26f85 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 75
diff changeset
1508 session_spec["views"].append(aview)
73
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1509 sess = json.dumps(session_spec, sort_keys=True, indent=2)
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1510 new_index = INDEX_TEMPLATE.replace(
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1511 "__SESSION_SPEC__", "&session=spec-{}".format(sess)
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1512 )
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1513
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1514 os.rename(
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1515 os.path.join(self.outdir, "index.html"),
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1516 os.path.join(self.outdir, "index_noview.html"),
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1517 )
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1518
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1519 with open(os.path.join(self.outdir, "index.html"), "w") as nind:
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1520 nind.write(new_index)
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1521 logging.debug(
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1522 "#### add_defsession gnome=%s refname=%s\nsession_spec=%s\nnew_index=%s"
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1523 % (gnome, refName, sess, new_index)
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1524 )
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1525
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1526 def add_general_configuration(self, data):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1527 """
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1528 Add some general configuration to the config.json file
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1529 """
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1530
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1531 config_path = self.config_json_file
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1532 if os.path.exists(config_path):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1533 with open(config_path, "r") as config_file:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1534 config_json = json.load(config_file)
10
c60b17456297 planemo upload commit 740eeca506257070c95f4e9f1a75911c31db5a04
fubar
parents: 9
diff changeset
1535 else:
c60b17456297 planemo upload commit 740eeca506257070c95f4e9f1a75911c31db5a04
fubar
parents: 9
diff changeset
1536 config_json = {}
c60b17456297 planemo upload commit 740eeca506257070c95f4e9f1a75911c31db5a04
fubar
parents: 9
diff changeset
1537 if self.config_json:
c60b17456297 planemo upload commit 740eeca506257070c95f4e9f1a75911c31db5a04
fubar
parents: 9
diff changeset
1538 config_json.update(self.config_json)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1539 config_data = {}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1540
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1541 config_data["disableAnalytics"] = data.get("analytics", "false") == "true"
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1542
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1543 config_data["theme"] = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1544 "palette": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1545 "primary": {"main": data.get("primary_color", "#0D233F")},
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1546 "secondary": {"main": data.get("secondary_color", "#721E63")},
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1547 "tertiary": {"main": data.get("tertiary_color", "#135560")},
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1548 "quaternary": {"main": data.get("quaternary_color", "#FFB11D")},
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1549 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1550 "typography": {"fontSize": int(data.get("font_size", 10))},
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1551 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1552 if not config_json.get("configuration", None):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1553 config_json["configuration"] = {}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1554 config_json["configuration"].update(config_data)
10
c60b17456297 planemo upload commit 740eeca506257070c95f4e9f1a75911c31db5a04
fubar
parents: 9
diff changeset
1555 self.config_json.update(config_json)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1556 with open(config_path, "w") as config_file:
10
c60b17456297 planemo upload commit 740eeca506257070c95f4e9f1a75911c31db5a04
fubar
parents: 9
diff changeset
1557 json.dump(self.config_json, config_file, indent=2)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1558
73
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1559 def clone_jbrowse(self, realclone=False):
60
81d535970196 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 403a35e1245fa5e62f4be6116a725b9e4d9c353a
fubar
parents: 59
diff changeset
1560 """Clone a JBrowse directory into a destination directory. This also works in Biocontainer testing now
81d535970196 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 403a35e1245fa5e62f4be6116a725b9e4d9c353a
fubar
parents: 59
diff changeset
1561 Leave as True between version updates on temporary tools - requires manual conda trigger :(
81d535970196 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 403a35e1245fa5e62f4be6116a725b9e4d9c353a
fubar
parents: 59
diff changeset
1562 """
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1563 dest = self.outdir
56
c0097a584a8a planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674
fubar
parents: 55
diff changeset
1564 if realclone:
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1565 self.subprocess_check_call(
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1566 ["jbrowse", "create", dest, "-f", "--tag", f"{JB2VER}"]
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1567 )
56
c0097a584a8a planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674
fubar
parents: 55
diff changeset
1568 else:
c0097a584a8a planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674
fubar
parents: 55
diff changeset
1569 shutil.copytree(self.jbrowse2path, dest, dirs_exist_ok=True)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1570 for fn in [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1571 "asset-manifest.json",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1572 "favicon.ico",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1573 "robots.txt",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1574 "umd_plugin.js",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1575 "version.txt",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1576 "test_data",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1577 ]:
38
07849bf248e3 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a74e469a81b38c7142f63de510ae31d3754d1767
fubar
parents: 37
diff changeset
1578 cmd = ["rm", "-rf", os.path.join(dest, fn)]
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1579 self.subprocess_check_call(cmd)
38
07849bf248e3 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a74e469a81b38c7142f63de510ae31d3754d1767
fubar
parents: 37
diff changeset
1580 cmd = ["cp", os.path.join(INSTALLED_TO, "jb2_webserver.py"), dest]
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1581 self.subprocess_check_call(cmd)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1582
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1583
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1584 def parse_style_conf(item):
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1585 if item.text.lower() in ["false", "true", "yes", "no"]:
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1586 return item.text.lower in ("yes", "true")
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1587 else:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1588 return item.text
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1589
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1590
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1591 if __name__ == "__main__":
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1592 parser = argparse.ArgumentParser(description="", epilog="")
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1593 parser.add_argument("--xml", help="Track Configuration")
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1594 parser.add_argument(
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1595 "--jbrowse2path", help="Path to JBrowse2 directory in biocontainer or Conda"
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1596 )
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1597 parser.add_argument("--outdir", help="Output directory", default="out")
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1598 parser.add_argument("--version", "-V", action="version", version=JB2VER)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1599 args = parser.parse_args()
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1600 tree = ET.parse(args.xml)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1601 root = tree.getroot()
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1602
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1603 # This should be done ASAP
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1604 GALAXY_INFRASTRUCTURE_URL = root.find("metadata/galaxyUrl").text
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1605 # Sometimes this comes as `localhost` without a protocol
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1606 if not GALAXY_INFRASTRUCTURE_URL.startswith("http"):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1607 # so we'll prepend `http://` and hope for the best. Requests *should*
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1608 # be GET and not POST so it should redirect OK
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1609 GALAXY_INFRASTRUCTURE_URL = "http://" + GALAXY_INFRASTRUCTURE_URL
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1610
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1611 jc = JbrowseConnector(outdir=args.outdir, jbrowse2path=args.jbrowse2path)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1612
73
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1613 default_session_data = {}
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1614 for ass in root.findall("assembly"):
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1615 genomes = [
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1616 {
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1617 "path": x.attrib["path"],
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1618 "label": x.attrib["label"],
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1619 "useuri": x.attrib["useuri"],
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1620 "meta": metadata_from_node(x.find("metadata")),
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1621 }
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1622 for x in ass.findall("metadata/genomes/genome")
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1623 ]
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1624 assref_name = jc.process_genomes(genomes)
73
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1625 if not default_session_data.get(assref_name, None):
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1626 default_session_data[assref_name] = {
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1627 "tracks": [],
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1628 "style": {},
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1629 "style_labels": {},
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1630 "visibility": {
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1631 "default_on": [],
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1632 "default_off": [],
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1633 },
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1634 }
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1635 for track in ass.find("tracks"):
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1636 track_conf = {}
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1637 track_conf["trackfiles"] = []
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1638 track_conf["assemblyNames"] = assref_name
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1639 is_multi_bigwig = False
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1640 try:
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1641 if track.find("options/wiggle/multibigwig") and (
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1642 track.find("options/wiggle/multibigwig").text == "True"
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1643 ):
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1644 is_multi_bigwig = True
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1645 multi_bigwig_paths = []
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1646 except KeyError:
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1647 pass
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1648
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1649 trackfiles = track.findall("files/trackFile")
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1650 if trackfiles:
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1651 for x in track.findall("files/trackFile"):
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1652 track_conf["label"] = x.attrib["label"]
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1653 track_conf["useuri"] = x.attrib["useuri"]
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1654 if is_multi_bigwig:
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1655 multi_bigwig_paths.append(
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1656 (
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1657 x.attrib["label"],
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1658 x.attrib["useuri"],
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1659 os.path.realpath(x.attrib["path"]),
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1660 )
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1661 )
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1662 else:
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1663 if trackfiles:
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1664 metadata = metadata_from_node(x.find("metadata"))
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1665 track_conf["dataset_id"] = metadata.get(
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1666 "dataset_id", "None"
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1667 )
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1668 if x.attrib["useuri"].lower() == "yes":
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1669 tfa = (
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1670 x.attrib["path"],
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1671 x.attrib["ext"],
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1672 x.attrib["useuri"],
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1673 x.attrib["label"],
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1674 metadata,
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1675 )
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1676 else:
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1677 tfa = (
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1678 os.path.realpath(x.attrib["path"]),
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1679 x.attrib["ext"],
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1680 x.attrib["useuri"],
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1681 x.attrib["label"],
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1682 metadata,
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1683 )
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1684 track_conf["trackfiles"].append(tfa)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1685
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1686 if is_multi_bigwig:
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1687 metadata = metadata_from_node(x.find("metadata"))
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1688
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1689 track_conf["trackfiles"].append(
17
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1690 (
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1691 multi_bigwig_paths, # Passing an array of paths to represent as one track
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1692 "bigwig_multiple",
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1693 "MultiBigWig", # Giving an hardcoded name for now
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1694 {}, # No metadata for multiple bigwig
17
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1695 )
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1696 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1697
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1698 track_conf["category"] = track.attrib["cat"]
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1699 track_conf["format"] = track.attrib["format"]
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1700 track_conf["conf"] = etree_to_dict(track.find("options"))
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1701 track_conf["category"] = track.attrib["cat"]
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1702 track_conf["format"] = track.attrib["format"]
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1703 keys = jc.process_annotations(track_conf)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1704
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1705 if keys:
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1706 for key in keys:
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1707 vis = track.attrib.get("visibility", "default_off")
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1708 if not vis:
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1709 vis = "default_off"
73
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1710 default_session_data[assref_name]["visibility"][vis].append(key)
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1711 if track.find("options/style"):
73
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1712 default_session_data[assref_name]["style"][key] = {
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1713 item.tag: parse_style_conf(item)
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1714 for item in track.find("options/style")
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1715 }
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1716 else:
73
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1717 default_session_data[assref_name]["style"][key] = {}
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1718 logging.debug("no options/style found for %s" % (key))
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1719
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1720 if track.find("options/style_labels"):
73
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1721 default_session_data[assref_name]["style_labels"][key] = {
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1722 item.tag: parse_style_conf(item)
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1723 for item in track.find("options/style_labels")
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1724 }
73
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1725 default_session_data[assref_name]["tracks"].append(key)
15
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1726 default_session_data["defaultLocation"] = root.find(
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1727 "metadata/general/defaultLocation"
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1728 ).text
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1729 default_session_data["session_name"] = root.find(
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1730 "metadata/general/session_name"
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1731 ).text
61
e7a6f7a7148d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 6dde5ad41d63730085116ab2c9a9d3e500a760e4-dirty
fubar
parents: 60
diff changeset
1732 logging.debug("default_session=%s" % (default_session_data))
34
2893ef33fba9 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd
fubar
parents: 32
diff changeset
1733 jc.zipOut = root.find("metadata/general/zipOut").text == "true"
15
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1734 general_data = {
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1735 "analytics": root.find("metadata/general/analytics").text,
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1736 "primary_color": root.find("metadata/general/primary_color").text,
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1737 "secondary_color": root.find("metadata/general/secondary_color").text,
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1738 "tertiary_color": root.find("metadata/general/tertiary_color").text,
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1739 "quaternary_color": root.find("metadata/general/quaternary_color").text,
15
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1740 "font_size": root.find("metadata/general/font_size").text,
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1741 }
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1742 jc.add_general_configuration(general_data)
62
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1743 trackconf = jc.config_json.get("tracks", [])
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1744 for gnome in jc.genome_names:
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1745 trackconf += jc.tracksToAdd[gnome]
ab0d6782a95f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 2b6d4a24585beb1ba5055e5d34aacb3b299b1943-dirty
fubar
parents: 61
diff changeset
1746 jc.config_json["tracks"] = trackconf
68
c4eb6a85db70 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit bd958a96352bf8dbd1fdb5a2e994d57a42446f33-dirty
fubar
parents: 65
diff changeset
1747 assconf = jc.config_json.get("assemblies", [])
c4eb6a85db70 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit bd958a96352bf8dbd1fdb5a2e994d57a42446f33-dirty
fubar
parents: 65
diff changeset
1748 assconf += jc.assemblies
c4eb6a85db70 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit bd958a96352bf8dbd1fdb5a2e994d57a42446f33-dirty
fubar
parents: 65
diff changeset
1749 jc.config_json["assemblies"] = assconf
73
3b2815efa5d9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b361309b05a861da9b64e1324157a8c32767e0bf
fubar
parents: 72
diff changeset
1750 logging.debug("assemblies=%s, gnames=%s" % (assconf, jc.genome_names))
9
a26c41e304c3 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1b7e6ba50013775621cbdfdc101152a7f5c5e15b
fubar
parents: 7
diff changeset
1751 jc.write_config()
80
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1752 jc.add_default_session(default_session_data)
79
14ecbe46ae9f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
fubar
parents: 78
diff changeset
1753 # note that this can be left in the config.json but has NO EFFECT if add_defsess_to_index is called.
80
dff27c9f6d72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7bb0fa234bdbc42768b30e426472a47b2523297f
fubar
parents: 79
diff changeset
1754 # jc.add_defsess_to_index(default_session_data)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1755 # jc.text_index() not sure what broke here.