Mercurial > repos > yating-l > jbrowsearchivecreator
annotate tracks/CanvasFeatures.py @ 8:56d9d10b4990 draft
planemo upload for repository https://github.com/goeckslab/jbrowse-archive-creator.git commit 2285eddcfe689d70d89571a045f204b74cc6890c
author | yating-l |
---|---|
date | Fri, 27 Apr 2018 15:36:51 -0400 |
parents | 5d5fdcb798da |
children | e2ebf58c9068 |
rev | line source |
---|---|
6
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
1 #!/usr/bin/env python |
7
5d5fdcb798da
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 12fb52d5b285935b2353d93a5aa291838df7893e
yating-l
parents:
6
diff
changeset
|
2 import os |
6
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
3 import json |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
4 import logging |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
5 |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
6 from TrackDb import TrackDb |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
7 from util import subtools |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
8 |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
9 |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
10 class CanvasFeatures(TrackDb): |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
11 def __init__(self, trackName, trackLabel, trackDataURL, trackType, dataType, extraSettings=None): |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
12 super(CanvasFeatures, self).__init__(trackName, trackLabel, trackDataURL, trackType, dataType, extraSettings) |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
13 |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
14 def prepareExtraSetting(self): |
7
5d5fdcb798da
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 12fb52d5b285935b2353d93a5aa291838df7893e
yating-l
parents:
6
diff
changeset
|
15 if 'category' not in self.extraSettings or not self.extraSettings['category']: |
5d5fdcb798da
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 12fb52d5b285935b2353d93a5aa291838df7893e
yating-l
parents:
6
diff
changeset
|
16 self.extraSettings['category'] = "Default group" |
5d5fdcb798da
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 12fb52d5b285935b2353d93a5aa291838df7893e
yating-l
parents:
6
diff
changeset
|
17 self.extraSettings['style'] = {} |
5d5fdcb798da
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 12fb52d5b285935b2353d93a5aa291838df7893e
yating-l
parents:
6
diff
changeset
|
18 self.extraSettings['style']['className'] = 'feature' |
6
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
19 if 'color' not in self.extraSettings or not self.extraSettings['color']: |
7
5d5fdcb798da
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 12fb52d5b285935b2353d93a5aa291838df7893e
yating-l
parents:
6
diff
changeset
|
20 self.extraSettings['style']['color'] = "#FFA600" |
6
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
21 else: |
7
5d5fdcb798da
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 12fb52d5b285935b2353d93a5aa291838df7893e
yating-l
parents:
6
diff
changeset
|
22 self.extraSettings['style']['color'] = self.extraSettings['color'] |
5d5fdcb798da
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 12fb52d5b285935b2353d93a5aa291838df7893e
yating-l
parents:
6
diff
changeset
|
23 track = dict() |
5d5fdcb798da
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 12fb52d5b285935b2353d93a5aa291838df7893e
yating-l
parents:
6
diff
changeset
|
24 track['type'] = 'JBrowse/View/Track/' + self.trackType |
5d5fdcb798da
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 12fb52d5b285935b2353d93a5aa291838df7893e
yating-l
parents:
6
diff
changeset
|
25 track['storeClass'] = 'JBrowse/Store/SeqFeature/GFF3Tabix' |
5d5fdcb798da
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 12fb52d5b285935b2353d93a5aa291838df7893e
yating-l
parents:
6
diff
changeset
|
26 if self.dataType == 'gff': |
8
56d9d10b4990
planemo upload for repository https://github.com/goeckslab/jbrowse-archive-creator.git commit 2285eddcfe689d70d89571a045f204b74cc6890c
yating-l
parents:
7
diff
changeset
|
27 # need .gff3.gz extension to index the name of the track with generate-name.pl |
7
5d5fdcb798da
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 12fb52d5b285935b2353d93a5aa291838df7893e
yating-l
parents:
6
diff
changeset
|
28 track['urlTemplate'] = os.path.join('tracks', self.trackName + '.gff3.gz') |
8
56d9d10b4990
planemo upload for repository https://github.com/goeckslab/jbrowse-archive-creator.git commit 2285eddcfe689d70d89571a045f204b74cc6890c
yating-l
parents:
7
diff
changeset
|
29 # needed to show match_part in Blat and Blast alignment as subfeatures |
56d9d10b4990
planemo upload for repository https://github.com/goeckslab/jbrowse-archive-creator.git commit 2285eddcfe689d70d89571a045f204b74cc6890c
yating-l
parents:
7
diff
changeset
|
30 track['glyph'] = "JBrowse/View/FeatureGlyph/Segments" |
6
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
31 else: |
7
5d5fdcb798da
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 12fb52d5b285935b2353d93a5aa291838df7893e
yating-l
parents:
6
diff
changeset
|
32 track['urlTemplate'] = os.path.join('tracks', self.trackName) |
5d5fdcb798da
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 12fb52d5b285935b2353d93a5aa291838df7893e
yating-l
parents:
6
diff
changeset
|
33 track['label'] = self.trackLabel |
5d5fdcb798da
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 12fb52d5b285935b2353d93a5aa291838df7893e
yating-l
parents:
6
diff
changeset
|
34 track['category'] = self.extraSettings['category'] |
5d5fdcb798da
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 12fb52d5b285935b2353d93a5aa291838df7893e
yating-l
parents:
6
diff
changeset
|
35 track['style'] = self.extraSettings['style'] |
5d5fdcb798da
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 12fb52d5b285935b2353d93a5aa291838df7893e
yating-l
parents:
6
diff
changeset
|
36 extraConfigs = track |
5d5fdcb798da
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 12fb52d5b285935b2353d93a5aa291838df7893e
yating-l
parents:
6
diff
changeset
|
37 return extraConfigs |
5d5fdcb798da
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 12fb52d5b285935b2353d93a5aa291838df7893e
yating-l
parents:
6
diff
changeset
|
38 |