annotate jbrowse2.py @ 7:b04fd993b31e draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
author fubar
date Wed, 17 Jan 2024 07:50:52 +0000
parents 79f7265f90bd
children a26c41e304c3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1 #!/usr/bin/env python
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
2 # change to accumulating all configuration for config.json based on the default from the clone
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 hashlib
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
7 import json
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
8 import logging
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
9 import os
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
10 import re
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
11 import shutil
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
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
15 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
16 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
17
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
18 logging.basicConfig(level=logging.INFO)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
19 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
20
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
21 JB2VER = "v2.10.0"
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
22 # version pinned for cloning
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
23
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
24 TODAY = datetime.datetime.now().strftime("%Y-%m-%d")
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
25 GALAXY_INFRASTRUCTURE_URL = None
5
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
26 JB2REL = "v2.10.0"
3
2de9f585505b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b30d2e277cc360437a02fa812c577c0c8d997cff-dirty
fubar
parents: 0
diff changeset
27 # version pinned for cloning
2de9f585505b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b30d2e277cc360437a02fa812c577c0c8d997cff-dirty
fubar
parents: 0
diff changeset
28
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
29 mapped_chars = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
30 ">": "__gt__",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
31 "<": "__lt__",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
32 "'": "__sq__",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
33 '"': "__dq__",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
34 "[": "__ob__",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
35 "]": "__cb__",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
36 "{": "__oc__",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
37 "}": "__cc__",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
38 "@": "__at__",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
39 "#": "__pd__",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
40 "": "__cn__",
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
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
43
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
44 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
45
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
46 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
47 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
48 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
49 {opacity}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
50 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
51 }}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
52 """
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
53
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
54 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
55 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
56 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
57 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
58 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
59 }}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
60 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
61 return;
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
62 }}else{{
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
63 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
64 }}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
65 }};
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
66
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
67 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
68 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
69 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
70 }}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
71 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
72 return;
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
73 }}else{{
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
74 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
75 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
76 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
77 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
78 return x;
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
79 }}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
80 }}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
81 return;
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
82 }}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
83 }};
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 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
86 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
87 {opacity}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
88 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
89 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
90 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
91 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
92 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
93 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
94 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
95 }}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
96 """
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
97
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
98 OPACITY_MATH = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
99 "linear": """
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
100 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
101 """,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
102 "logarithmic": """
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
103 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
104 """,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
105 "blast": """
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
106 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
107 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
108 opacity = 1;
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
109 }} else {{
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
110 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
111 }}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
112 """,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
113 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
114
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
115 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
116 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
117 (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
118 (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
119 (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
120 (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
121 (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
122 (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
123 (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
124 (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
125 (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
126 (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
127 (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
128 (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
129 (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
130 (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
131 (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
132 (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
133 (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
134 ]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
135
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
136 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
137 "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
138 "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
139 "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
140 "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
141 "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
142 "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
143 "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
144 "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
145 "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
146 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
147
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
148 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
149 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
150
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
151 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
152 # 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
153 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
154
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
155 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
156 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
157 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
158 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
159 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
160 try:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
161 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
162 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
163 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
164
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
165 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
166 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
167
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
168 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
169 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
170 except Exception:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
171 pass
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
172 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
173
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
174 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
175 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
176
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
177 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
178 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
179 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
180 ]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
181 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
182 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
183
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
184 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
185 trackConfig = {"menuTemplate": [{}, {}, {}, {}]}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
186
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
187 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
188 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
189 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
190 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
191
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
192 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
193 tpl = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
194 "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
195 "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
196 "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
197 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
198 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
199 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
200 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
201 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
202 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
203 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
204
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
205 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
206
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
207 return trackConfig
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_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
210 # 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
211 trackConfig = {"style": {}}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
212 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
213
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
214 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
215 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
216
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
217 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
218 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
219 *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
220 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
221 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
222 *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
223 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
224
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
225 # 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
226 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
227 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
228 # 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
229 # 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
230 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
231 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
232 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
233 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
234 if track["scaling"]["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
235 trackConfig["style"]["color"] = track["scaling"]["scheme"]["color"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
236 else:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
237 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
238 *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
239 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
240 else:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
241 # Scored method
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
242 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
243 # 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
244 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
245 # 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
246 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
247 # 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
248 # ==================================
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
249 # 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
250 # ==================================
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
251 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
252 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
253 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
254 **{
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
255 "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
256 "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
257 "red": red,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
258 "green": green,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
259 "blue": blue,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
260 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
261 )
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"] = color_function.replace("\n", "")
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
263 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
264 # 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
265 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
266 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
267 # Get min/max and build a scoring function since JBrowse doesn't
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
268 if scales["type"] == "automatic" or scales["type"] == "__auto__":
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
269 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
270 else:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
271 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
272 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
273
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
274 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
275 user_color = "undefined"
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
276 auto_color = "'%s'" % self.hex_from_rgb(*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
277 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
278 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
279 *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
280 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
281 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
282 else:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
283 user_color = "undefined"
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
284 auto_color = "'%s'" % self.hex_from_rgb(*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
285
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
286 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
287 **{
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
288 "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
289 **{"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
290 ),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
291 "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
292 "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
293 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
294 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
295
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
296 trackConfig["style"]["color"] = color_function.replace("\n", "")
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
297 return trackConfig
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
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
300 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
301 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
302 return {}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
303
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
304 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
305 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
306 if children:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
307 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
308 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
309 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
310 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
311 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
312 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
313 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
314 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
315 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
316 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
317 if text:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
318 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
319 else:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
320 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
321 return d
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
322
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 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
325
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
326
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
327 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
328 metadata = {}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
329 try:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
330 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
331 # exit early
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
332 return metadata
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
333 except Exception:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
334 return {}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
335
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
336 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
337 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
338
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
339 for (key, value) in node.findall("history")[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
340 metadata["history_%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
341
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
342 for (key, value) in node.findall("metadata")[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
343 metadata["metadata_%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
344
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
345 for (key, value) in node.findall("tool")[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
346 metadata["tool_%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
347
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
348 # Additional Mappings applied:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
349 metadata[
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
350 "dataset_edam_format"
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
351 ] = '<a target="_blank" href="http://edamontology.org/{0}">{1}</a>'.format(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
352 metadata["dataset_edam_format"], metadata["dataset_file_ext"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
353 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
354 metadata["history_user_email"] = '<a href="mailto:{0}">{0}</a>'.format(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
355 metadata["history_user_email"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
356 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
357 metadata["hist_name"] = metadata["history_display_name"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
358 metadata[
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
359 "history_display_name"
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
360 ] = '<a target="_blank" href="{galaxy}/history/view/{encoded_hist_id}">{hist_name}</a>'.format(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
361 galaxy=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
362 encoded_hist_id=metadata["history_id"],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
363 hist_name=metadata["history_display_name"],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
364 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
365 metadata[
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
366 "tool_tool"
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
367 ] = '<a target="_blank" href="{galaxy}/datasets/{encoded_id}/show_params">{tool_id}</a>'.format(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
368 galaxy=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
369 encoded_id=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
370 tool_id=metadata["tool_tool_id"],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
371 # tool_version=metadata['tool_tool_version'],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
372 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
373 return metadata
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
374
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
375
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
376 class JbrowseConnector(object):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
377 def __init__(self, outdir, genomes):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
378 self.usejson = True
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
379 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
380 self.outdir = outdir
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
381 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
382 self.genome_paths = genomes
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
383 self.genome_name = None
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
384 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
385 self.trackIdlist = []
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
386 self.tracksToAdd = []
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
387 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
388 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
389 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
390
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
391 def subprocess_check_call(self, command, output=None):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
392 if output:
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
393 log.debug("cd %s && %s > %s", self.outdir, " ".join(command), output)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
394 subprocess.check_call(command, cwd=self.outdir, stdout=output)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
395 else:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
396 log.debug("cd %s && %s", self.outdir, " ".join(command))
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
397 subprocess.check_call(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
398
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
399 def subprocess_popen(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
400 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
401 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
402 command,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
403 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
404 shell=True,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
405 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
406 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
407 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
408 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
409 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
410 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
411 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
412 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
413 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
414 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
415 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
416
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
417 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
418 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
419 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
420
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
421 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
422 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
423 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
424 ):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
425 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
426 else:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
427 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
428
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
429 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
430
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
431 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
432
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
433 style_data = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
434 "type": "LinearBasicDisplay",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
435 "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
436 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
437
5
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
438 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
439 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
440 style_data["displayId"] = trackDict["displays"][0]["displayId"]
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
441 return {
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
442 "displays": [
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
443 style_data,
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
444 ]
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
445 }
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
446
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
447 def process_genomes(self):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
448 assemblies = []
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
449 for i, genome_node in enumerate(self.genome_paths):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
450 genome_name = genome_node["meta"]["dataset_dname"].strip()
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
451 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
452 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
453 # spaces and cruft break scripts when substituted
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
454 fapath = genome_node["path"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
455 assem = self.make_assembly(fapath, genome_name)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
456 assemblies.append(assem)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
457 self.genome_names.append(genome_name)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
458 if self.genome_name is None:
3
2de9f585505b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b30d2e277cc360437a02fa812c577c0c8d997cff-dirty
fubar
parents: 0
diff changeset
459 self.genome_name = (
2de9f585505b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b30d2e277cc360437a02fa812c577c0c8d997cff-dirty
fubar
parents: 0
diff changeset
460 genome_name # first one for all tracks - other than paf
2de9f585505b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b30d2e277cc360437a02fa812c577c0c8d997cff-dirty
fubar
parents: 0
diff changeset
461 )
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
462 if self.config_json.get("assemblies", None):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
463 self.config_json["assemblies"] += assemblies
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
464 else:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
465 self.config_json["assemblies"] = assemblies
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
466
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
467 def make_assembly(self, fapath, gname):
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
468 hashData = [
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
469 fapath,
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
470 gname,
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
471 ]
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
472 hashData = "|".join(hashData).encode("utf-8")
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
473 ghash = hashlib.md5(hashData).hexdigest()
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
474 faname = ghash + ".fa.gz"
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
475 fadest = os.path.join(self.outdir, faname)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
476 cmd = "bgzip -i -c %s -I %s.gzi > %s && samtools faidx %s" % (
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
477 fapath,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
478 fadest,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
479 fadest,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
480 fadest,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
481 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
482 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
483 adapter = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
484 "type": "BgzipFastaAdapter",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
485 "fastaLocation": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
486 "uri": faname,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
487 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
488 "faiLocation": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
489 "uri": faname + ".fai",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
490 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
491 "gziLocation": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
492 "uri": faname + ".gzi",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
493 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
494 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
495 trackDict = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
496 "name": gname,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
497 "sequence": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
498 "type": "ReferenceSequenceTrack",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
499 "trackId": gname,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
500 "adapter": adapter,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
501 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
502 "rendering": {"type": "DivSequenceRenderer"},
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
503 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
504 return trackDict
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
505
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
506 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
507 cmd = [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
508 "jbrowse",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
509 "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
510 "-s",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
511 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
512 "-t",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
513 ",".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
514 "-n",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
515 "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
516 "--target",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
517 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
518 "-v",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
519 " LinearGenomeView",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
520 ]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
521 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
522
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
523 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
524 with open(self.config_json_file, "w") as fp:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
525 json.dump(self.config_json, fp)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
526
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
527 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
528 # Index tracks
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
529 args = [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
530 "jbrowse",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
531 "text-index",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
532 "--target",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
533 os.path.join(self.outdir, "data"),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
534 "--assemblies",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
535 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
536 ]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
537
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
538 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
539 if tracks:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
540 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
541
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
542 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
543
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
544 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
545 """
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
546 HiC adapter.
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
547 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
548 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
549 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
550 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
551 'BgzipFastaAdapter'
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
552 fastaLocation:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
553 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
554 faiLocation:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
555 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
556 gziLocation:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
557 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
558 Cool will not be likely to be a good fit - see discussion at https://github.com/GMOD/jbrowse-components/issues/2438
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
559 """
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
560 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
561 # 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
562 # 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
563 # url = "%s/api/datasets/%s/display?to_ext=hic " % (self.giURL, dsId)
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
564 hname = 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
565 dest = os.path.join(self.outdir, hname)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
566 cmd = ["cp", data, dest]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
567 # these can be very big.
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
568 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
569 floc = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
570 "uri": hname,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
571 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
572 trackDict = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
573 "type": "HicTrack",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
574 "trackId": tId,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
575 "name": hname,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
576 "assemblyNames": [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
577 "adapter": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
578 "type": "HicAdapter",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
579 "hicLocation": floc,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
580 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
581 "displays": [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
582 {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
583 "type": "LinearHicDisplay",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
584 "displayId": "%s-LinearHicDisplay" % tId,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
585 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
586 ],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
587 }
5
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
588 style_json = self._prepare_track_style(trackDict)
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
589 trackDict["style"] = style_json
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
590 self.tracksToAdd.append(trackDict)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
591 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
592
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
593 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
594 """
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
595 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
596 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
597 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
598 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
599 """
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
600 mafPlugin = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
601 "plugins": [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
602 {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
603 "name": "MafViewer",
3
2de9f585505b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b30d2e277cc360437a02fa812c577c0c8d997cff-dirty
fubar
parents: 0
diff changeset
604 "url": "https://unpkg.com/browse/jbrowse-plugin-mafviewer@1.0.6/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
605 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
606 ]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
607 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
608 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
609 fname = "%s.bed" % tId
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
610 dest = "%s/%s" % (self.outdir, fname)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
611 gname = 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
612 cmd = [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
613 "bash",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
614 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
615 data,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
616 gname,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
617 INSTALLED_TO,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
618 dest,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
619 ]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
620 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
621 # Construct samples list
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
622 # We could get this from galaxy metadata, not sure how easily.
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
623 ps = subprocess.Popen(["grep", "^s [^ ]*", "-o", data], 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
624 output = subprocess.check_output(("sort", "-u"), stdin=ps.stdout)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
625 ps.wait()
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
626 outp = output.decode("ascii")
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
627 soutp = outp.split("\n")
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
628 samp = [x.split("s ")[1] for x in soutp if x.startswith("s ")]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
629 samples = [x.split(".")[0] for x in samp]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
630 trackDict = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
631 "type": "MafTrack",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
632 "trackId": tId,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
633 "name": trackData["name"],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
634 "adapter": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
635 "type": "MafTabixAdapter",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
636 "samples": samples,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
637 "bedGzLocation": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
638 "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
639 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
640 "index": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
641 "location": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
642 "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
643 },
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 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
646 "assemblyNames": [self.genome_name],
5
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
647 "displays": [
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
648 {
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
649 "type": "LinearBasicDisplay",
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
650 "displayId": "%s-LinearBasicDisplay" % tId,
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
651 },
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
652 {"type": "LinearArcDisplay", "displayId": "%s-LinearArcDisplay" % tId},
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
653 ],
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
654 }
5
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
655 style_json = self._prepare_track_style(trackDict)
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
656 trackDict["style"] = style_json
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
657 self.tracksToAdd.append(trackDict)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
658 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
659 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
660 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
661 else:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
662 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
663
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
664 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
665 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
666 cmd = [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
667 "python",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
668 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
669 "--trim",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
670 "--trim_end",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
671 "--include_seq",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
672 "--min_gap",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
673 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
674 xml,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
675 ]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
676 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
677 gff3_unrebased.close()
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
678 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
679
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
680 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
681 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
682
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
683 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
684 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
685 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
686 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
687 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
688 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
689 subprocess.check_call(cmd, cwd=self.outdir, stdout=gff3_rebased)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
690 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
691
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
692 # 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
693 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
694 os.unlink(gff3_rebased.name)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
695 url = "%s.gff3" % trackData["label"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
696 dest = "%s/%s" % (self.outdir, url)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
697 self._sort_gff(gff3, dest)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
698 url = url + ".gz"
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
699 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
700 trackDict = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
701 "type": "FeatureTrack",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
702 "trackId": tId,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
703 "name": trackData["name"],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
704 "assemblyNames": [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
705 "adapter": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
706 "type": "Gff3TabixAdapter",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
707 "gffGzLocation": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
708 "uri": url,
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 "index": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
711 "location": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
712 "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
713 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
714 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
715 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
716 "displays": [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
717 {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
718 "type": "LinearBasicDisplay",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
719 "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
720 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
721 {"type": "LinearArcDisplay", "displayId": "%s-LinearArcDisplay" % tId},
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
722 ],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
723 }
5
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
724 style_json = self._prepare_track_style(trackDict)
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
725 trackDict["style"] = style_json
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
726 self.tracksToAdd.append(trackDict)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
727 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
728 os.unlink(gff3)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
729
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
730 def add_bigwig(self, data, trackData):
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
731 url = "%s.bigwig" % trackData["label"]
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
732 # slashes in names cause path trouble
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
733 dest = os.path.join(self.outdir, url)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
734 cmd = ["cp", data, dest]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
735 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
736 bwloc = {"uri": url}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
737 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
738 trackDict = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
739 "type": "QuantitativeTrack",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
740 "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
741 "name": trackData["name"],
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
742 "assemblyNames": [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
743 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
744 ],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
745 "adapter": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
746 "type": "BigWigAdapter",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
747 "bigWigLocation": bwloc,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
748 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
749 "displays": [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
750 {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
751 "type": "LinearWiggleDisplay",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
752 "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
753 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
754 ],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
755 }
5
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
756 style_json = self._prepare_track_style(trackDict)
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
757 trackDict["style"] = style_json
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
758 self.tracksToAdd.append(trackDict)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
759 self.trackIdlist.append(tId)
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
760 logging.debug("#### wig trackData=%s" % str(trackData))
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
761
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
762 def add_bam(self, data, trackData, bamOpts, bam_index=None, **kwargs):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
763 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
764 fname = "%s.bam" % trackData["label"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
765 dest = "%s/%s" % (self.outdir, fname)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
766 url = fname
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
767 self.subprocess_check_call(["cp", data, dest])
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
768 bloc = {"uri": url}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
769 if bam_index is not None and os.path.exists(os.path.realpath(bam_index)):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
770 # bai most probably made by galaxy and stored in galaxy dirs, need to copy it to dest
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
771 self.subprocess_check_call(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
772 ["cp", os.path.realpath(bam_index), dest + ".bai"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
773 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
774 else:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
775 # Can happen in exotic condition
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
776 # e.g. if bam imported as symlink with datatype=unsorted.bam, then datatype changed to bam
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
777 # => no index generated by galaxy, but there might be one next to the symlink target
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
778 # this trick allows to skip the bam sorting made by galaxy if already done outside
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
779 if os.path.exists(os.path.realpath(data) + ".bai"):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
780 self.symlink_or_copy(os.path.realpath(data) + ".bai", dest + ".bai")
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
781 else:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
782 log.warn("Could not find a bam index (.bai file) for %s", data)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
783 trackDict = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
784 "type": "AlignmentsTrack",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
785 "trackId": tId,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
786 "name": trackData["name"],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
787 "assemblyNames": [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
788 "adapter": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
789 "type": "BamAdapter",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
790 "bamLocation": bloc,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
791 "index": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
792 "location": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
793 "uri": fname + ".bai",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
794 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
795 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
796 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
797 "displays": [
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 "type": "LinearAlignmentsDisplay",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
800 "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
801 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
802 ],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
803 }
5
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
804 style_json = self._prepare_track_style(trackDict)
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
805 trackDict["style"] = style_json
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
806 self.tracksToAdd.append(trackDict)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
807 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
808
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
809 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
810 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
811 url = "%s/api/datasets/%s/display" % (
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
812 self.giURL,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
813 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
814 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
815 url = "%s.vcf.gz" % tId
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
816 dest = "%s/%s" % (self.outdir, url)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
817 cmd = "bgzip -c %s > %s" % (data, dest)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
818 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
819 cmd = ["tabix", "-f", "-p", "vcf", dest]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
820 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
821 trackDict = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
822 "type": "VariantTrack",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
823 "trackId": tId,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
824 "name": trackData["name"],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
825 "assemblyNames": [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
826 "adapter": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
827 "type": "VcfTabixAdapter",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
828 "vcfGzLocation": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
829 "uri": url,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
830 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
831 "index": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
832 "location": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
833 "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
834 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
835 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
836 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
837 "displays": [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
838 {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
839 "type": "LinearVariantDisplay",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
840 "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
841 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
842 {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
843 "type": "ChordVariantDisplay",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
844 "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
845 },
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": "LinearPairedArcDisplay",
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-LinearPairedArcDisplay" % 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 }
5
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
852 style_json = self._prepare_track_style(trackDict)
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
853 trackDict["style"] = style_json
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
854 self.tracksToAdd.append(trackDict)
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
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
857 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
858 # 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
859 if not os.path.exists(dest + ".gz"):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
860 cmd = "jbrowse sort-gff %s | bgzip -c > %s.gz" % (
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
861 data,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
862 dest,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
863 ) # "gff3sort.pl --precise '%s' | grep -v \"^$\" > '%s'"
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
864 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
865 self.subprocess_check_call(["tabix", "-f", "-p", "gff", dest + ".gz"])
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
866
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
867 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
868 # 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
869 if not os.path.exists(dest):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
870 cmd = "sort -k1,1 -k2,2n %s | bgzip -c > %s" % (data, dest)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
871 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
872 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
873 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
874
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
875 def add_gff(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
876 url = "%s.%s" % (trackData["label"], ext)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
877 dest = "%s/%s" % (self.outdir, url)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
878 self._sort_gff(data, dest)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
879 url = url + ".gz"
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
880 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
881 trackDict = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
882 "type": "FeatureTrack",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
883 "trackId": tId,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
884 "name": trackData["name"],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
885 "assemblyNames": [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
886 "adapter": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
887 "type": "Gff3TabixAdapter",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
888 "gffGzLocation": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
889 "uri": url,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
890 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
891 "index": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
892 "location": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
893 "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
894 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
895 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
896 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
897 "displays": [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
898 {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
899 "type": "LinearBasicDisplay",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
900 "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
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": "LinearArcDisplay", "displayId": "%s-LinearArcDisplay" % tId},
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
903 ],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
904 }
5
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
905 style_json = self._prepare_track_style(trackDict)
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
906 trackDict["style"] = style_json
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
907 self.tracksToAdd.append(trackDict)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
908 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
909
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
910 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
911 url = "%s.%s" % (trackData["label"], ext)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
912 dest = "%s/%s.gz" % (self.outdir, url)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
913 self._sort_bed(data, dest)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
914 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
915 url = url + ".gz"
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
916 trackDict = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
917 "type": "FeatureTrack",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
918 "trackId": tId,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
919 "name": trackData["name"],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
920 "assemblyNames": [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
921 "adapter": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
922 "type": "BedTabixAdapter",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
923 "bedGzLocation": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
924 "uri": url,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
925 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
926 "index": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
927 "location": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
928 "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
929 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
930 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
931 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
932 "displays": [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
933 {
5
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
934 "type": "LinearPileupDisplay",
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
935 "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
936 },
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
937 {
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
938 "type": "LinearBasicDisplay",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
939 "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
940 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
941 {"type": "LinearArcDisplay", "displayId": "%s-LinearArcDisplay" % tId},
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
942 ],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
943 }
5
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
944 style_json = self._prepare_track_style(trackDict)
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
945 trackDict["style"] = style_json
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
946 self.tracksToAdd.append(trackDict)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
947 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
948
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
949 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
950 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
951 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
952 pgname = pafOpts["genome_label"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
953 if len(pgname.split() > 1):
3
2de9f585505b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b30d2e277cc360437a02fa812c577c0c8d997cff-dirty
fubar
parents: 0
diff changeset
954 pgname = pgname.split()[
2de9f585505b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b30d2e277cc360437a02fa812c577c0c8d997cff-dirty
fubar
parents: 0
diff changeset
955 0
2de9f585505b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b30d2e277cc360437a02fa812c577c0c8d997cff-dirty
fubar
parents: 0
diff changeset
956 ] # trouble from spacey names in command lines avoidance
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
957 asstrack, gname = self.make_assembly(pafOpts["genome"], pgname)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
958 self.genome_names.append(pgname)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
959 if self.config_json.get("assemblies", None):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
960 self.config_json["assemblies"].append(asstrack)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
961 else:
3
2de9f585505b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b30d2e277cc360437a02fa812c577c0c8d997cff-dirty
fubar
parents: 0
diff changeset
962 self.config_json["assemblies"] = [
2de9f585505b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b30d2e277cc360437a02fa812c577c0c8d997cff-dirty
fubar
parents: 0
diff changeset
963 asstrack,
2de9f585505b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b30d2e277cc360437a02fa812c577c0c8d997cff-dirty
fubar
parents: 0
diff changeset
964 ]
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
965
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
966 url = "%s.paf" % (trackData["label"])
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
967 dest = "%s/%s" % (self.outdir, url)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
968 self.symlink_or_copy(os.path.realpath(data), dest)
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
969 trackDict = {
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
970 "type": "SyntenyTrack",
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
971 "trackId": tId,
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
972 "assemblyNames": [self.genome_name, pgname],
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
973 "name": tname,
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
974 "adapter": {
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
975 "type": "PAFAdapter",
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
976 "pafLocation": {"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
977 "assemblyNames": [self.genome_name, pgname],
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
978 },
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
979 }
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
980 style_json = self._prepare_track_style(trackDict)
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
981 trackDict["style"] = style_json
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
982 self.tracksToAdd.append(trackDict)
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
983 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
984
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
985 def add_hicab(self, data, trackData, hicOpts, **kwargs):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
986 rel_dest = os.path.join("data", trackData["label"] + ".hic")
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
987 dest = os.path.join(self.outdir, rel_dest)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
988
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
989 self.symlink_or_copy(os.path.realpath(data), dest)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
990
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
991 self._add_track(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
992 trackData["label"],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
993 trackData["key"],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
994 trackData["category"],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
995 rel_dest,
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
996 config={},
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
997 )
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 def add_sparql(self, url, query, query_refnames, trackData):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1000
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1001 json_track_data = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1002 "type": "FeatureTrack",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1003 "trackId": id,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1004 "name": trackData["label"],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1005 "adapter": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1006 "type": "SPARQLAdapter",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1007 "endpoint": {"uri": url, "locationType": "UriLocation"},
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1008 "queryTemplate": query,
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 "category": [trackData["category"]],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1011 "assemblyNames": [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
1012 }
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 if query_refnames:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1015 json_track_data["adapter"]["refNamesQueryTemplate"]: query_refnames
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1016
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1017 self.subprocess_check_call(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1018 [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1019 "jbrowse",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1020 "add-track-json",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1021 "--target",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1022 os.path.join(self.outdir, "data"),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1023 json_track_data,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1024 ]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1025 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1026
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1027 # Doesn't work as of 1.6.4, might work in the future
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_check_call([
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1029 # 'jbrowse', 'add-track',
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1030 # '--trackType', 'sparql',
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1031 # '--name', trackData['label'],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1032 # '--category', trackData['category'],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1033 # '--target', os.path.join(self.outdir, 'data'),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1034 # '--trackId', id,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1035 # '--config', '{"queryTemplate": "%s"}' % query,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1036 # url])
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1037
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1038 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
1039 category = track["category"].replace("__pd__date__pd__", TODAY)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1040 for i, (
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1041 dataset_path,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1042 dataset_ext,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1043 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
1044 extra_metadata,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1045 ) in enumerate(track["trackfiles"]):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1046 # Unsanitize labels (element_identifiers are always sanitized by Galaxy)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1047 for key, value in mapped_chars.items():
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1048 track_human_label = track_human_label.replace(value, key)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1049 outputTrackConfig = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1050 "category": category,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1051 "style": {},
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1052 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1053
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1054 outputTrackConfig["key"] = track_human_label
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1055
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1056 # We add extra data to hash for the case of REST + SPARQL.
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1057 if (
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1058 "conf" in track
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1059 and "options" in track["conf"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1060 and "url" in track["conf"]["options"]
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 rest_url = track["conf"]["options"]["url"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1063 else:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1064 rest_url = ""
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1065 outputTrackConfig["trackset"] = track.get("trackset", {})
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1066 # I chose to use track['category'] instead of 'category' here. This
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1067 # is intentional. This way re-running the tool on a different date
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1068 # will not generate different hashes and make comparison of outputs
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1069 # much simpler.
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1070 hashData = [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1071 str(dataset_path),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1072 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
1073 track["category"],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1074 rest_url,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1075 ]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1076 hashData = "|".join(hashData).encode("utf-8")
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1077 outputTrackConfig["label"] = hashlib.md5(hashData).hexdigest() + "_%s" % i
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1078 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
1079 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
1080
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1081 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
1082 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
1083 dataset_path,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1084 dataset_ext,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1085 outputTrackConfig,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1086 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1087 elif dataset_ext in ("hic",):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1088 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
1089 dataset_path,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1090 outputTrackConfig,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1091 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1092 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
1093 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
1094 dataset_path,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1095 dataset_ext,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1096 outputTrackConfig,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1097 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1098 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
1099 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
1100 dataset_path,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1101 outputTrackConfig,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1102 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1103 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
1104 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
1105 dataset_path,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1106 outputTrackConfig,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1107 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1108 elif dataset_ext == "bam":
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1109 real_indexes = track["conf"]["options"]["pileup"]["bam_indices"][
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1110 "bam_index"
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1111 ]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1112 if not isinstance(real_indexes, list):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1113 # <bam_indices>
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1114 # <bam_index>/path/to/a.bam.bai</bam_index>
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1115 # </bam_indices>
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1116 #
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1117 # The above will result in the 'bam_index' key containing a
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1118 # string. If there are two or more indices, the container
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1119 # becomes a list. Fun!
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1120 real_indexes = [real_indexes]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1121
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1122 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
1123 dataset_path,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1124 outputTrackConfig,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1125 track["conf"]["options"]["pileup"],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1126 bam_index=real_indexes[i],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1127 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1128 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
1129 self.add_blastxml(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1130 dataset_path, outputTrackConfig, track["conf"]["options"]["blast"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1131 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1132 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
1133 self.add_vcf(dataset_path, outputTrackConfig)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1134 else:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1135 log.warn("Do not know how to handle %s", dataset_ext)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1136 # 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
1137 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
1138
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1139 def add_default_session(self, data):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1140 """
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1141 Add some default session settings: set some assemblies/tracks on/off
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1142 """
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1143 tracks_data = []
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1144
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1145 # 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
1146
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1147 # We need to know the track type from the config.json generated just before
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1148 track_types = {}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1149 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
1150 config_json = json.load(config_file)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1151
6
79f7265f90bd planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9-dirty
fubar
parents: 5
diff changeset
1152 for track_conf in 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
1153 track_types[track_conf["trackId"]] = track_conf["type"]
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1154 tId = track_conf["trackId"]
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1155 if tId in data["visibility"]["default_on"]:
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1156 style_data = {"type": "LinearBasicDisplay"}
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1157 if "displays" in track_conf:
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1158 style_data["type"] = track_conf["displays"][0]["type"]
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1159 if track_conf.get("style_labels", None):
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1160 # TODO fix this: it should probably go in a renderer block (SvgFeatureRenderer) but still does not work
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1161 # TODO move this to per track displays?
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1162 style_data["labels"] = track_conf["style_labels"]
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1163 tracks_data.append(
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1164 {
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1165 "type": track_types[tId],
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1166 "configuration": tId,
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1167 "displays": [style_data],
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1168 }
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1169 )
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1170
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1171 # The view for the assembly we're adding
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1172 view_json = {"type": "LinearGenomeView", "tracks": tracks_data}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1173
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1174 refName = None
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1175 if data.get("defaultLocation", ""):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1176 loc_match = re.search(r"^(\w+):(\d+)\.+(\d+)$", data["defaultLocation"])
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1177 if loc_match:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1178 refName = loc_match.group(1)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1179 start = int(loc_match.group(2))
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1180 end = int(loc_match.group(3))
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1181 elif self.genome_name is not None:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1182 refName = 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
1183 start = 0
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1184 end = 10000 # Booh, hard coded! waiting for https://github.com/GMOD/jbrowse-components/issues/2708
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1185
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1186 if refName is not None:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1187 # TODO displayedRegions is not just zooming to the region, it hides the rest of the chromosome
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1188 view_json["displayedRegions"] = [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1189 {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1190 "refName": refName,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1191 "start": start,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1192 "end": end,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1193 "reversed": False,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1194 "assemblyName": 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
1195 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1196 ]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1197
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1198 session_name = data.get("session_name", "New session")
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1199
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1200 # Merge with possibly existing defaultSession (if upgrading a jbrowse instance)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1201 session_json = {}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1202 if "defaultSession" in config_json:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1203 session_json = config_json["defaultSession"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1204
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1205 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
1206
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1207 if "views" not in session_json:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1208 session_json["views"] = []
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1209
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1210 session_json["views"].append(view_json)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1211
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1212 config_json["defaultSession"] = session_json
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1213
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1214 with open(self.config_json_file, "w") 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
1215 json.dump(config_json, config_file, indent=2)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1216
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1217 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
1218 """
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1219 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
1220 """
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1221
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1222 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
1223 config_json = {}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1224 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
1225 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
1226 config_json = json.load(config_file)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1227
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1228 config_data = {}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1229
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1230 config_data["disableAnalytics"] = data.get("analytics", "false") == "true"
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1231
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1232 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
1233 "palette": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1234 "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
1235 "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
1236 "tertiary": {"main": data.get("tertiary_color", "#135560")},
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1237 "quaternary": {"main": data.get("quaternary_color", "#FFB11D")},
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1238 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1239 "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
1240 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1241 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
1242 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
1243 config_json["configuration"].update(config_data)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1244
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1245 with open(config_path, "w") 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
1246 json.dump(config_json, config_file, indent=2)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1247
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1248 def clone_jbrowse(self):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1249 """Clone a JBrowse directory into a destination directory."""
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1250 # dest = os.path.realpath(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
1251 dest = self.outdir
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1252 cmd = ["rm", "-rf", dest + "/*"]
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1253 self.subprocess_check_call(cmd)
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1254 cmd = ["jbrowse", "create", dest, "-t", JB2VER, "-f"]
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1255 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
1256 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
1257 "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
1258 "favicon.ico",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1259 "robots.txt",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1260 "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
1261 "version.txt",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1262 "test_data",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1263 ]:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1264 cmd = ["rm", "-rf", os.path.join(self.outdir, fn)]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1265 self.subprocess_check_call(cmd)
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1266 cmd = ["cp", os.path.join(INSTALLED_TO, "jb2_webserver.py"), 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
1267 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
1268
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1269
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1270 def parse_style_conf(item):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1271 if "type" in item.attrib and item.attrib["type"] in ["boolean", "integer"]:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1272 if item.attrib["type"] == "boolean":
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1273 return item.text in ("yes", "true", "True")
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1274 elif item.attrib["type"] == "integer":
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1275 return int(item.text)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1276 else:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1277 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
1278
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1279
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1280 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
1281 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
1282 parser.add_argument("--xml", help="Track Configuration")
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1283 parser.add_argument("--outdir", help="Output directory", default="out")
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1284 parser.add_argument("--version", "-V", action="version", version="%(prog)s 2.0.1")
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1285 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
1286
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1287 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
1288 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
1289
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1290 # 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
1291 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
1292 # 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
1293 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
1294 # 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
1295 # 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
1296 GALAXY_INFRASTRUCTURE_URL = "http://" + 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
1297 jc = JbrowseConnector(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1298 outdir=args.outdir,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1299 genomes=[
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1300 {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1301 "path": os.path.realpath(x.attrib["path"]),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1302 "meta": metadata_from_node(x.find("metadata")),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1303 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1304 for x in root.findall("metadata/genomes/genome")
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1305 ],
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 jc.process_genomes()
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1308
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1309 # .add_default_view() replace from https://github.com/abretaud/tools-iuc/blob/jbrowse2/tools/jbrowse2/jbrowse2.py
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1310 default_session_data = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1311 "visibility": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1312 "default_on": [],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1313 "default_off": [],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1314 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1315 "style": {},
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1316 "style_labels": {},
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1317 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1318
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1319 for track in root.findall("tracks/track"):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1320 track_conf = {}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1321 track_conf["trackfiles"] = []
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1322
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1323 is_multi_bigwig = False
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1324 try:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1325 if track.find("options/wiggle/multibigwig") and (
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1326 track.find("options/wiggle/multibigwig").text == "True"
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1327 ):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1328 is_multi_bigwig = True
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1329 multi_bigwig_paths = []
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1330 except KeyError:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1331 pass
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1332
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1333 trackfiles = track.findall("files/trackFile")
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1334 if trackfiles:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1335 for x in track.findall("files/trackFile"):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1336 if is_multi_bigwig:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1337 multi_bigwig_paths.append(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1338 (x.attrib["label"], os.path.realpath(x.attrib["path"]))
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1339 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1340 else:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1341 if trackfiles:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1342 metadata = metadata_from_node(x.find("metadata"))
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1343 track_conf["dataset_id"] = 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
1344 track_conf["trackfiles"].append(
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 os.path.realpath(x.attrib["path"]),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1347 x.attrib["ext"],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1348 x.attrib["label"],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1349 metadata,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1350 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1351 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1352 else:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1353 # For tracks without files (rest, sparql)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1354 track_conf["trackfiles"].append(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1355 (
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1356 "", # N/A, no path for rest or sparql
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1357 track.attrib["format"],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1358 track.find("options/label").text,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1359 {},
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1360 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1361 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1362
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1363 if is_multi_bigwig:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1364 metadata = metadata_from_node(x.find("metadata"))
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1365
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1366 track_conf["trackfiles"].append(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1367 (
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1368 multi_bigwig_paths, # Passing an array of paths to represent as one track
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1369 "bigwig_multiple",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1370 "MultiBigWig", # Giving an hardcoded name for now
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1371 {}, # No metadata for multiple bigwig
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1372 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1373 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1374 track_conf["category"] = track.attrib["cat"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1375 track_conf["format"] = track.attrib["format"]
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1376 if track.find("options/style"):
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1377 track_conf["style"] = {
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1378 item.tag: parse_style_conf(item) for item in track.find("options/style")
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1379 }
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1380 if track.find("options/style_labels"):
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1381 track_conf["style_labels"] = {
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1382 item.tag: parse_style_conf(item)
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1383 for item in track.find("options/style_labels")
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1384 }
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1385
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1386 track_conf["conf"] = etree_to_dict(track.find("options"))
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1387 keys = jc.process_annotations(track_conf)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1388
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1389 if keys:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1390 for key in keys:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1391 default_session_data["visibility"][
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1392 track.attrib.get("visibility", "default_off")
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1393 ].append(key)
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1394 if track_conf.get("style", None):
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1395 default_session_data["style"][key] = track_conf[
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1396 "style"
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1397 ] # TODO do we need this anymore?
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1398 if track_conf.get("style_lables", None):
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1399 default_session_data["style_labels"][key] = track_conf.get(
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1400 "style_labels", None
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1401 )
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1402
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1403 default_session_data["defaultLocation"] = root.find(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1404 "metadata/general/defaultLocation"
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1405 ).text
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1406 default_session_data["session_name"] = root.find(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1407 "metadata/general/session_name"
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1408 ).text
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1409
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1410 general_data = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1411 "analytics": root.find("metadata/general/analytics").text,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1412 "primary_color": root.find("metadata/general/primary_color").text,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1413 "secondary_color": root.find("metadata/general/secondary_color").text,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1414 "tertiary_color": root.find("metadata/general/tertiary_color").text,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1415 "quaternary_color": root.find("metadata/general/quaternary_color").text,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1416 "font_size": root.find("metadata/general/font_size").text,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1417 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1418 track_conf["category"] = track.attrib["cat"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1419 track_conf["format"] = track.attrib["format"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1420 try:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1421 # Only pertains to gff3 + blastxml. TODO?
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1422 track_conf["style"] = {t.tag: t.text for t in track.find("options/style")}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1423 except TypeError:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1424 track_conf["style"] = {}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1425 pass
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1426 track_conf["conf"] = etree_to_dict(track.find("options"))
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1427 jc.add_general_configuration(general_data)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1428 x = open(args.xml, "r").read()
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1429 jc.config_json["tracks"] = jc.tracksToAdd
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1430 if jc.usejson:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1431 jc.write_config()
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1432 jc.add_default_session(default_session_data)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1433
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1434 # jc.text_index() not sure what broke here.