comparison tracks/HTMLFeatures.py @ 6:237707a6b74d draft

planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
author yating-l
date Thu, 15 Feb 2018 17:05:05 -0500
parents
children 3f9971a91096
comparison
equal deleted inserted replaced
5:e762f4b9e4bd 6:237707a6b74d
1 #!/usr/bin/env python
2 import json
3 import logging
4
5 from TrackDb import TrackDb
6 from util import subtools
7 from util import santitizer
8
9
10 class HTMLFeatures(TrackDb):
11 def __init__(self, trackName, trackLabel, trackDataURL, trackType, dataType, extraSettings=None):
12 super(HTMLFeatures, self).__init__(trackName, trackLabel, trackDataURL, trackType, dataType, extraSettings)
13
14 def prepareExtraSetting(self):
15 """ set HTMLFeatures configuration options """
16 extraConfigs = dict()
17 self.extraSettings["clientConfig"] = dict()
18 self.extraSettings["config"] = dict()
19 if 'type' in self.extraSettings:
20 extraConfigs["type"] = self.extraSettings['type']
21 if 'color' in self.extraSettings and self.extraSettings['color']:
22 extraConfigs['feature_color'] = self.extraSettings['color']
23 else:
24 extraConfigs['feature_color'] = "#000000"
25 #self.extraSettings['clientConfig']['color'] = self.extraSettings['color']
26 if 'subfeatureClasses' in self.extraSettings:
27 subfeature_css_class = santitizer.sanitize_name(self.trackLabel + "_" + self.extraSettings['subfeatureClasses'])
28 extraConfigs['subfeatureClasses'] = {self.extraSettings['subfeatureClasses']: subfeature_css_class}
29
30 if 'category' not in self.extraSettings or not self.extraSettings['category']:
31 self.extraSettings['config']['category'] = "Default group"
32 else:
33 self.extraSettings['config']['category'] = self.extraSettings['category']
34
35 extraConfigs['config'] = json.dumps(self.extraSettings["config"])
36 extraConfigs['clientConfig'] = json.dumps(self.extraSettings["clientConfig"])
37 return extraConfigs
38
39