annotate tracks/CanvasFeatures.py @ 15:6464399df918 draft

planemo upload for repository https://github.com/goeckslab/jbrowse-archive-creator.git commit c69fafd096990eadcc380250703aefd919f80107
author yating-l
date Wed, 20 Jun 2018 17:43:26 -0400
parents 3f9971a91096
children 8bcec8dbb8be
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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')
6
237707a6b74d planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff changeset
29 else:
7
5d5fdcb798da planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 12fb52d5b285935b2353d93a5aa291838df7893e
yating-l
parents: 6
diff changeset
30 track['urlTemplate'] = os.path.join('tracks', self.trackName)
11
8886033b4f84 planemo upload for repository https://github.com/goeckslab/jbrowse-archive-creator.git commit 4e8e5448a54f794bced67046e236988031616180
yating-l
parents: 10
diff changeset
31 if 'glyph' in self.extraSettings:
8886033b4f84 planemo upload for repository https://github.com/goeckslab/jbrowse-archive-creator.git commit 4e8e5448a54f794bced67046e236988031616180
yating-l
parents: 10
diff changeset
32 track['glyph'] = self.extraSettings['glyph']
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']
14
3f9971a91096 planemo upload for repository https://github.com/goeckslab/jbrowse-archive-creator.git commit e526b4e8bef4677b832e940bacb8969a18efc3e3
yating-l
parents: 11
diff changeset
38 if "menuTemplate" in self.extraSettings:
3f9971a91096 planemo upload for repository https://github.com/goeckslab/jbrowse-archive-creator.git commit e526b4e8bef4677b832e940bacb8969a18efc3e3
yating-l
parents: 11
diff changeset
39 track["menuTemplate"] = [{}, self.extraSettings["menuTemplate"]]
3f9971a91096 planemo upload for repository https://github.com/goeckslab/jbrowse-archive-creator.git commit e526b4e8bef4677b832e940bacb8969a18efc3e3
yating-l
parents: 11
diff changeset
40 #self.track["menuTemplate"] += [{"label" : "View details"}, {"label" : "Highlight this gene"}, self.extraSettings["menuTemplate"]]
7
5d5fdcb798da planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 12fb52d5b285935b2353d93a5aa291838df7893e
yating-l
parents: 6
diff changeset
41 extraConfigs = track
5d5fdcb798da planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 12fb52d5b285935b2353d93a5aa291838df7893e
yating-l
parents: 6
diff changeset
42 return extraConfigs
5d5fdcb798da planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 12fb52d5b285935b2353d93a5aa291838df7893e
yating-l
parents: 6
diff changeset
43