Mercurial > repos > yating-l > jbrowsearchivecreator
comparison tracks/TrackDb.py @ 25:31a41ce128cc draft
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
| author | yating-l |
|---|---|
| date | Fri, 13 Oct 2017 12:44:31 -0400 |
| parents | |
| children | 061da5d3a219 |
comparison
equal
deleted
inserted
replaced
| 24:bb6fdccef474 | 25:31a41ce128cc |
|---|---|
| 1 #!/usr/bin/python | |
| 2 """ | |
| 3 Super Class of the tracks | |
| 4 """ | |
| 5 import os | |
| 6 import abc | |
| 7 from abc import ABCMeta | |
| 8 import collections | |
| 9 import json | |
| 10 import logging | |
| 11 from util import santitizer | |
| 12 | |
| 13 class TrackDb(object): | |
| 14 """docstring for TrackDb""" | |
| 15 __metaclass__ = ABCMeta | |
| 16 | |
| 17 def __init__(self, trackName, trackLabel, trackDataURL, trackType, dataType, extraSettings=None): | |
| 18 #super(TrackDb, self).__init__() | |
| 19 | |
| 20 not_init_message = "The {0} is not initialized." | |
| 21 if trackName is None: | |
| 22 raise TypeError(not_init_message.format('trackName')) | |
| 23 if trackLabel is None: | |
| 24 raise TypeError(not_init_message.format('trackLabel')) | |
| 25 if trackType is None: | |
| 26 raise TypeError(not_init_message.format('trackType')) | |
| 27 self.trackName = trackName | |
| 28 self.trackLabel = trackLabel | |
| 29 self.trackDataURL = trackDataURL | |
| 30 self.trackType = trackType | |
| 31 self.dataType = dataType | |
| 32 self.extraSettings = extraSettings | |
| 33 self.logger = logging.getLogger(__name__) | |
| 34 #self.createTrackDb() | |
| 35 | |
| 36 def createTrackDb(self): | |
| 37 self.track_db = collections.OrderedDict([("track",self.trackName), | |
| 38 ("trackLabel",self.trackLabel), | |
| 39 ("trackDataURL",self.trackDataURL), | |
| 40 ("dataType", self.dataType), | |
| 41 ("trackType", self.trackType)] | |
| 42 ) | |
| 43 | |
| 44 | |
| 45 extraConfigs = self.prepareExtraSetting() | |
| 46 self.logger.debug("Generate extraConfigs = %s", json.dumps(extraConfigs)) | |
| 47 self.track_db["options"] = extraConfigs | |
| 48 #print self.track_db | |
| 49 self.logger.debug("TrackDb object is created track_db = %s ", json.dumps(self.track_db)) | |
| 50 | |
| 51 @abc.abstractmethod | |
| 52 def prepareExtraSetting(self): | |
| 53 """ set optional configurations for the track """ |
