comparison 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
comparison
equal deleted inserted replaced
5:e762f4b9e4bd 6:237707a6b74d
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 """