Mercurial > repos > iuc > jbrowse
annotate jbrowse.py @ 42:6cd09d7b5f37 draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 96f42b908d68ef8b1da5507e9216db74e46ebf06"
| author | iuc | 
|---|---|
| date | Sat, 06 Feb 2021 12:01:13 +0000 | 
| parents | 8774b28235bb | 
| children | 87dc4ce42281 | 
| 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: 
5diff
changeset | 2 import argparse | 
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 3 import binascii | 
| 3 | 4 import copy | 
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 5 import datetime | 
| 0 
2c9e5136b416
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 685773d3da40afdc4d14846d4935b3b0a100f56e
 iuc parents: diff
changeset | 6 import hashlib | 
| 8 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 7 import json | 
| 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 8 import logging | 
| 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 9 import os | 
| 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 10 import shutil | 
| 3 | 11 import struct | 
| 8 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 12 import subprocess | 
| 1 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 13 import tempfile | 
| 8 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 14 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: 
5diff
changeset | 15 from collections import defaultdict | 
| 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 16 | 
| 3 | 17 from Bio.Data import CodonTable | 
| 18 logging.basicConfig(level=logging.INFO) | |
| 19 log = logging.getLogger('jbrowse') | |
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 20 TODAY = datetime.datetime.now().strftime("%Y-%m-%d") | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 21 GALAXY_INFRASTRUCTURE_URL = None | 
| 1 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 22 | 
| 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 23 | 
| 3 | 24 class ColorScaling(object): | 
| 25 | |
| 26 COLOR_FUNCTION_TEMPLATE = """ | |
| 27 function(feature, variableName, glyphObject, track) {{ | |
| 28 var score = {score}; | |
| 29 {opacity} | |
| 30 return 'rgba({red}, {green}, {blue}, ' + opacity + ')'; | |
| 31 }} | |
| 32 """ | |
| 33 | |
| 22 
5f70e7fe6077
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit a4b0969b33a68a0ea9ba12291f6694aec24f13ed
 iuc parents: 
21diff
changeset | 34 COLOR_FUNCTION_TEMPLATE_QUAL = r""" | 
| 3 | 35 function(feature, variableName, glyphObject, track) {{ | 
| 36 var search_up = function self(sf, attr){{ | |
| 37 if(sf.get(attr) !== undefined){{ | |
| 38 return sf.get(attr); | |
| 39 }} | |
| 40 if(sf.parent() === undefined) {{ | |
| 41 return; | |
| 42 }}else{{ | |
| 43 return self(sf.parent(), attr); | |
| 44 }} | |
| 45 }}; | |
| 0 
2c9e5136b416
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 685773d3da40afdc4d14846d4935b3b0a100f56e
 iuc parents: diff
changeset | 46 | 
| 3 | 47 var search_down = function self(sf, attr){{ | 
| 48 if(sf.get(attr) !== undefined){{ | |
| 49 return sf.get(attr); | |
| 50 }} | |
| 51 if(sf.children() === undefined) {{ | |
| 52 return; | |
| 53 }}else{{ | |
| 54 var kids = sf.children(); | |
| 55 for(var child_idx in kids){{ | |
| 56 var x = self(kids[child_idx], attr); | |
| 57 if(x !== undefined){{ | |
| 58 return x; | |
| 59 }} | |
| 60 }} | |
| 61 return; | |
| 62 }} | |
| 63 }}; | |
| 64 | |
| 65 var color = ({user_spec_color} || search_up(feature, 'color') || search_down(feature, 'color') || {auto_gen_color}); | |
| 66 var score = (search_up(feature, 'score') || search_down(feature, 'score')); | |
| 67 {opacity} | |
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 68 if(score === undefined){{ opacity = 1; }} | 
| 3 | 69 var result = /^#?([a-f\d]{{2}})([a-f\d]{{2}})([a-f\d]{{2}})$/i.exec(color); | 
| 70 var red = parseInt(result[1], 16); | |
| 71 var green = parseInt(result[2], 16); | |
| 72 var blue = parseInt(result[3], 16); | |
| 73 if(isNaN(opacity) || opacity < 0){{ opacity = 0; }} | |
| 74 return 'rgba(' + red + ',' + green + ',' + blue + ',' + opacity + ')'; | |
| 75 }} | |
| 76 """ | |
| 0 
2c9e5136b416
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 685773d3da40afdc4d14846d4935b3b0a100f56e
 iuc parents: diff
changeset | 77 | 
| 3 | 78 OPACITY_MATH = { | 
| 79 'linear': """ | |
| 80 var opacity = (score - ({min})) / (({max}) - ({min})); | |
| 81 """, | |
| 82 'logarithmic': """ | |
| 31 
2bb2e07a7a21
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 12dff0abf006f6c81f6462cdf4ea9c0c740d1e9c
 iuc parents: 
28diff
changeset | 83 var opacity = Math.log10(score - ({min})) / Math.log10(({max}) - ({min})); | 
| 3 | 84 """, | 
| 85 'blast': """ | |
| 86 var opacity = 0; | |
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 87 if(score == 0.0) {{ | 
| 3 | 88 opacity = 1; | 
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 89 }} else {{ | 
| 3 | 90 opacity = (20 - Math.log10(score)) / 180; | 
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 91 }} | 
| 3 | 92 """ | 
| 93 } | |
| 1 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 94 | 
| 3 | 95 BREWER_COLOUR_IDX = 0 | 
| 96 BREWER_COLOUR_SCHEMES = [ | |
| 97 (166, 206, 227), | |
| 98 (31, 120, 180), | |
| 99 (178, 223, 138), | |
| 100 (51, 160, 44), | |
| 101 (251, 154, 153), | |
| 102 (227, 26, 28), | |
| 103 (253, 191, 111), | |
| 104 (255, 127, 0), | |
| 105 (202, 178, 214), | |
| 106 (106, 61, 154), | |
| 107 (255, 255, 153), | |
| 108 (177, 89, 40), | |
| 109 (228, 26, 28), | |
| 110 (55, 126, 184), | |
| 111 (77, 175, 74), | |
| 112 (152, 78, 163), | |
| 113 (255, 127, 0), | |
| 114 ] | |
| 115 | |
| 116 BREWER_DIVERGING_PALLETES = { | |
| 117 'BrBg': ("#543005", "#003c30"), | |
| 118 'PiYg': ("#8e0152", "#276419"), | |
| 119 'PRGn': ("#40004b", "#00441b"), | |
| 120 'PuOr': ("#7f3b08", "#2d004b"), | |
| 121 'RdBu': ("#67001f", "#053061"), | |
| 122 'RdGy': ("#67001f", "#1a1a1a"), | |
| 123 'RdYlBu': ("#a50026", "#313695"), | |
| 124 'RdYlGn': ("#a50026", "#006837"), | |
| 125 'Spectral': ("#9e0142", "#5e4fa2"), | |
| 126 } | |
| 127 | |
| 128 def __init__(self): | |
| 1 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 129 self.brewer_colour_idx = 0 | 
| 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 130 | 
| 3 | 131 def rgb_from_hex(self, hexstr): | 
| 132 # http://stackoverflow.com/questions/4296249/how-do-i-convert-a-hex-triplet-to-an-rgb-tuple-and-back | |
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 133 return struct.unpack('BBB', binascii.unhexlify(hexstr)) | 
| 1 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 134 | 
| 3 | 135 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: 
0diff
changeset | 136 min_val = None | 
| 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 137 max_val = None | 
| 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 138 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: 
0diff
changeset | 139 for line in handle: | 
| 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 140 try: | 
| 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 141 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: 
0diff
changeset | 142 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: 
0diff
changeset | 143 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: 
0diff
changeset | 144 | 
| 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 145 if value < min_val: | 
| 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 146 min_val = value | 
| 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 147 | 
| 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 148 if value > max_val: | 
| 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 149 max_val = value | 
| 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 150 except Exception: | 
| 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 151 pass | 
| 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 152 return min_val, max_val | 
| 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 153 | 
| 3 | 154 def hex_from_rgb(self, r, g, b): | 
| 155 return '#%02x%02x%02x' % (r, g, b) | |
| 156 | |
| 157 def _get_colours(self): | |
| 5 
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
 iuc parents: 
3diff
changeset | 158 r, g, b = self.BREWER_COLOUR_SCHEMES[self.brewer_colour_idx % len(self.BREWER_COLOUR_SCHEMES)] | 
| 3 | 159 self.brewer_colour_idx += 1 | 
| 160 return r, g, b | |
| 161 | |
| 8 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 162 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: 
11diff
changeset | 163 trackConfig = {'menuTemplate': [{}, {}, {}, {}]} | 
| 8 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 164 | 
| 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 165 if 'menu' in track['menus']: | 
| 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
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: 
5diff
changeset | 167 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: 
5diff
changeset | 168 menu_list = track['menus']['menu'] | 
| 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 169 | 
| 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 170 for m in menu_list: | 
| 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 171 tpl = { | 
| 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 172 'action': m['action'], | 
| 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 173 'label': m.get('label', '{name}'), | 
| 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 174 'iconClass': m.get('iconClass', 'dijitIconBookmark'), | 
| 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 175 } | 
| 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 176 if 'url' in m: | 
| 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 177 tpl['url'] = m['url'] | 
| 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 178 if 'content' in m: | 
| 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 179 tpl['content'] = m['content'] | 
| 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 180 if 'title' in m: | 
| 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 181 tpl['title'] = m['title'] | 
| 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 182 | 
| 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 183 trackConfig['menuTemplate'].append(tpl) | 
| 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 184 | 
| 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 185 return trackConfig | 
| 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 186 | 
| 3 | 187 def parse_colours(self, track, trackFormat, gff3=None): | 
| 188 # Wiggle tracks have a bicolor pallete | |
| 189 trackConfig = {'style': {}} | |
| 190 if trackFormat == 'wiggle': | |
| 191 | |
| 192 trackConfig['style']['pos_color'] = track['wiggle']['color_pos'] | |
| 193 trackConfig['style']['neg_color'] = track['wiggle']['color_neg'] | |
| 194 | |
| 195 if trackConfig['style']['pos_color'] == '__auto__': | |
| 196 trackConfig['style']['neg_color'] = self.hex_from_rgb(*self._get_colours()) | |
| 197 trackConfig['style']['pos_color'] = self.hex_from_rgb(*self._get_colours()) | |
| 198 | |
| 199 # Wiggle tracks can change colour at a specified place | |
| 200 bc_pivot = track['wiggle']['bicolor_pivot'] | |
| 201 if bc_pivot not in ('mean', 'zero'): | |
| 202 # The values are either one of those two strings | |
| 203 # or a number | |
| 204 bc_pivot = float(bc_pivot) | |
| 205 trackConfig['bicolor_pivot'] = bc_pivot | |
| 206 elif 'scaling' in track: | |
| 207 if track['scaling']['method'] == 'ignore': | |
| 208 if track['scaling']['scheme']['color'] != '__auto__': | |
| 209 trackConfig['style']['color'] = track['scaling']['scheme']['color'] | |
| 210 else: | |
| 211 trackConfig['style']['color'] = self.hex_from_rgb(*self._get_colours()) | |
| 212 else: | |
| 213 # Scored method | |
| 214 algo = track['scaling']['algo'] | |
| 215 # linear, logarithmic, blast | |
| 216 scales = track['scaling']['scales'] | |
| 217 # type __auto__, manual (min, max) | |
| 218 scheme = track['scaling']['scheme'] | |
| 219 # scheme -> (type (opacity), color) | |
| 220 # ================================== | |
| 221 # GENE CALLS OR BLAST | |
| 222 # ================================== | |
| 223 if trackFormat == 'blast': | |
| 224 red, green, blue = self._get_colours() | |
| 225 color_function = self.COLOR_FUNCTION_TEMPLATE.format(**{ | |
| 226 'score': "feature._parent.get('score')", | |
| 227 'opacity': self.OPACITY_MATH['blast'], | |
| 228 'red': red, | |
| 229 'green': green, | |
| 230 'blue': blue, | |
| 231 }) | |
| 232 trackConfig['style']['color'] = color_function.replace('\n', '') | |
| 233 elif trackFormat == 'gene_calls': | |
| 234 # Default values, based on GFF3 spec | |
| 235 min_val = 0 | |
| 236 max_val = 1000 | |
| 237 # 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: 
3diff
changeset | 238 if scales['type'] == 'automatic' or scales['type'] == '__auto__': | 
| 3 | 239 min_val, max_val = self.min_max_gff(gff3) | 
| 240 else: | |
| 5 
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
 iuc parents: 
