Mercurial > repos > yating-l > jbrowsearchivecreator
annotate tracks/CanvasFeatures.py @ 38:d17f629f5486 draft
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
| author | yating-l | 
|---|---|
| date | Fri, 06 Apr 2018 13:44:56 -0400 | 
| parents | 31a41ce128cc | 
| children | 4a69515eed63 | 
| rev | line source | 
|---|---|
| 25 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 1 #!/usr/bin/env python | 
| 38 
d17f629f5486
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
 yating-l parents: 
25diff
changeset | 2 import os | 
| 25 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 3 import json | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 4 import logging | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 5 | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 6 from TrackDb import TrackDb | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 7 from util import subtools | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 8 | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 9 | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 10 class CanvasFeatures(TrackDb): | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 11 def __init__(self, trackName, trackLabel, trackDataURL, trackType, dataType, extraSettings=None): | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 12 super(CanvasFeatures, self).__init__(trackName, trackLabel, trackDataURL, trackType, dataType, extraSettings) | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 13 | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 14 def prepareExtraSetting(self): | 
| 38 
d17f629f5486
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
 yating-l parents: 
25diff
changeset | 15 if 'category' not in self.extraSettings or not self.extraSettings['category']: | 
| 
d17f629f5486
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
 yating-l parents: 
25diff
changeset | 16 self.extraSettings['category'] = "Default group" | 
| 
d17f629f5486
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
 yating-l parents: 
25diff
changeset | 17 self.extraSettings['style'] = {} | 
| 
d17f629f5486
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
 yating-l parents: 
25diff
changeset | 18 self.extraSettings['style']['className'] = 'feature' | 
| 25 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 19 if 'color' not in self.extraSettings or not self.extraSettings['color']: | 
| 38 
d17f629f5486
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
 yating-l parents: 
25diff
changeset | 20 self.extraSettings['style']['color'] = "#FFA600" | 
| 25 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 21 else: | 
| 38 
d17f629f5486
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
 yating-l parents: 
25diff
changeset | 22 self.extraSettings['style']['color'] = self.extraSettings['color'] | 
| 
d17f629f5486
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
 yating-l parents: 
25diff
changeset | 23 track = dict() | 
| 
d17f629f5486
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
 yating-l parents: 
25diff
changeset | 24 track['type'] = 'JBrowse/View/Track/' + self.trackType | 
| 
d17f629f5486
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
 yating-l parents: 
25diff
changeset | 25 track['storeClass'] = 'JBrowse/Store/SeqFeature/GFF3Tabix' | 
| 
d17f629f5486
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
 yating-l parents: 
25diff
changeset | 26 track['urlTemplate'] = os.path.join('tracks', self.trackName) | 
| 
d17f629f5486
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
 yating-l parents: 
25diff
changeset | 27 track['label'] = self.trackLabel | 
| 
d17f629f5486
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
 yating-l parents: 
25diff
changeset | 28 track['category'] = self.extraSettings['category'] | 
| 
d17f629f5486
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
 yating-l parents: 
25diff
changeset | 29 track['style'] = self.extraSettings['style'] | 
| 
d17f629f5486
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
 yating-l parents: 
25diff
changeset | 30 extraConfigs = track | 
| 
d17f629f5486
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
 yating-l parents: 
25diff
changeset | 31 return extraConfigs | 
| 
d17f629f5486
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
 yating-l parents: 
25diff
changeset | 32 | 
| 
d17f629f5486
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
 yating-l parents: 
25diff
changeset | 33 # def prepareExtraSetting(self): | 
| 
d17f629f5486
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
 yating-l parents: 
25diff
changeset | 34 # """ set CanvasFeatures configuration options """ | 
| 
d17f629f5486
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
 yating-l parents: 
25diff
changeset | 35 # extraConfigs = dict() | 
| 
d17f629f5486
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
 yating-l parents: 
25diff
changeset | 36 # self.extraSettings["clientConfig"] = dict() | 
| 
d17f629f5486
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
 yating-l parents: 
25diff
changeset | 37 # self.extraSettings["config"] = dict() | 
| 
d17f629f5486
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
 yating-l parents: 
25diff
changeset | 38 # if 'color' not in self.extraSettings or not self.extraSettings['color']: | 
| 
d17f629f5486
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
 yating-l parents: 
25diff
changeset | 39 # self.extraSettings["clientConfig"]['color'] = "#daa520" | 
| 
d17f629f5486
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
 yating-l parents: 
25diff
changeset | 40 # else: | 
| 
d17f629f5486
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
 yating-l parents: 
25diff
changeset | 41 # self.extraSettings["clientConfig"]['color'] = self.extraSettings['color'] | 
| 
d17f629f5486
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
 yating-l parents: 
25diff
changeset | 42 # if 'category' not in self.extraSettings or not self.extraSettings['category']: | 
| 
d17f629f5486
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
 yating-l parents: 
25diff
changeset | 43 # self.extraSettings["config"]['category'] = "Default group" | 
| 
d17f629f5486
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
 yating-l parents: 
25diff
changeset | 44 # else: | 
| 
d17f629f5486
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
 yating-l parents: 
25diff
changeset | 45 # self.extraSettings["config"]['category'] = self.extraSettings['category'] | 
| 
d17f629f5486
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
 yating-l parents: 
25diff
changeset | 46 # if 'glyph' in self.extraSettings: | 
| 
d17f629f5486
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
 yating-l parents: 
25diff
changeset | 47 # self.extraSettings["config"]['glyph'] = self.extraSettings['glyph'] | 
| 
d17f629f5486
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
 yating-l parents: 
25diff
changeset | 48 # if 'transcriptType' in self.extraSettings: | 
| 
d17f629f5486
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
 yating-l parents: 
25diff
changeset | 49 # self.extraSettings['config']['transcriptType'] = self.extraSettings['transcriptType'] | 
| 
d17f629f5486
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
 yating-l parents: 
25diff
changeset | 50 # extraConfigs["config"] = json.dumps(self.extraSettings["config"]) | 
| 
d17f629f5486
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
 yating-l parents: 
25diff
changeset | 51 # extraConfigs["clientConfig"] = json.dumps(self.extraSettings["clientConfig"]) | 
| 
d17f629f5486
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
 yating-l parents: 
25diff
changeset | 52 # return extraConfigs | 
