Mercurial > repos > yating-l > jbrowsearchivecreator
diff tracks/TrackDb.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 | 43a700afd457 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tracks/TrackDb.py Thu Feb 15 17:05:05 2018 -0500 @@ -0,0 +1,53 @@ +#!/usr/bin/python +""" +Super Class of the tracks +""" +import os +import abc +from abc import ABCMeta +import collections +import json +import logging +from util import santitizer + +class TrackDb(object): + """docstring for TrackDb""" + __metaclass__ = ABCMeta + + def __init__(self, trackName, trackLabel, trackDataURL, trackType, dataType, extraSettings=None): + #super(TrackDb, self).__init__() + + not_init_message = "The {0} is not initialized." + if trackName is None: + raise TypeError(not_init_message.format('trackName')) + if trackLabel is None: + raise TypeError(not_init_message.format('trackLabel')) + if trackType is None: + raise TypeError(not_init_message.format('trackType')) + self.trackName = trackName + self.trackLabel = trackLabel + self.trackDataURL = trackDataURL + self.trackType = trackType + self.dataType = dataType + self.extraSettings = extraSettings + self.logger = logging.getLogger(__name__) + #self.createTrackDb() + + def createTrackDb(self): + self.track_db = collections.OrderedDict([("track",self.trackName), + ("trackLabel",self.trackLabel), + ("trackDataURL",self.trackDataURL), + ("dataType", self.dataType), + ("trackType", self.trackType)] + ) + + + extraConfigs = self.prepareExtraSetting() + self.logger.debug("Generate extraConfigs = %s", json.dumps(extraConfigs)) + self.track_db["options"] = extraConfigs + #print self.track_db + self.logger.debug("TrackDb object is created track_db = %s ", json.dumps(self.track_db)) + + @abc.abstractmethod + def prepareExtraSetting(self): + """ set optional configurations for the track """