3diff
changeset | 241 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: 
3diff
changeset | 242 max_val = scales.get('max', 1000) | 
| 3 | 243 | 
| 244 if scheme['color'] == '__auto__': | |
| 245 user_color = 'undefined' | |
| 246 auto_color = "'%s'" % self.hex_from_rgb(*self._get_colours()) | |
| 247 elif scheme['color'].startswith('#'): | |
| 248 user_color = "'%s'" % self.hex_from_rgb(*self.rgb_from_hex(scheme['color'][1:])) | |
| 249 auto_color = 'undefined' | |
| 250 else: | |
| 251 user_color = 'undefined' | |
| 252 auto_color = "'%s'" % self.hex_from_rgb(*self._get_colours()) | |
| 253 | |
| 254 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: 
5diff
changeset | 255 'opacity': self.OPACITY_MATH[algo].format(**{'max': max_val, 'min': min_val}), | 
| 3 | 256 'user_spec_color': user_color, | 
| 257 'auto_gen_color': auto_color, | |
| 258 }) | |
| 259 | |
| 260 trackConfig['style']['color'] = color_function.replace('\n', '') | |
| 261 return trackConfig | |
| 262 | |
| 263 | |
| 264 def etree_to_dict(t): | |
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 265 if t is None: | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 266 return {} | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 267 | 
| 3 | 268 d = {t.tag: {} if t.attrib else None} | 
| 269 children = list(t) | |
| 270 if children: | |
| 271 dd = defaultdict(list) | |
| 272 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: 
8diff
changeset | 273 for k, v in dc.items(): | 
| 3 | 274 dd[k].append(v) | 
| 10 
1a6d882d340d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit ac44b067ee08de23180e8b5030374cf362ac4524
 iuc parents: 
8diff
changeset | 275 d = {t.tag: {k: v[0] if len(v) == 1 else v for k, v in dd.items()}} | 
| 3 | 276 if t.attrib: | 
| 10 
1a6d882d340d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit ac44b067ee08de23180e8b5030374cf362ac4524
 iuc parents: 
8diff
changeset | 277 d[t.tag].update(('@' + k, v) for k, v in t.attrib.items()) | 
| 3 | 278 if t.text: | 
| 279 text = t.text.strip() | |
| 280 if children or t.attrib: | |
| 281 if text: | |
| 8 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 282 d[t.tag]['#text'] = text | 
| 3 | 283 else: | 
| 284 d[t.tag] = text | |
| 285 return d | |
| 286 | |
| 287 | |
| 288 # score comes from feature._parent.get('score') or feature.get('score') | |
| 289 | |
| 290 INSTALLED_TO = os.path.dirname(os.path.realpath(__file__)) | |
| 291 | |
| 292 | |
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 293 def metadata_from_node(node): | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 294 metadata = {} | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 295 try: | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 296 if len(node.findall('dataset')) != 1: | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 297 # exit early | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 298 return metadata | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 299 except Exception: | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 300 return {} | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 301 | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 302 for (key, value) in node.findall('dataset')[0].attrib.items(): | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 303 metadata['dataset_%s' % key] = value | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 304 | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 305 for (key, value) in node.findall('history')[0].attrib.items(): | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 306 metadata['history_%s' % key] = value | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 307 | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 308 for (key, value) in node.findall('metadata')[0].attrib.items(): | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 309 metadata['metadata_%s' % key] = value | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 310 | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 311 for (key, value) in node.findall('tool')[0].attrib.items(): | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 312 metadata['tool_%s' % key] = value | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 313 | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 314 # Additional Mappings applied: | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 315 metadata['dataset_edam_format'] = '<a target="_blank" href="http://edamontology.org/{0}">{1}</a>'.format(metadata['dataset_edam_format'], metadata['dataset_file_ext']) | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 316 metadata['history_user_email'] = '<a href="mailto:{0}">{0}</a>'.format(metadata['history_user_email']) | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 317 metadata['history_display_name'] = '<a target="_blank" href="{galaxy}/history/view/{encoded_hist_id}">{hist_name}</a>'.format( | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 318 galaxy=GALAXY_INFRASTRUCTURE_URL, | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 319 encoded_hist_id=metadata['history_id'], | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 320 hist_name=metadata['history_display_name'] | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 321 ) | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 322 metadata['tool_tool'] = '<a target="_blank" href="{galaxy}/datasets/{encoded_id}/show_params">{tool_id}</a>'.format( | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 323 galaxy=GALAXY_INFRASTRUCTURE_URL, | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 324 encoded_id=metadata['dataset_id'], | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 325 tool_id=metadata['tool_tool_id'], | 
| 40 
17359b808b01
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2f072c4183a0d1221fb9d81909aeeafb2dbda892"
 iuc parents: 
34diff
changeset | 326 # tool_version=metadata['tool_tool_version'], | 
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 327 ) | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 328 return metadata | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 329 | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 330 | 
| 3 | 331 class JbrowseConnector(object): | 
| 332 | |
| 40 
17359b808b01
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2f072c4183a0d1221fb9d81909aeeafb2dbda892"
 iuc parents: 
34diff
changeset | 333 def __init__(self, jbrowse, outdir, genomes, standalone=None, gencode=1): | 
| 3 | 334 self.cs = ColorScaling() | 
| 335 self.jbrowse = jbrowse | |
| 336 self.outdir = outdir | |
| 337 self.genome_paths = genomes | |
| 338 self.standalone = standalone | |
| 339 self.gencode = gencode | |
| 8 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 340 self.tracksToIndex = [] | 
| 3 | 341 | 
| 40 
17359b808b01
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2f072c4183a0d1221fb9d81909aeeafb2dbda892"
 iuc parents: 
34diff
changeset | 342 if standalone == "complete": | 
| 3 | 343 self.clone_jbrowse(self.jbrowse, self.outdir) | 
| 40 
17359b808b01
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2f072c4183a0d1221fb9d81909aeeafb2dbda892"
 iuc parents: 
34diff
changeset | 344 elif standalone == "minimal": | 
| 
17359b808b01
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2f072c4183a0d1221fb9d81909aeeafb2dbda892"
 iuc parents: 
