Mercurial > repos > yating-l > jbrowsearchivecreator
annotate tracks/CanvasFeatures.py @ 10:e2ebf58c9068 draft
planemo upload for repository https://github.com/goeckslab/jbrowse-archive-creator.git commit 8ace9ad3a69a56a9b0d5feae266f90301d9aac77
author | yating-l |
---|---|
date | Mon, 14 May 2018 21:37:50 -0400 |
parents | 56d9d10b4990 |
children | 8886033b4f84 |
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) |
10
e2ebf58c9068
planemo upload for repository https://github.com/goeckslab/jbrowse-archive-creator.git commit 8ace9ad3a69a56a9b0d5feae266f90301d9aac77
yating-l
parents:
8
diff
changeset
|
33 if 'subfeatureClasses' in self.extraSettings: |
e2ebf58c9068
planemo upload for repository https://github.com/goeckslab/jbrowse-archive-creator.git commit 8ace9ad3a69a56a9b0d5feae266f90301d9aac77
yating-l
parents:
8
diff
changeset
|
34 track['subfeatureClasses'] = self.extraSettings['subfeatureClasses'] |
7
5d5fdcb798da
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 12fb52d5b285935b2353d93a5aa291838df7893e
yating-l
parents:
6
diff
changeset
|
35 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
|
36 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
|
37 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
|
38 extraConfigs = track |
5d5fdcb798da
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 12fb52d5b285935b2353d93a5aa291838df7893e
yating-l
parents:
6
diff
changeset
|
39 return extraConfigs |
5d5fdcb798da
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 12fb52d5b285935b2353d93a5aa291838df7893e
yating-l
parents:
6
diff
changeset
|
40 |