Mercurial > repos > iuc > jbrowse
annotate jbrowse.py @ 14:18be2d72fdee draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0bfb0de98c918860c21808e8832caad9f0535975
author | iuc |
---|---|
date | Thu, 08 Jun 2017 17:31:38 -0400 |
parents | 69c5e9c0add0 |
children | b5c5470d7c09 |
rev | line source |
---|---|
0
2c9e5136b416
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 685773d3da40afdc4d14846d4935b3b0a100f56e
iuc
parents:
diff
changeset
|
1 #!/usr/bin/env python |
8
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
2 import argparse |
11
4cbceec1d6b4
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 172014e3f03ea00dfd5fcd689e1246d001e82288
iuc
parents:
10
diff
changeset
|
3 import codecs |
3 | 4 import copy |
0
2c9e5136b416
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 685773d3da40afdc4d14846d4935b3b0a100f56e
iuc
parents:
diff
changeset
|
5 import hashlib |
8
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
6 import json |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
7 import logging |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
8 import os |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
9 import shutil |
3 | 10 import struct |
8
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
11 import subprocess |
1
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
12 import tempfile |
8
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
13 import xml.etree.ElementTree as ET |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
14 from collections import defaultdict |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
15 |
3 | 16 from Bio.Data import CodonTable |
8
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
17 |
3 | 18 logging.basicConfig(level=logging.INFO) |
19 log = logging.getLogger('jbrowse') | |
1
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
20 |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
21 |
3 | 22 class ColorScaling(object): |
23 | |
24 COLOR_FUNCTION_TEMPLATE = """ | |
25 function(feature, variableName, glyphObject, track) {{ | |
26 var score = {score}; | |
27 {opacity} | |
28 return 'rgba({red}, {green}, {blue}, ' + opacity + ')'; | |
29 }} | |
30 """ | |
31 | |
32 COLOR_FUNCTION_TEMPLATE_QUAL = """ | |
33 function(feature, variableName, glyphObject, track) {{ | |
34 var search_up = function self(sf, attr){{ | |
35 if(sf.get(attr) !== undefined){{ | |
36 return sf.get(attr); | |
37 }} | |
38 if(sf.parent() === undefined) {{ | |
39 return; | |
40 }}else{{ | |
41 return self(sf.parent(), attr); | |
42 }} | |
43 }}; | |
0
2c9e5136b416
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 685773d3da40afdc4d14846d4935b3b0a100f56e
iuc
parents:
diff
changeset
|
44 |
3 | 45 var search_down = function self(sf, attr){{ |
46 if(sf.get(attr) !== undefined){{ | |
47 return sf.get(attr); | |
48 }} | |
49 if(sf.children() === undefined) {{ | |
50 return; | |
51 }}else{{ | |
52 var kids = sf.children(); | |
53 for(var child_idx in kids){{ | |
54 var x = self(kids[child_idx], attr); | |
55 if(x !== undefined){{ | |
56 return x; | |
57 }} | |
58 }} | |
59 return; | |
60 }} | |
61 }}; | |
62 | |
63 var color = ({user_spec_color} || search_up(feature, 'color') || search_down(feature, 'color') || {auto_gen_color}); | |
64 var score = (search_up(feature, 'score') || search_down(feature, 'score')); | |
65 {opacity} | |
66 var result = /^#?([a-f\d]{{2}})([a-f\d]{{2}})([a-f\d]{{2}})$/i.exec(color); | |
67 var red = parseInt(result[1], 16); | |
68 var green = parseInt(result[2], 16); | |
69 var blue = parseInt(result[3], 16); | |
70 if(isNaN(opacity) || opacity < 0){{ opacity = 0; }} | |
71 return 'rgba(' + red + ',' + green + ',' + blue + ',' + opacity + ')'; | |
72 }} | |
73 """ | |
0
2c9e5136b416
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 685773d3da40afdc4d14846d4935b3b0a100f56e
iuc
parents:
diff
changeset
|
74 |
3 | 75 OPACITY_MATH = { |
76 'linear': """ | |
77 var opacity = (score - ({min})) / (({max}) - ({min})); | |
78 """, | |
79 'logarithmic': """ | |
80 var opacity = (score - ({min})) / (({max}) - ({min})); | |
81 opacity = Math.log10(opacity) + Math.log10({max}); | |
82 """, | |
83 'blast': """ | |
84 var opacity = 0; | |
8
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
85 if(score == 0.0) { |
3 | 86 opacity = 1; |
8
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
87 } else{ |
3 | 88 opacity = (20 - Math.log10(score)) / 180; |
8
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
89 } |
3 | 90 """ |
91 } | |
1
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
92 |
3 | 93 BREWER_COLOUR_IDX = 0 |
94 BREWER_COLOUR_SCHEMES = [ | |
95 (166, 206, 227), | |
96 (31, 120, 180), | |
97 (178, 223, 138), | |
98 (51, 160, 44), | |
99 (251, 154, 153), | |
100 (227, 26, 28), | |
101 (253, 191, 111), | |
102 (255, 127, 0), | |
103 (202, 178, 214), | |
104 (106, 61, 154), | |
105 (255, 255, 153), | |
106 (177, 89, 40), | |
107 (228, 26, 28), | |
108 (55, 126, 184), | |
109 (77, 175, 74), | |
110 (152, 78, 163), | |
111 (255, 127, 0), | |
112 ] | |
113 | |
114 BREWER_DIVERGING_PALLETES = { | |
115 'BrBg': ("#543005", "#003c30"), | |
116 'PiYg': ("#8e0152", "#276419"), | |
117 'PRGn': ("#40004b", "#00441b"), | |
118 'PuOr': ("#7f3b08", "#2d004b"), | |
119 'RdBu': ("#67001f", "#053061"), | |
120 'RdGy': ("#67001f", "#1a1a1a"), | |
121 'RdYlBu': ("#a50026", "#313695"), | |
122 'RdYlGn': ("#a50026", "#006837"), | |
123 'Spectral': ("#9e0142", "#5e4fa2"), | |
124 } | |
125 | |
126 def __init__(self): | |
1
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
127 self.brewer_colour_idx = 0 |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
128 |
3 | 129 def rgb_from_hex(self, hexstr): |
130 # http://stackoverflow.com/questions/4296249/how-do-i-convert-a-hex-triplet-to-an-rgb-tuple-and-back | |
11
4cbceec1d6b4
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 172014e3f03ea00dfd5fcd689e1246d001e82288
iuc
parents:
10
diff
changeset
|
131 return struct.unpack('BBB', codecs.decode(hexstr, 'hex')) |
1
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
132 |
3 | 133 def min_max_gff(self, gff_file): |
1
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
134 min_val = None |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
135 max_val = None |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
136 with open(gff_file, 'r') as handle: |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
137 for line in handle: |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
138 try: |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
139 value = float(line.split('\t')[5]) |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
140 min_val = min(value, (min_val or value)) |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
141 max_val = max(value, (max_val or value)) |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
142 |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
143 if value < min_val: |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
144 min_val = value |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
145 |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
146 if value > max_val: |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
147 max_val = value |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
148 except Exception: |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
149 pass |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
150 return min_val, max_val |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
151 |
3 | 152 def hex_from_rgb(self, r, g, b): |
153 return '#%02x%02x%02x' % (r, g, b) | |
154 | |
155 def _get_colours(self): | |
5
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
156 r, g, b = self.BREWER_COLOUR_SCHEMES[self.brewer_colour_idx % len(self.BREWER_COLOUR_SCHEMES)] |
3 | 157 self.brewer_colour_idx += 1 |
158 return r, g, b | |
159 | |
8
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
160 def parse_menus(self, track): |
12
db5fe5a3176a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents:
11
diff
changeset
|
161 trackConfig = {'menuTemplate': [{}, {}, {}, {}]} |
8
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
162 |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
163 if 'menu' in track['menus']: |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
164 menu_list = [track['menus']['menu']] |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
165 if isinstance(track['menus']['menu'], list): |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
166 menu_list = track['menus']['menu'] |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
167 |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
168 for m in menu_list: |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
169 tpl = { |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
170 'action': m['action'], |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
171 'label': m.get('label', '{name}'), |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
172 'iconClass': m.get('iconClass', 'dijitIconBookmark'), |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
173 } |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
174 if 'url' in m: |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
175 tpl['url'] = m['url'] |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
176 if 'content' in m: |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
177 tpl['content'] = m['content'] |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
178 if 'title' in m: |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
179 tpl['title'] = m['title'] |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
180 |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
181 trackConfig['menuTemplate'].append(tpl) |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
182 |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
183 return trackConfig |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
184 |
3 | 185 def parse_colours(self, track, trackFormat, gff3=None): |
186 # Wiggle tracks have a bicolor pallete | |
187 trackConfig = {'style': {}} | |
188 if trackFormat == 'wiggle': | |
189 | |
190 trackConfig['style']['pos_color'] = track['wiggle']['color_pos'] | |
191 trackConfig['style']['neg_color'] = track['wiggle']['color_neg'] | |
192 | |
193 if trackConfig['style']['pos_color'] == '__auto__': | |
194 trackConfig['style']['neg_color'] = self.hex_from_rgb(*self._get_colours()) | |
195 trackConfig['style']['pos_color'] = self.hex_from_rgb(*self._get_colours()) | |
196 | |
197 # Wiggle tracks can change colour at a specified place | |
198 bc_pivot = track['wiggle']['bicolor_pivot'] | |
199 if bc_pivot not in ('mean', 'zero'): | |
200 # The values are either one of those two strings | |
201 # or a number | |
202 bc_pivot = float(bc_pivot) | |
203 trackConfig['bicolor_pivot'] = bc_pivot | |
204 elif 'scaling' in track: | |
205 if track['scaling']['method'] == 'ignore': | |
206 if track['scaling']['scheme']['color'] != '__auto__': | |
207 trackConfig['style']['color'] = track['scaling']['scheme']['color'] | |
208 else: | |
209 trackConfig['style']['color'] = self.hex_from_rgb(*self._get_colours()) | |
210 else: | |
211 # Scored method | |
212 algo = track['scaling']['algo'] | |
213 # linear, logarithmic, blast | |
214 scales = track['scaling']['scales'] | |
215 # type __auto__, manual (min, max) | |
216 scheme = track['scaling']['scheme'] | |
217 # scheme -> (type (opacity), color) | |
218 # ================================== | |
219 # GENE CALLS OR BLAST | |
220 # ================================== | |
221 if trackFormat == 'blast': | |
222 red, green, blue = self._get_colours() | |
223 color_function = self.COLOR_FUNCTION_TEMPLATE.format(**{ | |
224 'score': "feature._parent.get('score')", | |
225 'opacity': self.OPACITY_MATH['blast'], | |
226 'red': red, | |
227 'green': green, | |
228 'blue': blue, | |
229 }) | |
230 trackConfig['style']['color'] = color_function.replace('\n', '') | |
231 elif trackFormat == 'gene_calls': | |
232 # Default values, based on GFF3 spec | |
233 min_val = 0 | |
234 max_val = 1000 | |
235 # Get min/max and build a scoring function since JBrowse doesn't | |
5
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
236 if scales['type'] == 'automatic' or scales['type'] == '__auto__': |
3 | 237 min_val, max_val = self.min_max_gff(gff3) |
238 else: | |
5
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
239 min_val = scales.get('min', 0) |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
240 max_val = scales.get('max', 1000) |
3 | 241 |
242 if scheme['color'] == '__auto__': | |
243 user_color = 'undefined' | |
244 auto_color = "'%s'" % self.hex_from_rgb(*self._get_colours()) | |
245 elif scheme['color'].startswith('#'): | |
246 user_color = "'%s'" % self.hex_from_rgb(*self.rgb_from_hex(scheme['color'][1:])) | |
247 auto_color = 'undefined' | |
248 else: | |
249 user_color = 'undefined' | |
250 auto_color = "'%s'" % self.hex_from_rgb(*self._get_colours()) | |
251 | |
252 color_function = self.COLOR_FUNCTION_TEMPLATE_QUAL.format(**{ | |
8
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
253 'opacity': self.OPACITY_MATH[algo].format(**{'max': max_val, 'min': min_val}), |
3 | 254 'user_spec_color': user_color, |
255 'auto_gen_color': auto_color, | |
256 }) | |
257 | |
258 trackConfig['style']['color'] = color_function.replace('\n', '') | |
259 return trackConfig | |
260 | |
261 | |
262 def etree_to_dict(t): | |
263 d = {t.tag: {} if t.attrib else None} | |
264 children = list(t) | |
265 if children: | |
266 dd = defaultdict(list) | |
267 for dc in map(etree_to_dict, children): | |
10
1a6d882d340d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit ac44b067ee08de23180e8b5030374cf362ac4524
iuc
parents:
8
diff
changeset
|
268 for k, v in dc.items(): |
3 | 269 dd[k].append(v) |
10
1a6d882d340d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit ac44b067ee08de23180e8b5030374cf362ac4524
iuc
parents:
8
diff
changeset
|
270 d = {t.tag: {k: v[0] if len(v) == 1 else v for k, v in dd.items()}} |
3 | 271 if t.attrib: |
10
1a6d882d340d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit ac44b067ee08de23180e8b5030374cf362ac4524
iuc
parents:
8
diff
changeset
|
272 d[t.tag].update(('@' + k, v) for k, v in t.attrib.items()) |
3 | 273 if t.text: |
274 text = t.text.strip() | |
275 if children or t.attrib: | |
276 if text: | |
8
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
277 d[t.tag]['#text'] = text |
3 | 278 else: |
279 d[t.tag] = text | |
280 return d | |
281 | |
282 | |
283 # score comes from feature._parent.get('score') or feature.get('score') | |
284 | |
285 INSTALLED_TO = os.path.dirname(os.path.realpath(__file__)) | |
286 | |
287 | |
288 class JbrowseConnector(object): | |
289 | |
290 def __init__(self, jbrowse, outdir, genomes, standalone=False, gencode=1): | |
291 self.TN_TABLE = { | |
292 'gff3': '--gff', | |
293 'gff': '--gff', | |
294 'bed': '--bed', | |
295 'genbank': '--gbk', | |
1
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
296 } |
3 | 297 |
298 self.cs = ColorScaling() | |
299 self.jbrowse = jbrowse | |
300 self.outdir = outdir | |
301 self.genome_paths = genomes | |
302 self.standalone = standalone | |
303 self.gencode = gencode | |
8
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
304 self.tracksToIndex = [] |
3 | 305 |
306 if standalone: | |
307 self.clone_jbrowse(self.jbrowse, self.outdir) | |
308 else: | |
309 try: | |
310 os.makedirs(self.outdir) | |
311 except OSError: | |
312 # Ignore if the folder exists | |
313 pass | |
314 | |
315 self.process_genomes() | |
316 self.update_gencode() | |
317 | |
318 def update_gencode(self): | |
319 table = CodonTable.unambiguous_dna_by_id[int(self.gencode)] | |
320 trackList = os.path.join(self.outdir, 'data', 'trackList.json') | |
321 with open(trackList, 'r') as handle: | |
322 trackListData = json.load(handle) | |
1
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
323 |
3 | 324 trackListData['tracks'][0].update({ |
325 'codonStarts': table.start_codons, | |
326 'codonStops': table.stop_codons, | |
327 'codonTable': table.forward_table, | |
328 }) | |
329 | |
330 with open(trackList, 'w') as handle: | |
331 json.dump(trackListData, handle, indent=2) | |
332 | |
333 def subprocess_check_call(self, command): | |
334 log.debug('cd %s && %s', self.outdir, ' '.join(command)) | |
335 subprocess.check_call(command, cwd=self.outdir) | |
336 | |
337 def _jbrowse_bin(self, command): | |
338 return os.path.realpath(os.path.join(self.jbrowse, 'bin', command)) | |
339 | |
340 def process_genomes(self): | |
341 for genome_path in self.genome_paths: | |
342 self.subprocess_check_call([ | |
343 'perl', self._jbrowse_bin('prepare-refseqs.pl'), | |
344 '--fasta', genome_path]) | |
345 | |
8
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
346 def generate_names(self): |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
347 # Generate names |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
348 |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
349 args = [ |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
350 'perl', self._jbrowse_bin('generate-names.pl'), |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
351 '--hashBits', '16' |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
352 ] |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
353 |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
354 tracks = ','.join(self.tracksToIndex) |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
355 |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
356 if tracks: |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
357 args += ['--tracks', tracks] |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
358 else: |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
359 # No tracks to index, index only the refseq |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
360 args += ['--tracks', 'DNA'] |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
361 |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
362 self.subprocess_check_call(args) |
3 | 363 |
5
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
364 def _add_json(self, json_data): |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
365 |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
366 cmd = [ |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
367 'perl', self._jbrowse_bin('add-json.pl'), |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
368 json.dumps(json_data), |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
369 os.path.join('data', 'trackList.json') |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
370 ] |
3 | 371 self.subprocess_check_call(cmd) |
1
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
372 |
3 | 373 def _add_track_json(self, json_data): |
10
1a6d882d340d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit ac44b067ee08de23180e8b5030374cf362ac4524
iuc
parents:
8
diff
changeset
|
374 if len(json_data) == 0: |
3 | 375 return |
376 | |
377 tmp = tempfile.NamedTemporaryFile(delete=False) | |
378 tmp.write(json.dumps(json_data)) | |
379 tmp.close() | |
380 cmd = ['perl', self._jbrowse_bin('add-track-json.pl'), tmp.name, | |
381 os.path.join('data', 'trackList.json')] | |
382 self.subprocess_check_call(cmd) | |
383 os.unlink(tmp.name) | |
384 | |
385 def _blastxml_to_gff3(self, xml, min_gap=10): | |
386 gff3_unrebased = tempfile.NamedTemporaryFile(delete=False) | |
387 cmd = ['python', os.path.join(INSTALLED_TO, 'blastxml_to_gapped_gff3.py'), | |
388 '--trim', '--trim_end', '--min_gap', str(min_gap), xml] | |
389 log.debug('cd %s && %s > %s', self.outdir, ' '.join(cmd), gff3_unrebased.name) | |
390 subprocess.check_call(cmd, cwd=self.outdir, stdout=gff3_unrebased) | |
391 gff3_unrebased.close() | |
392 return gff3_unrebased.name | |
393 | |
394 def add_blastxml(self, data, trackData, blastOpts, **kwargs): | |
395 gff3 = self._blastxml_to_gff3(data, min_gap=blastOpts['min_gap']) | |
0
2c9e5136b416
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 685773d3da40afdc4d14846d4935b3b0a100f56e
iuc
parents:
diff
changeset
|
396 |
5
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
397 if 'parent' in blastOpts and blastOpts['parent'] != 'None': |
3 | 398 gff3_rebased = tempfile.NamedTemporaryFile(delete=False) |
399 cmd = ['python', os.path.join(INSTALLED_TO, 'gff3_rebase.py')] | |
400 if blastOpts.get('protein', 'false') == 'true': | |
401 cmd.append('--protein2dna') | |
402 cmd.extend([os.path.realpath(blastOpts['parent']), gff3]) | |
403 log.debug('cd %s && %s > %s', self.outdir, ' '.join(cmd), gff3_rebased.name) | |
404 subprocess.check_call(cmd, cwd=self.outdir, stdout=gff3_rebased) | |
405 gff3_rebased.close() | |
406 | |
407 # Replace original gff3 file | |
408 shutil.copy(gff3_rebased.name, gff3) | |
409 os.unlink(gff3_rebased.name) | |
410 | |
411 config = { | |
412 'glyph': 'JBrowse/View/FeatureGlyph/Segments', | |
413 "category": trackData['category'], | |
414 } | |
415 | |
416 clientConfig = trackData['style'] | |
417 | |
418 cmd = ['perl', self._jbrowse_bin('flatfile-to-json.pl'), | |
419 '--gff', gff3, | |
420 '--trackLabel', trackData['label'], | |
421 '--key', trackData['key'], | |
422 '--clientConfig', json.dumps(clientConfig), | |
423 '--config', json.dumps(config), | |
424 '--trackType', 'JBrowse/View/Track/CanvasFeatures' | |
425 ] | |
426 | |
13
69c5e9c0add0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit bb4fe9cc4bc03918afa525569ed36144a819ce79
iuc
parents:
12
diff
changeset
|
427 # className in --clientConfig is ignored, it needs to be set with --className |
69c5e9c0add0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit bb4fe9cc4bc03918afa525569ed36144a819ce79
iuc
parents:
12
diff
changeset
|
428 if 'className' in trackData['style']: |
69c5e9c0add0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit bb4fe9cc4bc03918afa525569ed36144a819ce79
iuc
parents:
12
diff
changeset
|
429 cmd += ['--className', trackData['style']['className']] |
69c5e9c0add0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit bb4fe9cc4bc03918afa525569ed36144a819ce79
iuc
parents:
12
diff
changeset
|
430 |
3 | 431 self.subprocess_check_call(cmd) |
432 os.unlink(gff3) | |
433 | |
8
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
434 if blastOpts.get('index', 'false') == 'true': |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
435 self.tracksToIndex.append("%s" % trackData['label']) |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
436 |
3 | 437 def add_bigwig(self, data, trackData, wiggleOpts, **kwargs): |
438 dest = os.path.join('data', 'raw', trackData['label'] + '.bw') | |
439 cmd = ['ln', data, dest] | |
1
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
440 self.subprocess_check_call(cmd) |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
441 |
12
db5fe5a3176a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents:
11
diff
changeset
|
442 url = os.path.join('raw', trackData['label'] + '.bw') |
3 | 443 trackData.update({ |
12
db5fe5a3176a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents:
11
diff
changeset
|
444 "urlTemplate": url, |
3 | 445 "storeClass": "JBrowse/Store/SeqFeature/BigWig", |
446 "type": "JBrowse/View/Track/Wiggle/Density", | |
447 }) | |
448 | |
449 trackData['type'] = wiggleOpts['type'] | |
450 trackData['variance_band'] = True if wiggleOpts['variance_band'] == 'true' else False | |
451 | |
452 if 'min' in wiggleOpts and 'max' in wiggleOpts: | |
453 trackData['min_score'] = wiggleOpts['min'] | |
454 trackData['max_score'] = wiggleOpts['max'] | |
455 else: | |
456 trackData['autoscale'] = wiggleOpts.get('autoscale', 'local') | |
457 | |
458 self._add_track_json(trackData) | |
459 | |
460 def add_bam(self, data, trackData, bamOpts, bam_index=None, **kwargs): | |
461 dest = os.path.join('data', 'raw', trackData['label'] + '.bam') | |
462 cmd = ['ln', '-s', os.path.realpath(data), dest] | |
1
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
463 self.subprocess_check_call(cmd) |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
464 |
3 | 465 cmd = ['ln', '-s', os.path.realpath(bam_index), dest + '.bai'] |
466 self.subprocess_check_call(cmd) | |
467 | |
12
db5fe5a3176a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents:
11
diff
changeset
|
468 url = os.path.join('raw', trackData['label'] + '.bam') |
3 | 469 trackData.update({ |
12
db5fe5a3176a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents:
11
diff
changeset
|
470 "urlTemplate": url, |
1
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
471 "type": "JBrowse/View/Track/Alignments2", |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
472 "storeClass": "JBrowse/Store/SeqFeature/BAM", |
3 | 473 }) |
474 | |
14
18be2d72fdee
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0bfb0de98c918860c21808e8832caad9f0535975
iuc
parents:
13
diff
changeset
|
475 # Apollo will only switch to the (prettier) 'bam-read' className if it's not set explicitly in the track config |
18be2d72fdee
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0bfb0de98c918860c21808e8832caad9f0535975
iuc
parents:
13
diff
changeset
|
476 # So remove the default 'feature' value for these bam tracks |
18be2d72fdee
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0bfb0de98c918860c21808e8832caad9f0535975
iuc
parents:
13
diff
changeset
|
477 if 'className' in trackData['style'] and trackData['style']['className'] == 'feature': |
18be2d72fdee
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0bfb0de98c918860c21808e8832caad9f0535975
iuc
parents:
13
diff
changeset
|
478 del trackData['style']['className'] |
18be2d72fdee
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0bfb0de98c918860c21808e8832caad9f0535975
iuc
parents:
13
diff
changeset
|
479 |
3 | 480 self._add_track_json(trackData) |
481 | |
482 if bamOpts.get('auto_snp', 'false') == 'true': | |
483 trackData2 = copy.copy(trackData) | |
484 trackData2.update({ | |
1
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
485 "type": "JBrowse/View/Track/SNPCoverage", |
3 | 486 "key": trackData['key'] + " - SNPs/Coverage", |
8
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
487 "label": trackData['label'] + "_autosnp", |
3 | 488 }) |
489 self._add_track_json(trackData2) | |
1
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
490 |
3 | 491 def add_vcf(self, data, trackData, vcfOpts={}, **kwargs): |
492 dest = os.path.join('data', 'raw', trackData['label'] + '.vcf') | |
1
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
493 # ln? |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
494 cmd = ['ln', '-s', data, dest] |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
495 self.subprocess_check_call(cmd) |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
496 cmd = ['bgzip', dest] |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
497 self.subprocess_check_call(cmd) |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
498 cmd = ['tabix', '-p', 'vcf', dest + '.gz'] |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
499 self.subprocess_check_call(cmd) |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
500 |
12
db5fe5a3176a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents:
11
diff
changeset
|
501 url = os.path.join('raw', trackData['label'] + '.vcf') |
3 | 502 trackData.update({ |
12
db5fe5a3176a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents:
11
diff
changeset
|
503 "urlTemplate": url, |
1
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
504 "type": "JBrowse/View/Track/HTMLVariants", |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
505 "storeClass": "JBrowse/Store/SeqFeature/VCFTabix", |
3 | 506 }) |
507 self._add_track_json(trackData) | |
1
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
508 |
3 | 509 def add_features(self, data, format, trackData, gffOpts, **kwargs): |
510 cmd = [ | |
511 'perl', self._jbrowse_bin('flatfile-to-json.pl'), | |
512 self.TN_TABLE.get(format, 'gff'), | |
513 data, | |
514 '--trackLabel', trackData['label'], | |
515 '--key', trackData['key'] | |
516 ] | |
1
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
517 |
13
69c5e9c0add0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit bb4fe9cc4bc03918afa525569ed36144a819ce79
iuc
parents:
12
diff
changeset
|
518 # className in --clientConfig is ignored, it needs to be set with --className |
69c5e9c0add0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit bb4fe9cc4bc03918afa525569ed36144a819ce79
iuc
parents:
12
diff
changeset
|
519 if 'className' in trackData['style']: |
69c5e9c0add0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit bb4fe9cc4bc03918afa525569ed36144a819ce79
iuc
parents:
12
diff
changeset
|
520 cmd += ['--className', trackData['style']['className']] |
69c5e9c0add0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit bb4fe9cc4bc03918afa525569ed36144a819ce79
iuc
parents:
12
diff
changeset
|
521 |
3 | 522 config = copy.copy(trackData) |
523 clientConfig = trackData['style'] | |
524 del config['style'] | |
1
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
525 |
8
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
526 if 'match' in gffOpts: |
1
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
527 config['glyph'] = 'JBrowse/View/FeatureGlyph/Segments' |
3 | 528 cmd += ['--type', gffOpts['match']] |
1
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
529 |
3 | 530 cmd += ['--clientConfig', json.dumps(clientConfig), |
5
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
531 ] |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
532 |
10
1a6d882d340d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit ac44b067ee08de23180e8b5030374cf362ac4524
iuc
parents:
8
diff
changeset
|
533 trackType = 'JBrowse/View/Track/CanvasFeatures' |
5
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
534 if 'trackType' in gffOpts: |
10
1a6d882d340d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit ac44b067ee08de23180e8b5030374cf362ac4524
iuc
parents:
8
diff
changeset
|
535 trackType = gffOpts['trackType'] |
1a6d882d340d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit ac44b067ee08de23180e8b5030374cf362ac4524
iuc
parents:
8
diff
changeset
|
536 |
1a6d882d340d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit ac44b067ee08de23180e8b5030374cf362ac4524
iuc
parents:
8
diff
changeset
|
537 if trackType == 'JBrowse/View/Track/CanvasFeatures': |
1a6d882d340d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit ac44b067ee08de23180e8b5030374cf362ac4524
iuc
parents:
8
diff
changeset
|
538 if 'transcriptType' in gffOpts and gffOpts['transcriptType']: |
1a6d882d340d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit ac44b067ee08de23180e8b5030374cf362ac4524
iuc
parents:
8
diff
changeset
|
539 config['transcriptType'] = gffOpts['transcriptType'] |
1a6d882d340d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit ac44b067ee08de23180e8b5030374cf362ac4524
iuc
parents:
8
diff
changeset
|
540 if 'subParts' in gffOpts and gffOpts['subParts']: |
1a6d882d340d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit ac44b067ee08de23180e8b5030374cf362ac4524
iuc
parents:
8
diff
changeset
|
541 config['subParts'] = gffOpts['subParts'] |
1a6d882d340d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit ac44b067ee08de23180e8b5030374cf362ac4524
iuc
parents:
8
diff
changeset
|
542 if 'impliedUTRs' in gffOpts and gffOpts['impliedUTRs']: |
1a6d882d340d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit ac44b067ee08de23180e8b5030374cf362ac4524
iuc
parents:
8
diff
changeset
|
543 config['impliedUTRs'] = gffOpts['impliedUTRs'] |
13
69c5e9c0add0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit bb4fe9cc4bc03918afa525569ed36144a819ce79
iuc
parents:
12
diff
changeset
|
544 elif trackType == 'JBrowse/View/Track/HTMLFeatures': |
69c5e9c0add0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit bb4fe9cc4bc03918afa525569ed36144a819ce79
iuc
parents:
12
diff
changeset
|
545 if 'transcriptType' in gffOpts and gffOpts['transcriptType']: |
69c5e9c0add0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit bb4fe9cc4bc03918afa525569ed36144a819ce79
iuc
parents:
12
diff
changeset
|
546 cmd += ['--type', gffOpts['transcriptType']] |
10
1a6d882d340d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit ac44b067ee08de23180e8b5030374cf362ac4524
iuc
parents:
8
diff
changeset
|
547 |
1a6d882d340d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit ac44b067ee08de23180e8b5030374cf362ac4524
iuc
parents:
8
diff
changeset
|
548 cmd += [ |
1a6d882d340d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit ac44b067ee08de23180e8b5030374cf362ac4524
iuc
parents:
8
diff
changeset
|
549 '--trackType', gffOpts['trackType'] |
1a6d882d340d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit ac44b067ee08de23180e8b5030374cf362ac4524
iuc
parents:
8
diff
changeset
|
550 ] |
1
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
551 |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
552 cmd.extend(['--config', json.dumps(config)]) |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
553 |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
554 self.subprocess_check_call(cmd) |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
555 |
8
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
556 if gffOpts.get('index', 'false') == 'true': |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
557 self.tracksToIndex.append("%s" % trackData['label']) |
3 | 558 |
559 def process_annotations(self, track): | |
560 outputTrackConfig = { | |
561 'style': { | |
8
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
562 'label': track['style'].get('label', 'description'), |
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
563 'className': track['style'].get('className', 'feature'), |
3 | 564 'description': track['style'].get('description', ''), |
565 }, | |
566 'category': track['category'], | |
567 } | |
568 | |
569 for i, (dataset_path, dataset_ext, track_human_label) in enumerate(track['trackfiles']): | |
570 log.info('Processing %s / %s', track['category'], track_human_label) | |
571 outputTrackConfig['key'] = track_human_label | |
572 hashData = [dataset_path, track_human_label, track['category']] | |
10
1a6d882d340d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit ac44b067ee08de23180e8b5030374cf362ac4524
iuc
parents:
8
diff
changeset
|
573 outputTrackConfig['label'] = hashlib.md5('|'.join(hashData).encode('utf-8')).hexdigest() + '_%s' % i |
3 | 574 |
575 # Colour parsing is complex due to different track types having | |
576 # different colour options. | |
577 colourOptions = self.cs.parse_colours(track['conf']['options'], track['format'], gff3=dataset_path) | |
578 # This used to be done with a dict.update() call, however that wiped out any previous style settings... | |
579 for key in colourOptions: | |
580 if key == 'style': | |
581 for subkey in colourOptions['style']: | |
582 outputTrackConfig['style'][subkey] = colourOptions['style'][subkey] | |
583 else: | |
584 outputTrackConfig[key] = colourOptions[key] | |
585 | |
12
db5fe5a3176a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents:
11
diff
changeset
|
586 if 'menus' in track['conf']['options']: |
db5fe5a3176a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents:
11
diff
changeset
|
587 menus = self.cs.parse_menus(track['conf']['options']) |
db5fe5a3176a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents:
11
diff
changeset
|
588 outputTrackConfig.update(menus) |
8
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
589 |
5
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
590 # import pprint; pprint.pprint(track) |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
591 # import sys; sys.exit() |
3 | 592 if dataset_ext in ('gff', 'gff3', 'bed'): |
593 self.add_features(dataset_path, dataset_ext, outputTrackConfig, | |
8
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
594 track['conf']['options']['gff']) |
3 | 595 elif dataset_ext == 'bigwig': |
596 self.add_bigwig(dataset_path, outputTrackConfig, | |
597 track['conf']['options']['wiggle']) | |
598 elif dataset_ext == 'bam': | |
599 real_indexes = track['conf']['options']['pileup']['bam_indices']['bam_index'] | |
600 if not isinstance(real_indexes, list): | |
601 # <bam_indices> | |
602 # <bam_index>/path/to/a.bam.bai</bam_index> | |
603 # </bam_indices> | |
604 # | |
605 # The above will result in the 'bam_index' key containing a | |
606 # string. If there are two or more indices, the container | |
607 # becomes a list. Fun! | |
608 real_indexes = [real_indexes] | |
609 | |
610 self.add_bam(dataset_path, outputTrackConfig, | |
611 track['conf']['options']['pileup'], | |
612 bam_index=real_indexes[i]) | |
613 elif dataset_ext == 'blastxml': | |
614 self.add_blastxml(dataset_path, outputTrackConfig, track['conf']['options']['blast']) | |
615 elif dataset_ext == 'vcf': | |
616 self.add_vcf(dataset_path, outputTrackConfig) | |
1
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
617 |
5
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
618 # Return non-human label for use in other fields |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
619 yield outputTrackConfig['label'] |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
620 |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
621 def add_final_data(self, data): |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
622 viz_data = {} |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
623 if len(data['visibility']['default_on']) > 0: |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
624 viz_data['defaultTracks'] = ','.join(data['visibility']['default_on']) |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
625 |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
626 if len(data['visibility']['always']) > 0: |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
627 viz_data['alwaysOnTracks'] = ','.join(data['visibility']['always']) |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
628 |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
629 if len(data['visibility']['force']) > 0: |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
630 viz_data['forceTracks'] = ','.join(data['visibility']['force']) |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
631 |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
632 generalData = {} |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
633 if data['general']['aboutDescription'] is not None: |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
634 generalData['aboutThisBrowser'] = {'description': data['general']['aboutDescription'].strip()} |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
635 |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
636 generalData['view'] = { |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
637 'trackPadding': data['general']['trackPadding'] |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
638 } |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
639 generalData['shareLink'] = (data['general']['shareLink'] == 'true') |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
640 generalData['show_tracklist'] = (data['general']['show_tracklist'] == 'true') |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
641 generalData['show_nav'] = (data['general']['show_nav'] == 'true') |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
642 generalData['show_overview'] = (data['general']['show_overview'] == 'true') |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
643 generalData['show_menu'] = (data['general']['show_menu'] == 'true') |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
644 generalData['hideGenomeOptions'] = (data['general']['hideGenomeOptions'] == 'true') |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
645 |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
646 viz_data.update(generalData) |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
647 self._add_json(viz_data) |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
648 |
1
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
649 def clone_jbrowse(self, jbrowse_dir, destination): |
3 | 650 """Clone a JBrowse directory into a destination directory. |
651 """ | |
1
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
652 # JBrowse seems to have included some bad symlinks, cp ignores bad symlinks |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
653 # unlike copytree |
3 | 654 cmd = ['cp', '-r', os.path.join(jbrowse_dir, '.'), destination] |
655 log.debug(' '.join(cmd)) | |
1
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
656 subprocess.check_call(cmd) |
3 | 657 cmd = ['mkdir', '-p', os.path.join(destination, 'data', 'raw')] |
658 log.debug(' '.join(cmd)) | |
1
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
659 subprocess.check_call(cmd) |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
660 |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
661 # http://unix.stackexchange.com/a/38691/22785 |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
662 # JBrowse releases come with some broken symlinks |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
663 cmd = ['find', destination, '-type', 'l', '-xtype', 'l', '-exec', 'rm', "'{}'", '+'] |
3 | 664 log.debug(' '.join(cmd)) |
1
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
665 subprocess.check_call(cmd) |
0
2c9e5136b416
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 685773d3da40afdc4d14846d4935b3b0a100f56e
iuc
parents:
diff
changeset
|
666 |
2c9e5136b416
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 685773d3da40afdc4d14846d4935b3b0a100f56e
iuc
parents:
diff
changeset
|
667 |
2c9e5136b416
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 685773d3da40afdc4d14846d4935b3b0a100f56e
iuc
parents:
diff
changeset
|
668 if __name__ == '__main__': |
2c9e5136b416
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 685773d3da40afdc4d14846d4935b3b0a100f56e
iuc
parents:
diff
changeset
|
669 parser = argparse.ArgumentParser(description="", epilog="") |
10
1a6d882d340d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit ac44b067ee08de23180e8b5030374cf362ac4524
iuc
parents:
8
diff
changeset
|
670 parser.add_argument('xml', type=argparse.FileType('r'), help='Track Configuration') |
0
2c9e5136b416
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 685773d3da40afdc4d14846d4935b3b0a100f56e
iuc
parents:
diff
changeset
|
671 |
2c9e5136b416
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 685773d3da40afdc4d14846d4935b3b0a100f56e
iuc
parents:
diff
changeset
|
672 parser.add_argument('--jbrowse', help='Folder containing a jbrowse release') |
2c9e5136b416
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 685773d3da40afdc4d14846d4935b3b0a100f56e
iuc
parents:
diff
changeset
|
673 parser.add_argument('--outdir', help='Output directory', default='out') |
3 | 674 parser.add_argument('--standalone', help='Standalone mode includes a copy of JBrowse', action='store_true') |
0
2c9e5136b416
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 685773d3da40afdc4d14846d4935b3b0a100f56e
iuc
parents:
diff
changeset
|
675 args = parser.parse_args() |
2c9e5136b416
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 685773d3da40afdc4d14846d4935b3b0a100f56e
iuc
parents:
diff
changeset
|
676 |
3 | 677 tree = ET.parse(args.xml.name) |
678 root = tree.getroot() | |
679 | |
1
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
680 jc = JbrowseConnector( |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
681 jbrowse=args.jbrowse, |
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
682 outdir=args.outdir, |
3 | 683 genomes=[os.path.realpath(x.text) for x in root.findall('metadata/genomes/genome')], |
684 standalone=args.standalone, | |
685 gencode=root.find('metadata/gencode').text | |
1
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
686 ) |
0
2c9e5136b416
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 685773d3da40afdc4d14846d4935b3b0a100f56e
iuc
parents:
diff
changeset
|
687 |
5
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
688 extra_data = { |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
689 'visibility': { |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
690 'default_on': [], |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
691 'default_off': [], |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
692 'force': [], |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
693 'always': [], |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
694 }, |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
695 'general': { |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
696 'defaultLocation': root.find('metadata/general/defaultLocation').text, |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
697 'trackPadding': int(root.find('metadata/general/trackPadding').text), |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
698 'shareLink': root.find('metadata/general/shareLink').text, |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
699 'aboutDescription': root.find('metadata/general/aboutDescription').text, |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
700 'show_tracklist': root.find('metadata/general/show_tracklist').text, |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
701 'show_nav': root.find('metadata/general/show_nav').text, |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
702 'show_overview': root.find('metadata/general/show_overview').text, |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
703 'show_menu': root.find('metadata/general/show_menu').text, |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
704 'hideGenomeOptions': root.find('metadata/general/hideGenomeOptions').text, |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
705 } |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
706 } |
3 | 707 for track in root.findall('tracks/track'): |
708 track_conf = {} | |
709 track_conf['trackfiles'] = [ | |
710 (os.path.realpath(x.attrib['path']), x.attrib['ext'], x.attrib['label']) | |
711 for x in track.findall('files/trackFile') | |
712 ] | |
1
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
iuc
parents:
0
diff
changeset
|
713 |
3 | 714 track_conf['category'] = track.attrib['cat'] |
715 track_conf['format'] = track.attrib['format'] | |
716 try: | |
717 # Only pertains to gff3 + blastxml. TODO? | |
718 track_conf['style'] = {t.tag: t.text for t in track.find('options/style')} | |
8
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
719 except TypeError: |
3 | 720 track_conf['style'] = {} |
721 pass | |
722 track_conf['conf'] = etree_to_dict(track.find('options')) | |
5
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
723 keys = jc.process_annotations(track_conf) |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
724 |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
725 for key in keys: |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
726 extra_data['visibility'][track.attrib.get('visibility', 'default_off')].append(key) |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
727 |
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
iuc
parents:
3
diff
changeset
|
728 jc.add_final_data(extra_data) |
8
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
iuc
parents:
5
diff
changeset
|
729 jc.generate_names() |