34diff
changeset | 345 self.clone_jbrowse(self.jbrowse, self.outdir, minimal=True) | 
| 3 | 346 else: | 
| 347 try: | |
| 348 os.makedirs(self.outdir) | |
| 349 except OSError: | |
| 350 # Ignore if the folder exists | |
| 351 pass | |
| 352 | |
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 353 try: | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 354 os.makedirs(os.path.join(self.outdir, 'data', 'raw')) | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 355 except OSError: | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 356 # Ignore if the folder exists | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 357 pass | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 358 | 
| 3 | 359 self.process_genomes() | 
| 360 self.update_gencode() | |
| 361 | |
| 362 def update_gencode(self): | |
| 363 table = CodonTable.unambiguous_dna_by_id[int(self.gencode)] | |
| 364 trackList = os.path.join(self.outdir, 'data', 'trackList.json') | |
| 365 with open(trackList, 'r') as handle: | |
| 366 trackListData = json.load(handle) | |
| 1 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 367 | 
| 3 | 368 trackListData['tracks'][0].update({ | 
| 369 'codonStarts': table.start_codons, | |
| 370 'codonStops': table.stop_codons, | |
| 371 'codonTable': table.forward_table, | |
| 372 }) | |
| 373 | |
| 374 with open(trackList, 'w') as handle: | |
| 375 json.dump(trackListData, handle, indent=2) | |
| 376 | |
| 33 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 377 def subprocess_check_call(self, command, output=None): | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 378 if output: | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 379 log.debug('cd %s && %s > %s', self.outdir, ' '.join(command), output) | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 380 subprocess.check_call(command, cwd=self.outdir, stdout=output) | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 381 else: | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 382 log.debug('cd %s && %s', self.outdir, ' '.join(command)) | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 383 subprocess.check_call(command, cwd=self.outdir) | 
| 3 | 384 | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 385 def subprocess_popen(self, command): | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 386 log.debug('cd %s && %s', self.outdir, command) | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 387 p = subprocess.Popen(command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 388 output, err = p.communicate() | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 389 retcode = p.returncode | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 390 if retcode != 0: | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 391 log.error('cd %s && %s', self.outdir, command) | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 392 log.error(output) | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 393 log.error(err) | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 394 raise RuntimeError("Command failed with exit code %s" % (retcode)) | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 395 | 
| 40 
17359b808b01
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2f072c4183a0d1221fb9d81909aeeafb2dbda892"
 iuc parents: 
34diff
changeset | 396 def subprocess_check_output(self, command): | 
| 
17359b808b01
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2f072c4183a0d1221fb9d81909aeeafb2dbda892"
 iuc parents: 
34diff
changeset | 397 log.debug('cd %s && %s', self.outdir, ' '.join(command)) | 
| 
17359b808b01
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2f072c4183a0d1221fb9d81909aeeafb2dbda892"
 iuc parents: 
34diff
changeset | 398 return subprocess.check_output(command, cwd=self.outdir) | 
| 
17359b808b01
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2f072c4183a0d1221fb9d81909aeeafb2dbda892"
 iuc parents: 
34diff
changeset | 399 | 
| 3 | 400 def _jbrowse_bin(self, command): | 
| 401 return os.path.realpath(os.path.join(self.jbrowse, 'bin', command)) | |
| 402 | |
| 41 
8774b28235bb
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 8556ea066463f5e112b6ded2c1527011ab1e3b38"
 iuc parents: 
40diff
changeset | 403 def symlink_or_copy(self, src, dest): | 
| 
8774b28235bb
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 8556ea066463f5e112b6ded2c1527011ab1e3b38"
 iuc parents: 
40diff
changeset | 404 if 'GALAXY_JBROWSE_SYMLINKS' in os.environ and bool(os.environ['GALAXY_JBROWSE_SYMLINKS']): | 
| 
8774b28235bb
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 8556ea066463f5e112b6ded2c1527011ab1e3b38"
 iuc parents: 
40diff
changeset | 405 cmd = ['ln', '-s', src, dest] | 
| 
8774b28235bb
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 8556ea066463f5e112b6ded2c1527011ab1e3b38"
 iuc parents: 
40diff
changeset | 406 else: | 
| 
8774b28235bb
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 8556ea066463f5e112b6ded2c1527011ab1e3b38"
 iuc parents: 
40diff
changeset | 407 cmd = ['cp', src, dest] | 
| 
8774b28235bb
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 8556ea066463f5e112b6ded2c1527011ab1e3b38"
 iuc parents: 
40diff
changeset | 408 | 
| 
8774b28235bb
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 8556ea066463f5e112b6ded2c1527011ab1e3b38"
 iuc parents: 
40diff
changeset | 409 return self.subprocess_check_call(cmd) | 
| 
8774b28235bb
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 8556ea066463f5e112b6ded2c1527011ab1e3b38"
 iuc parents: 
40diff
changeset | 410 | 
| 3 | 411 def process_genomes(self): | 
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 412 for genome_node in self.genome_paths: | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 413 # We only expect one input genome per run. This for loop is just | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 414 # easier to write than the alternative / catches any possible | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 415 # issues. | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 416 | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 417 # Copy the file in workdir, prepare-refseqs.pl will copy it to jbrowse's data dir | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 418 local_genome = os.path.realpath('./genome.fasta') | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 419 shutil.copy(genome_node['path'], local_genome) | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 420 | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 421 cmd = ['samtools', 'faidx', local_genome] | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 422 self.subprocess_check_call(cmd) | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 423 | 
| 3 | 424 self.subprocess_check_call([ | 
| 425 'perl', self._jbrowse_bin('prepare-refseqs.pl'), | |
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 426 '--trackConfig', json.dumps({'metadata': genome_node['meta']}), | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 427 '--indexed_fasta', os.path.realpath(local_genome)]) | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 428 | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 429 os.unlink(local_genome) | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 430 os.unlink(local_genome + '.fai') | 
| 3 | 431 | 
| 8 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 432 def generate_names(self): | 
| 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 433 # Generate names | 
| 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 434 args = [ | 
| 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 435 '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: 
5diff
changeset | 436 '--hashBits', '16' | 
| 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 437 ] | 
| 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 438 | 
| 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 439 tracks = ','.join(self.tracksToIndex) | 
| 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 440 if tracks: | 
| 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 441 args += ['--tracks', tracks] | 
| 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 442 else: | 
| 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 443 # 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: 
5diff
changeset | 444 args += ['--tracks', 'DNA'] | 
| 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 445 | 
| 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 446 self.subprocess_check_call(args) | 
| 3 | 447 | 
| 5 
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
 iuc parents: 
3diff
changeset | 448 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: 
3diff
changeset | 449 cmd = [ | 
| 
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
 iuc parents: 
3diff
changeset | 450 '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: 
3diff
changeset | 451 json.dumps(json_data), | 
| 
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
 iuc parents: 
3diff
changeset | 452 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: 
3diff
changeset | 453 ] | 
| 3 | 454 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: 
0diff
changeset | 455 | 
| 3 | 456 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: 
8diff
changeset | 457 if len(json_data) == 0: | 
| 3 | 458 return | 
| 459 | |
| 460 tmp = tempfile.NamedTemporaryFile(delete=False) | |
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 461 json.dump(json_data, tmp) | 
| 3 | 462 tmp.close() | 
| 463 cmd = ['perl', self._jbrowse_bin('add-track-json.pl'), tmp.name, | |
| 464 os.path.join('data', 'trackList.json')] | |
| 465 self.subprocess_check_call(cmd) | |
| 466 os.unlink(tmp.name) | |
| 467 | |
| 468 def _blastxml_to_gff3(self, xml, min_gap=10): | |
| 469 gff3_unrebased = tempfile.NamedTemporaryFile(delete=False) | |
| 470 cmd = ['python', os.path.join(INSTALLED_TO, 'blastxml_to_gapped_gff3.py'), | |
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 471 '--trim', '--trim_end', '--include_seq', '--min_gap', str(min_gap), xml] | 
| 3 | 472 log.debug('cd %s && %s > %s', self.outdir, ' '.join(cmd), gff3_unrebased.name) | 
| 473 subprocess.check_call(cmd, cwd=self.outdir, stdout=gff3_unrebased) | |
| 474 gff3_unrebased.close() | |
| 475 return gff3_unrebased.name | |
| 476 | |
| 477 def add_blastxml(self, data, trackData, blastOpts, **kwargs): | |
| 478 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 | 479 | 
| 5 
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
 iuc parents: 
3diff
changeset | 480 if 'parent' in blastOpts and blastOpts['parent'] != 'None': | 
| 3 | 481 gff3_rebased = tempfile.NamedTemporaryFile(delete=False) | 
| 482 cmd = ['python', os.path.join(INSTALLED_TO, 'gff3_rebase.py')] | |
| 483 if blastOpts.get('protein', 'false') == 'true': | |
| 484 cmd.append('--protein2dna') | |
| 485 cmd.extend([os.path.realpath(blastOpts['parent']), gff3]) | |
| 486 log.debug('cd %s && %s > %s', self.outdir, ' '.join(cmd), gff3_rebased.name) | |
| 487 subprocess.check_call(cmd, cwd=self.outdir, stdout=gff3_rebased) | |
| 488 gff3_rebased.close() | |
| 489 | |
| 490 # Replace original gff3 file | |
| 491 shutil.copy(gff3_rebased.name, gff3) | |
| 492 os.unlink(gff3_rebased.name) | |
| 493 | |
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 494 dest = os.path.join(self.outdir, 'data', 'raw', trackData['label'] + '.gff') | 
| 3 | 495 | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 496 self._sort_gff(gff3, dest) | 
| 3 | 497 | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 498 url = os.path.join('raw', trackData['label'] + '.gff.gz') | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 499 trackData.update({ | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 500 "urlTemplate": url, | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 501 "storeClass": "JBrowse/Store/SeqFeature/GFF3Tabix", | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 502 }) | 
| 3 | 503 | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 504 trackData['glyph'] = 'JBrowse/View/FeatureGlyph/Segments' | 
| 13 
69c5e9c0add0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit bb4fe9cc4bc03918afa525569ed36144a819ce79
 iuc parents: 
12diff
changeset | 505 | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 506 trackData['trackType'] = 'BlastView/View/Track/CanvasFeatures' | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 507 trackData['type'] = 'BlastView/View/Track/CanvasFeatures' | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 508 | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 509 self._add_track_json(trackData) | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 510 | 
| 3 | 511 os.unlink(gff3) | 
| 512 | |
| 8 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 513 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: 
5diff
changeset | 514 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: 
5diff
changeset | 515 | 
| 3 | 516 def add_bigwig(self, data, trackData, wiggleOpts, **kwargs): | 
| 517 dest = os.path.join('data', 'raw', trackData['label'] + '.bw') | |
| 41 
8774b28235bb
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 8556ea066463f5e112b6ded2c1527011ab1e3b38"
 iuc parents: 
40diff
changeset | 518 self.symlink_or_copy(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: 
0diff
changeset | 519 | 
| 12 
db5fe5a3176a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
 iuc parents: 
11diff
changeset | 520 url = os.path.join('raw', trackData['label'] + '.bw') | 
| 3 | 521 trackData.update({ | 
| 12 
db5fe5a3176a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
 iuc parents: 
11diff
changeset | 522 "urlTemplate": url, | 
| 3 | 523 "storeClass": "JBrowse/Store/SeqFeature/BigWig", | 
| 524 "type": "JBrowse/View/Track/Wiggle/Density", | |
| 525 }) | |
| 526 | |
| 527 trackData['type'] = wiggleOpts['type'] | |
| 528 trackData['variance_band'] = True if wiggleOpts['variance_band'] == 'true' else False | |
| 529 | |
| 530 if 'min' in wiggleOpts and 'max' in wiggleOpts: | |
| 531 trackData['min_score'] = wiggleOpts['min'] | |
| 532 trackData['max_score'] = wiggleOpts['max'] | |
| 533 else: | |
| 534 trackData['autoscale'] = wiggleOpts.get('autoscale', 'local') | |
| 535 | |
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 536 trackData['scale'] = wiggleOpts['scale'] | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 537 | 
| 3 | 538 self._add_track_json(trackData) | 
| 539 | |
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 540 def add_bigwig_multiple(self, data, trackData, wiggleOpts, **kwargs): | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 541 | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 542 urls = [] | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 543 for idx, bw in enumerate(data): | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 544 dest = os.path.join('data', 'raw', trackData['label'] + '_' + str(idx) + '.bw') | 
| 41 
8774b28235bb
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 8556ea066463f5e112b6ded2c1527011ab1e3b38"
 iuc parents: 
40diff
changeset | 545 self.symlink_or_copy(bw[1], dest) | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 546 | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 547 urls.append({"url": os.path.join('raw', trackData['label'] + '_' + str(idx) + '.bw'), "name": str(idx + 1) + ' - ' + bw[0]}) | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 548 | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 549 trackData.update({ | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 550 "urlTemplates": urls, | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 551 "showTooltips": "true", | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 552 "storeClass": "MultiBigWig/Store/SeqFeature/MultiBigWig", | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 553 "type": "MultiBigWig/View/Track/MultiWiggle/MultiDensity", | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 554 }) | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 555 if 'XYPlot' in wiggleOpts['type']: | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 556 trackData['type'] = "MultiBigWig/View/Track/MultiWiggle/MultiXYPlot" | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 557 | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 558 trackData['variance_band'] = True if wiggleOpts['variance_band'] == 'true' else False | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 559 | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 560 if 'min' in wiggleOpts and 'max' in wiggleOpts: | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 561 trackData['min_score'] = wiggleOpts['min'] | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 562 trackData['max_score'] = wiggleOpts['max'] | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 563 else: | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 564 trackData['autoscale'] = wiggleOpts.get('autoscale', 'local') | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 565 | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 566 trackData['scale'] = wiggleOpts['scale'] | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 567 | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 568 self._add_track_json(trackData) | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 569 | 
| 33 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 570 def add_maf(self, data, trackData, mafOpts, **kwargs): | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 571 script = os.path.realpath(os.path.join(self.jbrowse, 'plugins', 'MAFViewer', 'bin', 'maf2bed.pl')) | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 572 dest = os.path.join('data', 'raw', trackData['label'] + '.txt') | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 573 | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 574 tmp1 = tempfile.NamedTemporaryFile(delete=False) | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 575 tmp1.close() | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 576 | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 577 # Process MAF to bed-like | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 578 cmd = [script, data] | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 579 self.subprocess_check_call(cmd, output=tmp1.path) | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 580 | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 581 # Sort / Index it | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 582 self._sort_bed(tmp1.path, dest) | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 583 # Cleanup | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 584 try: | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 585 os.remove(tmp1.path) | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 586 except OSError: | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 587 pass | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 588 | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 589 # Construct samples list | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 590 # We could get this from galaxy metadata, not sure how easily. | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 591 ps = subprocess.Popen(['grep', '^s [^ ]*', '-o', data], stdout=subprocess.PIPE) | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 592 output = subprocess.check_output(('sort', '-u'), stdin=ps.stdout) | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 593 ps.wait() | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 594 samples = [x[2:] for x in output] | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 595 | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 596 trackData.update({ | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 597 "storeClass": "MAFViewer/Store/SeqFeature/MAFTabix", | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 598 "type": "MAFViewer/View/Track/MAF", | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 599 "urlTemplate": trackData['label'] + '.txt.gz', | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 600 "samples": samples, | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 601 }) | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 602 | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 603 self._add_track_json(trackData) | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 604 | 
| 3 | 605 def add_bam(self, data, trackData, bamOpts, bam_index=None, **kwargs): | 
| 606 dest = os.path.join('data', 'raw', trackData['label'] + '.bam') | |
| 41 
8774b28235bb
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 8556ea066463f5e112b6ded2c1527011ab1e3b38"
 iuc parents: 
40diff
changeset | 607 self.symlink_or_copy(os.path.realpath(data), dest) | 
| 
8774b28235bb
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 8556ea066463f5e112b6ded2c1527011ab1e3b38"
 iuc parents: 
40diff
changeset | 608 self.symlink_or_copy(os.path.realpath(bam_index), dest + '.bai') | 
| 3 | 609 | 
| 12 
db5fe5a3176a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
 iuc parents: 
11diff
changeset | 610 url = os.path.join('raw', trackData['label'] + '.bam') | 
| 3 | 611 trackData.update({ | 
| 12 
db5fe5a3176a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
 iuc parents: 
11diff
changeset | 612 "urlTemplate": url, | 
| 1 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 613 "type": "JBrowse/View/Track/Alignments2", | 
| 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 614 "storeClass": "JBrowse/Store/SeqFeature/BAM", | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 615 "chunkSizeLimit": bamOpts.get('chunkSizeLimit', '5000000') | 
| 3 | 616 }) | 
| 617 | |
| 14 
18be2d72fdee
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0bfb0de98c918860c21808e8832caad9f0535975
 iuc parents: 
13diff
changeset | 618 # 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: 
13diff
changeset | 619 # 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: 
13diff
changeset | 620 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: 
13diff
changeset | 621 del trackData['style']['className'] | 
| 
18be2d72fdee
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0bfb0de98c918860c21808e8832caad9f0535975
 iuc parents: 
13diff
changeset | 622 | 
| 3 | 623 self._add_track_json(trackData) | 
| 624 | |
| 625 if bamOpts.get('auto_snp', 'false') == 'true': | |
| 626 trackData2 = copy.copy(trackData) | |
| 627 trackData2.update({ | |
| 1 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 628 "type": "JBrowse/View/Track/SNPCoverage", | 
| 3 | 629 "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: 
5diff
changeset | 630 "label": trackData['label'] + "_autosnp", | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 631 "chunkSizeLimit": bamOpts.get('chunkSizeLimit', '5000000') | 
| 3 | 632 }) | 
| 633 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: 
0diff
changeset | 634 | 
| 3 | 635 def add_vcf(self, data, trackData, vcfOpts={}, **kwargs): | 
| 636 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: 
0diff
changeset | 637 # ln? | 
| 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 638 cmd = ['ln', '-s', data, dest] | 
| 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 639 self.subprocess_check_call(cmd) | 
| 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 640 cmd = ['bgzip', dest] | 
| 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 641 self.subprocess_check_call(cmd) | 
| 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 642 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: 
0diff
changeset | 643 self.subprocess_check_call(cmd) | 
| 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 644 | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 645 url = os.path.join('raw', trackData['label'] + '.vcf.gz') | 
| 3 | 646 trackData.update({ | 
| 12 
db5fe5a3176a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
 iuc parents: 
11diff
changeset | 647 "urlTemplate": url, | 
| 1 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 648 "type": "JBrowse/View/Track/HTMLVariants", | 
| 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 649 "storeClass": "JBrowse/Store/SeqFeature/VCFTabix", | 
| 3 | 650 }) | 
| 651 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: 
0diff
changeset | 652 | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 653 def _sort_gff(self, data, dest): | 
| 33 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 654 # Only index if not already done | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 655 if not os.path.exists(dest): | 
| 28 
d0743cb18ed8
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3b3c0f1ea1756b0b250b5eb91661f33f11cc9c6d
 iuc parents: 
27diff
changeset | 656 cmd = "gff3sort.pl --precise '%s' | grep -v \"^$\" > '%s'" % (data, dest) | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 657 self.subprocess_popen(cmd) | 
| 1 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 658 | 
| 33 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 659 self.subprocess_check_call(['bgzip', '-f', dest]) | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 660 self.subprocess_check_call(['tabix', '-f', '-p', 'gff', dest + '.gz']) | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 661 | 
| 33 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 662 def _sort_bed(self, data, dest): | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 663 # Only index if not already done | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 664 if not os.path.exists(dest): | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 665 cmd = ['sort', '-k1,1', '-k2,2n', data] | 
| 34 
9de82b4963e6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0a26506563ff9b7fa683d3d0eaa16436c3560908"
 iuc parents: 
33diff
changeset | 666 with open(dest, 'w') as handle: | 
| 
9de82b4963e6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0a26506563ff9b7fa683d3d0eaa16436c3560908"
 iuc parents: 
33diff
changeset | 667 self.subprocess_check_call(cmd, output=handle) | 
| 13 
69c5e9c0add0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit bb4fe9cc4bc03918afa525569ed36144a819ce79
 iuc parents: 
12diff
changeset | 668 | 
| 33 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 669 self.subprocess_check_call(['bgzip', '-f', dest]) | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 670 self.subprocess_check_call(['tabix', '-f', '-p', 'bed', dest + '.gz']) | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 671 | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 672 def add_gff(self, data, format, trackData, gffOpts, **kwargs): | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 673 dest = os.path.join(self.outdir, 'data', 'raw', trackData['label'] + '.gff') | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 674 | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 675 self._sort_gff(data, dest) | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 676 | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 677 url = os.path.join('raw', trackData['label'] + '.gff.gz') | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 678 trackData.update({ | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 679 "urlTemplate": url, | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 680 "storeClass": "JBrowse/Store/SeqFeature/GFF3Tabix", | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 681 }) | 
| 1 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 682 | 
| 8 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 683 if 'match' in gffOpts: | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 684 trackData['glyph'] = 'JBrowse/View/FeatureGlyph/Segments' | 
| 5 
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
 iuc parents: 
3diff
changeset | 685 | 
| 10 
1a6d882d340d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit ac44b067ee08de23180e8b5030374cf362ac4524
 iuc parents: 
8diff
changeset | 686 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: 
3diff
changeset | 687 if 'trackType' in gffOpts: | 
| 10 
1a6d882d340d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit ac44b067ee08de23180e8b5030374cf362ac4524
 iuc parents: 
8diff
changeset | 688 trackType = gffOpts['trackType'] | 
| 27 
61ce21e36cb5
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0c51a106c04c2f56f5a172dd74c8494687870e46
 iuc parents: 
25diff
changeset | 689 trackData['type'] = trackType | 
| 
61ce21e36cb5
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0c51a106c04c2f56f5a172dd74c8494687870e46
 iuc parents: 
25diff
changeset | 690 trackData['trackType'] = trackType # Probably only used by old jbrowse versions | 
| 10 
1a6d882d340d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit ac44b067ee08de23180e8b5030374cf362ac4524
 iuc parents: 
8diff
changeset | 691 | 
| 27 
61ce21e36cb5
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0c51a106c04c2f56f5a172dd74c8494687870e46
 iuc parents: 
25diff
changeset | 692 if trackType in ['JBrowse/View/Track/CanvasFeatures', 'NeatCanvasFeatures/View/Track/NeatFeatures']: | 
| 10 
1a6d882d340d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit ac44b067ee08de23180e8b5030374cf362ac4524
 iuc parents: 
8diff
changeset | 693 if 'transcriptType' in gffOpts and gffOpts['transcriptType']: | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 694 trackData['transcriptType'] = gffOpts['transcriptType'] | 
| 10 
1a6d882d340d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit ac44b067ee08de23180e8b5030374cf362ac4524
 iuc parents: 
8diff
changeset | 695 if 'subParts' in gffOpts and gffOpts['subParts']: | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 696 trackData['subParts'] = gffOpts['subParts'] | 
| 10 
1a6d882d340d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit ac44b067ee08de23180e8b5030374cf362ac4524
 iuc parents: 
8diff
changeset | 697 if 'impliedUTRs' in gffOpts and gffOpts['impliedUTRs']: | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 698 trackData['impliedUTRs'] = gffOpts['impliedUTRs'] | 
| 27 
61ce21e36cb5
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0c51a106c04c2f56f5a172dd74c8494687870e46
 iuc parents: 
25diff
changeset | 699 elif trackType in ['JBrowse/View/Track/HTMLFeatures', 'NeatHTMLFeatures/View/Track/NeatFeatures']: | 
| 
61ce21e36cb5
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0c51a106c04c2f56f5a172dd74c8494687870e46
 iuc parents: 
25diff
changeset | 700 if 'topLevelFeatures' in gffOpts and gffOpts['topLevelFeatures']: | 
| 
61ce21e36cb5
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0c51a106c04c2f56f5a172dd74c8494687870e46
 iuc parents: 
25diff
changeset | 701 trackData['topLevelFeatures'] = gffOpts['topLevelFeatures'] | 
| 10 
1a6d882d340d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit ac44b067ee08de23180e8b5030374cf362ac4524
 iuc parents: 
8diff
changeset | 702 | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 703 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: 
0diff
changeset | 704 | 
| 8 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 705 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: 
5diff
changeset | 706 self.tracksToIndex.append("%s" % trackData['label']) | 
| 3 | 707 | 
| 33 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 708 def add_bed(self, data, format, trackData, gffOpts, **kwargs): | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 709 dest = os.path.join(self.outdir, 'data', 'raw', trackData['label'] + '.bed') | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 710 | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 711 self._sort_bed(data, dest) | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 712 | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 713 url = os.path.join('raw', trackData['label'] + '.bed.gz') | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 714 trackData.update({ | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 715 "urlTemplate": url, | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 716 "storeClass": "JBrowse/Store/SeqFeature/BEDTabix", | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 717 }) | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 718 | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 719 if 'match' in gffOpts: | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 720 trackData['glyph'] = 'JBrowse/View/FeatureGlyph/Segments' | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 721 | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 722 trackType = gffOpts.get('trackType', 'JBrowse/View/Track/CanvasFeatures') | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 723 trackData['type'] = trackType | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 724 | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 725 if trackType in ['JBrowse/View/Track/CanvasFeatures', 'NeatCanvasFeatures/View/Track/NeatFeatures']: | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 726 if 'transcriptType' in gffOpts and gffOpts['transcriptType']: | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 727 trackData['transcriptType'] = gffOpts['transcriptType'] | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 728 if 'subParts' in gffOpts and gffOpts['subParts']: | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 729 trackData['subParts'] = gffOpts['subParts'] | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 730 if 'impliedUTRs' in gffOpts and gffOpts['impliedUTRs']: | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 731 trackData['impliedUTRs'] = gffOpts['impliedUTRs'] | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 732 elif trackType in ['JBrowse/View/Track/HTMLFeatures', 'NeatHTMLFeatures/View/Track/NeatFeatures']: | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 733 if 'topLevelFeatures' in gffOpts and gffOpts['topLevelFeatures']: | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 734 trackData['topLevelFeatures'] = gffOpts['topLevelFeatures'] | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 735 | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 736 self._add_track_json(trackData) | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 737 | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 738 if gffOpts.get('index', 'false') == 'true': | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 739 self.tracksToIndex.append("%s" % trackData['label']) | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 740 | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 741 def add_genbank(self, data, format, trackData, gffOpts, **kwargs): | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 742 cmd = [ | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 743 'perl', self._jbrowse_bin('flatfile-to-json.pl'), | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 744 '--genbank', data, | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 745 '--trackLabel', trackData['label'], | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 746 '--key', trackData['key'] | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 747 ] | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 748 | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 749 # className in --clientConfig is ignored, it needs to be set with --className | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 750 if 'className' in trackData['style']: | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 751 cmd += ['--className', trackData['style']['className']] | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 752 | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 753 config = copy.copy(trackData) | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 754 clientConfig = trackData['style'] | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 755 del config['style'] | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 756 | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 757 if 'match' in gffOpts: | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 758 config['glyph'] = 'JBrowse/View/FeatureGlyph/Segments' | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 759 if bool(gffOpts['match']): | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 760 # Can be empty for CanvasFeatures = will take all by default | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 761 cmd += ['--type', gffOpts['match']] | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 762 | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 763 cmd += ['--clientConfig', json.dumps(clientConfig)] | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 764 | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 765 trackType = 'JBrowse/View/Track/CanvasFeatures' | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 766 if 'trackType' in gffOpts: | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 767 trackType = gffOpts['trackType'] | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 768 | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 769 if trackType == 'JBrowse/View/Track/CanvasFeatures': | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 770 if 'transcriptType' in gffOpts and gffOpts['transcriptType']: | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 771 config['transcriptType'] = gffOpts['transcriptType'] | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 772 if 'subParts' in gffOpts and gffOpts['subParts']: | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 773 config['subParts'] = gffOpts['subParts'] | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 774 if 'impliedUTRs' in gffOpts and gffOpts['impliedUTRs']: | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 775 config['impliedUTRs'] = gffOpts['impliedUTRs'] | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 776 elif trackType == 'JBrowse/View/Track/HTMLFeatures': | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 777 if 'transcriptType' in gffOpts and gffOpts['transcriptType']: | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 778 cmd += ['--type', gffOpts['transcriptType']] | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 779 | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 780 cmd += [ | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 781 '--trackType', gffOpts['trackType'] | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 782 ] | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 783 | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 784 cmd.extend(['--config', json.dumps(config)]) | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 785 | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 786 self.subprocess_check_call(cmd) | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 787 | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 788 if gffOpts.get('index', 'false') == 'true': | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 789 self.tracksToIndex.append("%s" % trackData['label']) | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 790 | 
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 791 def add_rest(self, url, trackData): | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 792 data = { | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 793 "label": trackData['label'], | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 794 "key": trackData['key'], | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 795 "category": trackData['category'], | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 796 "type": "JBrowse/View/Track/HTMLFeatures", | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 797 "storeClass": "JBrowse/Store/SeqFeature/REST", | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 798 "baseUrl": url | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 799 } | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 800 self._add_track_json(data) | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 801 | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 802 def add_sparql(self, url, query, trackData): | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 803 data = { | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 804 "label": trackData['label'], | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 805 "key": trackData['key'], | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 806 "category": trackData['category'], | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 807 "type": "JBrowse/View/Track/CanvasFeatures", | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 808 "storeClass": "JBrowse/Store/SeqFeature/SPARQL", | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 809 "urlTemplate": url, | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 810 "queryTemplate": query | 
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 811 } | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 812 self._add_track_json(data) | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 813 | 
| 31 
2bb2e07a7a21
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 12dff0abf006f6c81f6462cdf4ea9c0c740d1e9c
 iuc parents: 
28diff
changeset | 814 def traverse_to_option_parent(self, splitKey, outputTrackConfig): | 
| 
2bb2e07a7a21
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 12dff0abf006f6c81f6462cdf4ea9c0c740d1e9c
 iuc parents: 
28diff
changeset | 815 trackConfigSubDict = outputTrackConfig | 
| 
2bb2e07a7a21
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 12dff0abf006f6c81f6462cdf4ea9c0c740d1e9c
 iuc parents: 
28diff
changeset | 816 for part in splitKey[:-1]: | 
| 
2bb2e07a7a21
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 12dff0abf006f6c81f6462cdf4ea9c0c740d1e9c
 iuc parents: 
28diff
changeset | 817 if trackConfigSubDict.get(part) is None: | 
| 
2bb2e07a7a21
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 12dff0abf006f6c81f6462cdf4ea9c0c740d1e9c
 iuc parents: 
28diff
changeset | 818 trackConfigSubDict[part] = dict() | 
| 
2bb2e07a7a21
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 12dff0abf006f6c81f6462cdf4ea9c0c740d1e9c
 iuc parents: 
28diff
changeset | 819 trackConfigSubDict = trackConfigSubDict[part] | 
| 
2bb2e07a7a21
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 12dff0abf006f6c81f6462cdf4ea9c0c740d1e9c
 iuc parents: 
28diff
changeset | 820 assert isinstance(trackConfigSubDict, dict), 'Config element {} is not a dict'.format(trackConfigSubDict) | 
| 
2bb2e07a7a21
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 12dff0abf006f6c81f6462cdf4ea9c0c740d1e9c
 iuc parents: 
28diff
changeset | 821 return trackConfigSubDict | 
| 
2bb2e07a7a21
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 12dff0abf006f6c81f6462cdf4ea9c0c740d1e9c
 iuc parents: 
28diff
changeset | 822 | 
| 
2bb2e07a7a21
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 12dff0abf006f6c81f6462cdf4ea9c0c740d1e9c
 iuc parents: 
28diff
changeset | 823 def get_formatted_option(self, valType2ValDict, mapped_chars): | 
| 
2bb2e07a7a21
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 12dff0abf006f6c81f6462cdf4ea9c0c740d1e9c
 iuc parents: 
28diff
changeset | 824 assert isinstance(valType2ValDict, dict) and len(valType2ValDict.items()) == 1 | 
| 
2bb2e07a7a21
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 12dff0abf006f6c81f6462cdf4ea9c0c740d1e9c
 iuc parents: 
28diff
changeset | 825 for valType, value in valType2ValDict.items(): | 
| 
2bb2e07a7a21
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 12dff0abf006f6c81f6462cdf4ea9c0c740d1e9c
 iuc parents: 
28diff
changeset | 826 if valType == "text": | 
| 
2bb2e07a7a21
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 12dff0abf006f6c81f6462cdf4ea9c0c740d1e9c
 iuc parents: 
28diff
changeset | 827 for char, mapped_char in mapped_chars.items(): | 
| 
2bb2e07a7a21
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 12dff0abf006f6c81f6462cdf4ea9c0c740d1e9c
 iuc parents: 
28diff
changeset | 828 value = value.replace(mapped_char, char) | 
| 
2bb2e07a7a21
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 12dff0abf006f6c81f6462cdf4ea9c0c740d1e9c
 iuc parents: 
28diff
changeset | 829 elif valType == "integer": | 
| 
2bb2e07a7a21
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 12dff0abf006f6c81f6462cdf4ea9c0c740d1e9c
 iuc parents: 
28diff
changeset | 830 value = int(value) | 
| 
2bb2e07a7a21
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 12dff0abf006f6c81f6462cdf4ea9c0c740d1e9c
 iuc parents: 
28diff
changeset | 831 elif valType == "float": | 
| 
2bb2e07a7a21
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 12dff0abf006f6c81f6462cdf4ea9c0c740d1e9c
 iuc parents: 
28diff
changeset | 832 value = float(value) | 
| 
2bb2e07a7a21
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 12dff0abf006f6c81f6462cdf4ea9c0c740d1e9c
 iuc parents: 
28diff
changeset | 833 else: # boolean | 
| 
2bb2e07a7a21
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 12dff0abf006f6c81f6462cdf4ea9c0c740d1e9c
 iuc parents: 
28diff
changeset | 834 value = {'true': True, 'false': False}[value] | 
| 
2bb2e07a7a21
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 12dff0abf006f6c81f6462cdf4ea9c0c740d1e9c
 iuc parents: 
28diff
changeset | 835 return value | 
| 
2bb2e07a7a21
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 12dff0abf006f6c81f6462cdf4ea9c0c740d1e9c
 iuc parents: 
28diff
changeset | 836 | 
| 
2bb2e07a7a21
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 12dff0abf006f6c81f6462cdf4ea9c0c740d1e9c
 iuc parents: 
28diff
changeset | 837 def set_custom_track_options(self, customTrackConfig, outputTrackConfig, mapped_chars): | 
| 
2bb2e07a7a21
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 12dff0abf006f6c81f6462cdf4ea9c0c740d1e9c
 iuc parents: 
28diff
changeset | 838 for optKey, optType2ValDict in customTrackConfig.items(): | 
| 
2bb2e07a7a21
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 12dff0abf006f6c81f6462cdf4ea9c0c740d1e9c
 iuc parents: 
28diff
changeset | 839 splitKey = optKey.split('.') | 
| 
2bb2e07a7a21
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 12dff0abf006f6c81f6462cdf4ea9c0c740d1e9c
 iuc parents: 
28diff
changeset | 840 trackConfigOptionParent = self.traverse_to_option_parent(splitKey, outputTrackConfig) | 
| 
2bb2e07a7a21
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 12dff0abf006f6c81f6462cdf4ea9c0c740d1e9c
 iuc parents: 
28diff
changeset | 841 optVal = self.get_formatted_option(optType2ValDict, mapped_chars) | 
| 
2bb2e07a7a21
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 12dff0abf006f6c81f6462cdf4ea9c0c740d1e9c
 iuc parents: 
28diff
changeset | 842 trackConfigOptionParent[splitKey[-1]] = optVal | 
| 
2bb2e07a7a21
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 12dff0abf006f6c81f6462cdf4ea9c0c740d1e9c
 iuc parents: 
28diff
changeset | 843 | 
| 3 | 844 def process_annotations(self, track): | 
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 845 category = track['category'].replace('__pd__date__pd__', TODAY) | 
| 3 | 846 outputTrackConfig = { | 
| 847 'style': { | |
| 8 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 848 '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: 
5diff
changeset | 849 'className': track['style'].get('className', 'feature'), | 
| 3 | 850 'description': track['style'].get('description', ''), | 
| 851 }, | |
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 852 'overridePlugins': track['style'].get('overridePlugins', False) == 'True', | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 853 'overrideDraggable': track['style'].get('overrideDraggable', False) == 'True', | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 854 'maxHeight': track['style'].get('maxHeight', '600'), | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 855 'category': category, | 
| 3 | 856 } | 
| 857 | |
| 16 
b5c5470d7c09
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit c306d242caf7e0447517c9749ca7656823f315e5
 iuc parents: 
14diff
changeset | 858 mapped_chars = { | 
| 
b5c5470d7c09
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit c306d242caf7e0447517c9749ca7656823f315e5
 iuc parents: 
14diff
changeset | 859 '>': '__gt__', | 
| 
b5c5470d7c09
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit c306d242caf7e0447517c9749ca7656823f315e5
 iuc parents: 
14diff
changeset | 860 '<': '__lt__', | 
| 
b5c5470d7c09
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit c306d242caf7e0447517c9749ca7656823f315e5
 iuc parents: 
14diff
changeset | 861 "'": '__sq__', | 
| 
b5c5470d7c09
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit c306d242caf7e0447517c9749ca7656823f315e5
 iuc parents: 
14diff
changeset | 862 '"': '__dq__', | 
| 
b5c5470d7c09
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit c306d242caf7e0447517c9749ca7656823f315e5
 iuc parents: 
14diff
changeset | 863 '[': '__ob__', | 
| 
b5c5470d7c09
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit c306d242caf7e0447517c9749ca7656823f315e5
 iuc parents: 
14diff
changeset | 864 ']': '__cb__', | 
| 
b5c5470d7c09
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit c306d242caf7e0447517c9749ca7656823f315e5
 iuc parents: 
14diff
changeset | 865 '{': '__oc__', | 
| 
b5c5470d7c09
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit c306d242caf7e0447517c9749ca7656823f315e5
 iuc parents: 
14diff
changeset | 866 '}': '__cc__', | 
| 
b5c5470d7c09
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit c306d242caf7e0447517c9749ca7656823f315e5
 iuc parents: 
14diff
changeset | 867 '@': '__at__', | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 868 '#': '__pd__', | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 869 "": '__cn__' | 
| 16 
b5c5470d7c09
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit c306d242caf7e0447517c9749ca7656823f315e5
 iuc parents: 
14diff
changeset | 870 } | 
| 
b5c5470d7c09
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit c306d242caf7e0447517c9749ca7656823f315e5
 iuc parents: 
14diff
changeset | 871 | 
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 872 for i, (dataset_path, dataset_ext, track_human_label, extra_metadata) in enumerate(track['trackfiles']): | 
| 16 
b5c5470d7c09
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit c306d242caf7e0447517c9749ca7656823f315e5
 iuc parents: 
14diff
changeset | 873 # Unsanitize labels (element_identifiers are always sanitized by Galaxy) | 
| 
b5c5470d7c09
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit c306d242caf7e0447517c9749ca7656823f315e5
 iuc parents: 
14diff
changeset | 874 for key, value in mapped_chars.items(): | 
| 
b5c5470d7c09
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit c306d242caf7e0447517c9749ca7656823f315e5
 iuc parents: 
14diff
changeset | 875 track_human_label = track_human_label.replace(value, key) | 
| 
b5c5470d7c09
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit c306d242caf7e0447517c9749ca7656823f315e5
 iuc parents: 
14diff
changeset | 876 | 
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 877 log.info('Processing %s / %s', category, track_human_label) | 
| 3 | 878 outputTrackConfig['key'] = track_human_label | 
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 879 # We add extra data to hash for the case of REST + SPARQL. | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 880 if 'conf' in track and 'options' in track['conf'] and 'url' in track['conf']['options']: | 
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 881 rest_url = track['conf']['options']['url'] | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 882 else: | 
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 883 rest_url = '' | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 884 | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 885 # I chose to use track['category'] instead of 'category' here. This | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 886 # is intentional. This way re-running the tool on a different date | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 887 # will not generate different hashes and make comparison of outputs | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 888 # much simpler. | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 889 hashData = [str(dataset_path), track_human_label, track['category'], rest_url] | 
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 890 hashData = '|'.join(hashData).encode('utf-8') | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 891 outputTrackConfig['label'] = hashlib.md5(hashData).hexdigest() + '_%s' % i | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 892 outputTrackConfig['metadata'] = extra_metadata | 
| 3 | 893 | 
| 894 # Colour parsing is complex due to different track types having | |
| 895 # different colour options. | |
| 896 colourOptions = self.cs.parse_colours(track['conf']['options'], track['format'], gff3=dataset_path) | |
| 897 # This used to be done with a dict.update() call, however that wiped out any previous style settings... | |
| 898 for key in colourOptions: | |
| 899 if key == 'style': | |
| 900 for subkey in colourOptions['style']: | |
| 901 outputTrackConfig['style'][subkey] = colourOptions['style'][subkey] | |
| 902 else: | |
| 903 outputTrackConfig[key] = colourOptions[key] | |
| 904 | |
| 12 
db5fe5a3176a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
 iuc parents: 
11diff
changeset | 905 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: 
11diff
changeset | 906 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: 
11diff
changeset | 907 outputTrackConfig.update(menus) | 
| 8 
ad4b9d7eae6a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
 iuc parents: 
5diff
changeset | 908 | 
| 31 
2bb2e07a7a21
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 12dff0abf006f6c81f6462cdf4ea9c0c740d1e9c
 iuc parents: 
28diff
changeset | 909 customTrackConfig = track['conf']['options'].get('custom_config', {}) | 
| 
2bb2e07a7a21
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 12dff0abf006f6c81f6462cdf4ea9c0c740d1e9c
 iuc parents: 
28diff
changeset | 910 if customTrackConfig: | 
| 
2bb2e07a7a21
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 12dff0abf006f6c81f6462cdf4ea9c0c740d1e9c
 iuc parents: 
28diff
changeset | 911 self.set_custom_track_options(customTrackConfig, outputTrackConfig, mapped_chars) | 
| 
2bb2e07a7a21
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 12dff0abf006f6c81f6462cdf4ea9c0c740d1e9c
 iuc parents: 
28diff
changeset | 912 | 
| 5 
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
 iuc parents: 
3diff
changeset | 913 # import pprint; pprint.pprint(track) | 
| 
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
 iuc parents: 
3diff
changeset | 914 # import sys; sys.exit() | 
| 33 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 915 if dataset_ext in ('gff', 'gff3'): | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 916 self.add_gff(dataset_path, dataset_ext, outputTrackConfig, | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 917 track['conf']['options']['gff']) | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 918 elif dataset_ext in ('bed', ): | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 919 self.add_bed(dataset_path, dataset_ext, outputTrackConfig, | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 920 track['conf']['options']['gff']) | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 921 elif dataset_ext in ('genbank', ): | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 922 self.add_genbank(dataset_path, dataset_ext, outputTrackConfig, | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 923 track['conf']['options']['gff']) | 
| 3 | 924 elif dataset_ext == 'bigwig': | 
| 925 self.add_bigwig(dataset_path, outputTrackConfig, | |
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 926 track['conf']['options']['wiggle']) | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 927 elif dataset_ext == 'bigwig_multiple': | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 928 self.add_bigwig_multiple(dataset_path, outputTrackConfig, | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 929 track['conf']['options']['wiggle']) | 
| 33 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 930 elif dataset_ext == 'maf': | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 931 self.add_maf(dataset_path, outputTrackConfig, | 
| 
0ae74c70b267
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 369a727966d697c56633b27ad2757db40fef0dc3"
 iuc parents: 
31diff
changeset | 932 track['conf']['options']['maf']) | 
| 3 | 933 elif dataset_ext == 'bam': | 
| 934 real_indexes = track['conf']['options']['pileup']['bam_indices']['bam_index'] | |
| 935 if not isinstance(real_indexes, list): | |
| 936 # <bam_indices> | |
| 937 # <bam_index>/path/to/a.bam.bai</bam_index> | |
| 938 # </bam_indices> | |
| 939 # | |
| 940 # The above will result in the 'bam_index' key containing a | |
| 941 # string. If there are two or more indices, the container | |
| 942 # becomes a list. Fun! | |
| 943 real_indexes = [real_indexes] | |
| 944 | |
| 945 self.add_bam(dataset_path, outputTrackConfig, | |
| 946 track['conf']['options']['pileup'], | |
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 947 bam_index=real_indexes[i]) | 
| 3 | 948 elif dataset_ext == 'blastxml': | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 949 self.add_blastxml(dataset_path, outputTrackConfig, track['conf']['options']['blast']) | 
| 3 | 950 elif dataset_ext == 'vcf': | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 951 self.add_vcf(dataset_path, outputTrackConfig) | 
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 952 elif dataset_ext == 'rest': | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 953 self.add_rest(track['conf']['options']['rest']['url'], outputTrackConfig) | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 954 elif dataset_ext == 'sparql': | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 955 sparql_query = track['conf']['options']['sparql']['query'] | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 956 for key, value in mapped_chars.items(): | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 957 sparql_query = sparql_query.replace(value, key) | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 958 self.add_sparql(track['conf']['options']['sparql']['url'], sparql_query, outputTrackConfig) | 
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 959 else: | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 960 log.warn('Do not know how to handle %s', dataset_ext) | 
| 1 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 961 | 
| 5 
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
 iuc parents: 
3diff
changeset | 962 # 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: 
3diff
changeset | 963 yield outputTrackConfig['label'] | 
| 
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
 iuc parents: 
3diff
changeset | 964 | 
| 
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
 iuc parents: 
3diff
changeset | 965 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: 
3diff
changeset | 966 viz_data = {} | 
| 
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
 iuc parents: 
3diff
changeset | 967 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: 
3diff
changeset | 968 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: 
3diff
changeset | 969 | 
| 
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
 iuc parents: 
3diff
changeset | 970 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: 
3diff
changeset | 971 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: 
3diff
changeset | 972 | 
| 
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
 iuc parents: 
3diff
changeset | 973 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: 
3diff
changeset | 974 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: 
3diff
changeset | 975 | 
| 
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
 iuc parents: 
3diff
changeset | 976 generalData = {} | 
| 
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
 iuc parents: 
3diff
changeset | 977 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: 
3diff
changeset | 978 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: 
3diff
changeset | 979 | 
| 
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
 iuc parents: 
3diff
changeset | 980 generalData['view'] = { | 
| 
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
 iuc parents: 
3diff
changeset | 981 'trackPadding': data['general']['trackPadding'] | 
| 
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
 iuc parents: 
3diff
changeset | 982 } | 
| 
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
 iuc parents: 
3diff
changeset | 983 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: 
3diff
changeset | 984 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: 
3diff
changeset | 985 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: 
3diff
changeset | 986 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: 
3diff
changeset | 987 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: 
3diff
changeset | 988 generalData['hideGenomeOptions'] = (data['general']['hideGenomeOptions'] == 'true') | 
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 989 generalData['plugins'] = data['plugins'] | 
| 5 
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
 iuc parents: 
3diff
changeset | 990 | 
| 
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
 iuc parents: 
3diff
changeset | 991 viz_data.update(generalData) | 
| 
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
 iuc parents: 
3diff
changeset | 992 self._add_json(viz_data) | 
| 
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
 iuc parents: 
3diff
changeset | 993 | 
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 994 if 'GCContent' in data['plugins_python']: | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 995 self._add_track_json({ | 
| 27 
61ce21e36cb5
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0c51a106c04c2f56f5a172dd74c8494687870e46
 iuc parents: 
25diff
changeset | 996 "storeClass": "JBrowse/Store/Sequence/IndexedFasta", | 
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 997 "type": "GCContent/View/Track/GCContentXY", | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 998 "label": "GC Content", | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 999 "key": "GCContentXY", | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1000 "urlTemplate": "seq/genome.fasta", | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1001 "bicolor_pivot": 0.5, | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1002 "category": "GC Content", | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1003 "metadata": { | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1004 "tool_tool": '<a target="_blank" href="https://github.com/elsiklab/gccontent/commit/030180e75a19fad79478d43a67c566ec6">elsiklab/gccontent</a>', | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1005 "tool_tool_version": "5c8b0582ecebf9edf684c76af8075fb3d30ec3fa", | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1006 "dataset_edam_format": "", | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1007 "dataset_size": "", | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1008 "history_display_name": "", | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1009 "history_user_email": "", | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1010 "metadata_dbkey": "", | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1011 } | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1012 # TODO: Expose params for everyone. | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1013 }) | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1014 self._add_track_json({ | 
| 27 
61ce21e36cb5
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0c51a106c04c2f56f5a172dd74c8494687870e46
 iuc parents: 
25diff
changeset | 1015 "storeClass": "JBrowse/Store/Sequence/IndexedFasta", | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1016 "type": "GCContent/View/Track/GCContentXY", | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1017 "label": "GC skew", | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1018 "key": "GCSkew", | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1019 "urlTemplate": "seq/genome.fasta", | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1020 "gcMode": "skew", | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1021 "min_score": -1, | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1022 "bicolor_pivot": 0, | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1023 "category": "GC Content", | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1024 "metadata": { | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1025 "tool_tool": '<a target="_blank" href="https://github.com/elsiklab/gccontent/commit/030180e75a19fad79478d43a67c566ec6">elsiklab/gccontent</a>', | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1026 "tool_tool_version": "5c8b0582ecebf9edf684c76af8075fb3d30ec3fa", | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1027 "dataset_edam_format": "", | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1028 "dataset_size": "", | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1029 "history_display_name": "", | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1030 "history_user_email": "", | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1031 "metadata_dbkey": "", | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1032 } | 
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1033 # TODO: Expose params for everyone. | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1034 }) | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1035 | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1036 if 'ComboTrackSelector' in data['plugins_python']: | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1037 with open(os.path.join(self.outdir, 'data', 'trackList.json'), 'r') as handle: | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1038 trackListJson = json.load(handle) | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1039 trackListJson.update({ | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1040 "trackSelector": { | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1041 "renameFacets": { | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1042 "tool_tool": "Tool ID", | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1043 "tool_tool_id": "Tool ID", | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1044 "tool_tool_version": "Tool Version", | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1045 "dataset_edam_format": "EDAM", | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1046 "dataset_size": "Size", | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1047 "history_display_name": "History Name", | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1048 "history_user_email": "Owner", | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1049 "metadata_dbkey": "Dbkey", | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1050 }, | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1051 "displayColumns": [ | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1052 "key", | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1053 "tool_tool", | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1054 "tool_tool_version", | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1055 "dataset_edam_format", | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1056 "dataset_size", | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1057 "history_display_name", | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1058 "history_user_email", | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1059 "metadata_dbkey", | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1060 ], | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1061 "type": "Faceted", | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1062 "title": ["Galaxy Metadata"], | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1063 "icon": "https://galaxyproject.org/images/logos/galaxy-icon-square.png", | 
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1064 "escapeHTMLInData": False | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1065 }, | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1066 "trackMetadata": { | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1067 "indexFacets": [ | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1068 "category", | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1069 "key", | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1070 "tool_tool_id", | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1071 "tool_tool_version", | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1072 "dataset_edam_format", | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1073 "history_user_email", | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1074 "history_display_name" | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1075 ] | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1076 } | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1077 }) | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1078 with open(os.path.join(self.outdir, 'data', 'trackList2.json'), 'w') as handle: | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1079 json.dump(trackListJson, handle) | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1080 | 
| 40 
17359b808b01
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2f072c4183a0d1221fb9d81909aeeafb2dbda892"
 iuc parents: 
34diff
changeset | 1081 def clone_jbrowse(self, jbrowse_dir, destination, minimal=False): | 
| 3 | 1082 """Clone a JBrowse directory into a destination directory. | 
| 1083 """ | |
| 40 
17359b808b01
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2f072c4183a0d1221fb9d81909aeeafb2dbda892"
 iuc parents: 
34diff
changeset | 1084 if minimal: | 
| 
17359b808b01
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2f072c4183a0d1221fb9d81909aeeafb2dbda892"
 iuc parents: 
34diff
changeset | 1085 # Should be the absolute minimum required for JBrowse to function. | 
| 
17359b808b01
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2f072c4183a0d1221fb9d81909aeeafb2dbda892"
 iuc parents: 
34diff
changeset | 1086 interesting = [ | 
| 
17359b808b01
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2f072c4183a0d1221fb9d81909aeeafb2dbda892"
 iuc parents: 
34diff
changeset | 1087 'dist', 'img', 'index.html', 'jbrowse.conf', 'jbrowse_conf.json', 'webpack.config.js' | 
| 
17359b808b01
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2f072c4183a0d1221fb9d81909aeeafb2dbda892"
 iuc parents: 
34diff
changeset | 1088 ] | 
| 
17359b808b01
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2f072c4183a0d1221fb9d81909aeeafb2dbda892"
 iuc parents: 
34diff
changeset | 1089 for i in interesting: | 
| 
17359b808b01
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2f072c4183a0d1221fb9d81909aeeafb2dbda892"
 iuc parents: 
34diff
changeset | 1090 cmd = ['cp', '-r', os.path.join(jbrowse_dir, i), destination] | 
| 
17359b808b01
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2f072c4183a0d1221fb9d81909aeeafb2dbda892"
 iuc parents: 
34diff
changeset | 1091 self.subprocess_check_call(cmd) | 
| 
17359b808b01
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2f072c4183a0d1221fb9d81909aeeafb2dbda892"
 iuc parents: 
34diff
changeset | 1092 else: | 
| 
17359b808b01
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2f072c4183a0d1221fb9d81909aeeafb2dbda892"
 iuc parents: 
34diff
changeset | 1093 # JBrowse seems to have included some bad symlinks, cp ignores bad symlinks | 
| 
17359b808b01
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2f072c4183a0d1221fb9d81909aeeafb2dbda892"
 iuc parents: 
34diff
changeset | 1094 # unlike copytree | 
| 
17359b808b01
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2f072c4183a0d1221fb9d81909aeeafb2dbda892"
 iuc parents: 
34diff
changeset | 1095 cmd = ['cp', '-r', os.path.join(jbrowse_dir, '.'), destination] | 
| 
17359b808b01
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2f072c4183a0d1221fb9d81909aeeafb2dbda892"
 iuc parents: 
34diff
changeset | 1096 self.subprocess_check_call(cmd) | 
| 
17359b808b01
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2f072c4183a0d1221fb9d81909aeeafb2dbda892"
 iuc parents: 
34diff
changeset | 1097 | 
| 3 | 1098 cmd = ['mkdir', '-p', os.path.join(destination, 'data', 'raw')] | 
| 40 
17359b808b01
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2f072c4183a0d1221fb9d81909aeeafb2dbda892"
 iuc parents: 
34diff
changeset | 1099 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: 
0diff
changeset | 1100 | 
| 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 1101 # 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: 
0diff
changeset | 1102 # JBrowse releases come with some broken symlinks | 
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1103 cmd = ['find', destination, '-type', 'l', '-xtype', 'l'] | 
| 40 
17359b808b01
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2f072c4183a0d1221fb9d81909aeeafb2dbda892"
 iuc parents: 
34diff
changeset | 1104 symlinks = self.subprocess_check_output(cmd) | 
| 
17359b808b01
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2f072c4183a0d1221fb9d81909aeeafb2dbda892"
 iuc parents: 
34diff
changeset | 1105 | 
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1106 for i in symlinks: | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1107 try: | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1108 os.unlink(i) | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1109 except OSError: | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1110 pass | 
| 0 
2c9e5136b416
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 685773d3da40afdc4d14846d4935b3b0a100f56e
 iuc parents: diff
changeset | 1111 | 
| 
2c9e5136b416
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 685773d3da40afdc4d14846d4935b3b0a100f56e
 iuc parents: diff
changeset | 1112 | 
| 
2c9e5136b416
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 685773d3da40afdc4d14846d4935b3b0a100f56e
 iuc parents: diff
changeset | 1113 if __name__ == '__main__': | 
| 
2c9e5136b416
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 685773d3da40afdc4d14846d4935b3b0a100f56e
 iuc parents: diff
changeset | 1114 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: 
8diff
changeset | 1115 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 | 1116 | 
| 
2c9e5136b416
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 685773d3da40afdc4d14846d4935b3b0a100f56e
 iuc parents: diff
changeset | 1117 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 | 1118 parser.add_argument('--outdir', help='Output directory', default='out') | 
| 40 
17359b808b01
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2f072c4183a0d1221fb9d81909aeeafb2dbda892"
 iuc parents: 
34diff
changeset | 1119 parser.add_argument('--standalone', choices=['complete', 'minimal', 'data'], help='Standalone mode includes a copy of JBrowse') | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1120 parser.add_argument('--version', '-V', action='version', version="%(prog)s 0.8.0") | 
| 0 
2c9e5136b416
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 685773d3da40afdc4d14846d4935b3b0a100f56e
 iuc parents: diff
changeset | 1121 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 | 1122 | 
| 3 | 1123 tree = ET.parse(args.xml.name) | 
| 1124 root = tree.getroot() | |
| 1125 | |
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1126 # This should be done ASAP | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1127 GALAXY_INFRASTRUCTURE_URL = root.find('metadata/galaxyUrl').text | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1128 # Sometimes this comes as `localhost` without a protocol | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1129 if not GALAXY_INFRASTRUCTURE_URL.startswith('http'): | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1130 # so we'll prepend `http://` and hope for the best. Requests *should* | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1131 # be GET and not POST so it should redirect OK | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1132 GALAXY_INFRASTRUCTURE_URL = 'http://' + GALAXY_INFRASTRUCTURE_URL | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1133 | 
| 1 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 1134 jc = JbrowseConnector( | 
| 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 1135 jbrowse=args.jbrowse, | 
| 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 1136 outdir=args.outdir, | 
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1137 genomes=[ | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1138 { | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1139 'path': os.path.realpath(x.attrib['path']), | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1140 'meta': metadata_from_node(x.find('metadata')) | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1141 } | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1142 for x in root.findall('metadata/genomes/genome') | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1143 ], | 
| 3 | 1144 standalone=args.standalone, | 
| 1145 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: 
0diff
changeset | 1146 ) | 
| 0 
2c9e5136b416
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 685773d3da40afdc4d14846d4935b3b0a100f56e
 iuc parents: diff
changeset | 1147 | 
| 5 
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
 iuc parents: 
3diff
changeset | 1148 extra_data = { | 
| 
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
 iuc parents: 
3diff
changeset | 1149 'visibility': { | 
| 
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
 iuc parents: 
3diff
changeset | 1150 'default_on': [], | 
| 
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
 iuc parents: 
3diff
changeset | 1151 'default_off': [], | 
| 
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
 iuc parents: 
3diff
changeset | 1152 'force': [], | 
| 
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
 iuc parents: 
3diff
changeset | 1153 'always': [], | 
| 
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
 iuc parents: 
3diff
changeset | 1154 }, | 
| 
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
 iuc parents: 
3diff
changeset | 1155 'general': { | 
| 
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
 iuc parents: 
3diff
changeset | 1156 '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: 
3diff
changeset | 1157 '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: 
3diff
changeset | 1158 '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: 
3diff
changeset | 1159 '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: 
3diff
changeset | 1160 '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: 
3diff
changeset | 1161 '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: 
3diff
changeset | 1162 '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: 
3diff
changeset | 1163 '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: 
3diff
changeset | 1164 'hideGenomeOptions': root.find('metadata/general/hideGenomeOptions').text, | 
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1165 }, | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1166 'plugins': [], | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1167 'plugins_python': [], | 
| 5 
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
 iuc parents: 
3diff
changeset | 1168 } | 
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1169 | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1170 plugins = root.find('plugins').attrib | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1171 if plugins['GCContent'] == 'True': | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1172 extra_data['plugins_python'].append('GCContent') | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1173 extra_data['plugins'].append({ | 
| 24 
fa30df9b79c2
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 309588eae8df8baffaf49fc00fb0d28106109ddf
 iuc parents: 
22diff
changeset | 1174 'location': 'https://cdn.jsdelivr.net/gh/elsiklab/gccontent@5c8b0582ecebf9edf684c76af8075fb3d30ec3fa/', | 
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1175 'name': 'GCContent' | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1176 }) | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1177 | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1178 # Not needed in 1.16.1: it's built in the conda package now, and this plugin doesn't need to be enabled anywhere | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1179 # if plugins['Bookmarks'] == 'True': | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1180 # extra_data['plugins'].append({ | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1181 # 'location': 'https://cdn.jsdelivr.net/gh/TAMU-CPT/bookmarks-jbrowse@5242694120274c86e1ccd5cb0e5e943e78f82393/', | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1182 # 'name': 'Bookmarks' | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1183 # }) | 
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1184 | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1185 # Not needed in 1.16.1: it's built in the conda package now, and this plugin doesn't need to be enabled anywhere | 
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1186 if plugins['ComboTrackSelector'] == 'True': | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1187 extra_data['plugins_python'].append('ComboTrackSelector') | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1188 # Not needed in 1.16.1: it's built in the conda package now, and this plugin doesn't need to be enabled anywhere | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1189 # extra_data['plugins'].append({ | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1190 # 'location': 'https://cdn.jsdelivr.net/gh/Arabidopsis-Information-Portal/ComboTrackSelector@52403928d5ccbe2e3a86b0fa5eb8e61c0f2e2f57/', | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1191 # 'icon': 'https://galaxyproject.org/images/logos/galaxy-icon-square.png', | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1192 # 'name': 'ComboTrackSelector' | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1193 # }) | 
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1194 | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1195 if plugins['theme'] == 'Minimalist': | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1196 extra_data['plugins'].append({ | 
| 24 
fa30df9b79c2
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 309588eae8df8baffaf49fc00fb0d28106109ddf
 iuc parents: 
22diff
changeset | 1197 'location': 'https://cdn.jsdelivr.net/gh/erasche/jbrowse-minimalist-theme@d698718442da306cf87f033c72ddb745f3077775/', | 
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1198 'name': 'MinimalistTheme' | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1199 }) | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1200 elif plugins['theme'] == 'Dark': | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1201 extra_data['plugins'].append({ | 
| 24 
fa30df9b79c2
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 309588eae8df8baffaf49fc00fb0d28106109ddf
 iuc parents: 
22diff
changeset | 1202 'location': 'https://cdn.jsdelivr.net/gh/erasche/jbrowse-dark-theme@689eceb7e33bbc1b9b15518d45a5a79b2e5d0a26/', | 
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1203 'name': 'DarkTheme' | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1204 }) | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1205 | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1206 if plugins['BlastView'] == 'True': | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1207 extra_data['plugins_python'].append('BlastView') | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1208 extra_data['plugins'].append({ | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1209 'location': 'https://cdn.jsdelivr.net/gh/TAMU-CPT/blastview@97572a21b7f011c2b4d9a0b5af40e292d694cbef/', | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1210 'name': 'BlastView' | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1211 }) | 
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1212 | 
| 3 | 1213 for track in root.findall('tracks/track'): | 
| 1214 track_conf = {} | |
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1215 track_conf['trackfiles'] = [] | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1216 | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1217 is_multi_bigwig = False | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1218 try: | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1219 if track.find('options/wiggle/multibigwig') and (track.find('options/wiggle/multibigwig').text == 'True'): | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1220 is_multi_bigwig = True | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1221 multi_bigwig_paths = [] | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1222 except KeyError: | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1223 pass | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1224 | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1225 trackfiles = track.findall('files/trackFile') | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1226 if trackfiles: | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1227 for x in track.findall('files/trackFile'): | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1228 if is_multi_bigwig: | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1229 multi_bigwig_paths.append((x.attrib['label'], os.path.realpath(x.attrib['path']))) | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1230 else: | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1231 if trackfiles: | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1232 metadata = metadata_from_node(x.find('metadata')) | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1233 | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1234 track_conf['trackfiles'].append(( | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1235 os.path.realpath(x.attrib['path']), | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1236 x.attrib['ext'], | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1237 x.attrib['label'], | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1238 metadata | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1239 )) | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1240 else: | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1241 # For tracks without files (rest, sparql) | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1242 track_conf['trackfiles'].append(( | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1243 '', # N/A, no path for rest or sparql | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1244 track.attrib['format'], | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1245 track.find('options/label').text, | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1246 {} | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1247 )) | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1248 | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1249 if is_multi_bigwig: | 
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1250 metadata = metadata_from_node(x.find('metadata')) | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1251 | 
| 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1252 track_conf['trackfiles'].append(( | 
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1253 multi_bigwig_paths, # Passing an array of paths to represent as one track | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1254 'bigwig_multiple', | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1255 'MultiBigWig', # Giving an hardcoded name for now | 
| 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1256 {} # No metadata for multiple bigwig | 
| 17 
ff11d442feed
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 908f16ea4eb082227437dc93e06e8cb742f5a257
 iuc parents: 
16diff
changeset | 1257 )) | 
| 1 
497c6bb3b717
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 0887009a23d176b21536c9fd8a18c4fecc417d4f
 iuc parents: 
0diff
changeset | 1258 | 
| 3 | 1259 track_conf['category'] = track.attrib['cat'] | 
| 1260 track_conf['format'] = track.attrib['format'] | |
| 1261 try: | |
| 1262 # Only pertains to gff3 + blastxml. TODO? | |
| 1263 track_conf['style'] = {t.tag: t.text for t in track.find('options/style')} | |
| 25 
1cfc579079a6
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit b6f9a87b6091cc881a49e0b6acfadc5e7786967f
 iuc parents: 
24diff
changeset | 1264 except TypeError: | 
| 3 | 1265 track_conf['style'] = {} | 
| 1266 pass | |
| 1267 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: 
3diff
changeset | 1268 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: 
3diff
changeset | 1269 | 
| 
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
 iuc parents: 
3diff
changeset | 1270 for key in keys: | 
| 
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
 iuc parents: 
3diff
changeset | 1271 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: 
3diff
changeset | 1272 | 
| 
ae9382cfb6ac
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed
 iuc parents: 
3diff
changeset | 1273 jc.add_final_data(extra_data) | 
| 20 
558d652cd681
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 75a0a1c7b26cac156f76e8266a0e2e3d81be7f02
 iuc parents: 
17diff
changeset | 1274 jc.generate_names() | 
