view tracks/CanvasFeatures.py @ 32:7b955a58d8f2 draft

planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 18da3c5b92673ba5030c24c981c6ca7ebe0bf097-dirty
author yating-l
date Fri, 20 Oct 2017 11:22:21 -0400
parents 31a41ce128cc
children d17f629f5486
line wrap: on
line source

#!/usr/bin/env python
import json
import logging

from TrackDb import TrackDb
from util import subtools


class CanvasFeatures(TrackDb):
    def __init__(self, trackName, trackLabel, trackDataURL, trackType, dataType, extraSettings=None):
        super(CanvasFeatures, self).__init__(trackName, trackLabel, trackDataURL, trackType, dataType, extraSettings)

    def prepareExtraSetting(self):
        """ set CanvasFeatures configuration options """
        extraConfigs = dict()
        self.extraSettings["clientConfig"] = dict()
        self.extraSettings["config"] = dict()
        if 'color' not in self.extraSettings or not self.extraSettings['color']:
            self.extraSettings["clientConfig"]['color'] = "#daa520"
        else:
            self.extraSettings["clientConfig"]['color'] = self.extraSettings['color']
        if 'category' not in self.extraSettings or not self.extraSettings['category']:
            self.extraSettings["config"]['category'] = "Default group"
        else:
            self.extraSettings["config"]['category'] = self.extraSettings['category']
        if 'glyph' in self.extraSettings:
            self.extraSettings["config"]['glyph'] = self.extraSettings['glyph']
        if 'transcriptType' in self.extraSettings:
            self.extraSettings['config']['transcriptType'] = self.extraSettings['transcriptType']
        extraConfigs["config"] = json.dumps(self.extraSettings["config"])
        extraConfigs["clientConfig"] = json.dumps(self.extraSettings["clientConfig"])
        return extraConfigs