Mercurial > repos > rmarenco > hubarchivecreator
comparison Datatype.py @ 16:3233451a3bd6 draft
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit fc73ec22a0db3ab09c4ac13dc58f0b54ae37845c
| author | rmarenco |
|---|---|
| date | Sun, 25 Sep 2016 11:25:38 -0400 |
| parents | 25809f699cb3 |
| children | c02720d1afee |
comparison
equal
deleted
inserted
replaced
| 15:2a45cd656e8e | 16:3233451a3bd6 |
|---|---|
| 74 # TODO: Use default parameters for some, like visibility | 74 # TODO: Use default parameters for some, like visibility |
| 75 def createTrack(self, | 75 def createTrack(self, |
| 76 file_path=None, | 76 file_path=None, |
| 77 track_name=None, long_label=None, thick_draw_item='off', | 77 track_name=None, long_label=None, thick_draw_item='off', |
| 78 short_label=None, track_type=None, visibility=None, priority=None, | 78 short_label=None, track_type=None, visibility=None, priority=None, |
| 79 track_file=None): | 79 track_file=None, track_color='#000000'): |
| 80 | 80 |
| 81 # TODO: Remove the hardcoded "tracks" by the value used as variable from myTrackFolderPath | 81 # TODO: Remove the hardcoded "tracks" by the value used as variable from myTrackFolderPath |
| 82 data_url = "tracks/%s" % file_path | 82 data_url = "tracks/%s" % file_path |
| 83 | 83 |
| 84 if not short_label: | 84 if not short_label: |
| 87 # Replace '_' by ' ', to invert the sanitization mecanism | 87 # Replace '_' by ' ', to invert the sanitization mecanism |
| 88 # TODO: Find a better way to manage the sanitization of file path | 88 # TODO: Find a better way to manage the sanitization of file path |
| 89 long_label = long_label.replace("_", " ") | 89 long_label = long_label.replace("_", " ") |
| 90 short_label = short_label.replace("_", " ") | 90 short_label = short_label.replace("_", " ") |
| 91 | 91 |
| 92 #TODO: Check if rgb or hexa | |
| 93 # Convert hexa to rgb array | |
| 94 hexa_without_sharp = track_color.lstrip('#') | |
| 95 rgb_array = [int(hexa_without_sharp[i:i+2], 16) for i in (0, 2, 4)] | |
| 96 rgb_ucsc = ','.join(map(str, rgb_array)) | |
| 97 | |
| 92 track_db = TrackDb( | 98 track_db = TrackDb( |
| 93 trackName=track_name, | 99 trackName=track_name, |
| 94 longLabel=long_label, | 100 longLabel=long_label, |
| 95 shortLabel=short_label, | 101 shortLabel=short_label, |
| 96 trackDataURL=data_url, | 102 trackDataURL=data_url, |
| 97 trackType=track_type, | 103 trackType=track_type, |
| 98 visibility=visibility, | 104 visibility=visibility, |
| 99 thickDrawItem=thick_draw_item, | 105 thickDrawItem=thick_draw_item, |
| 100 priority=priority, | 106 priority=priority, |
| 107 track_color=rgb_ucsc | |
| 101 ) | 108 ) |
| 102 | 109 |
| 103 # Return the Bam Track Object | 110 # Return the Bam Track Object |
| 104 self.track = Track( | 111 self.track = Track( |
| 105 trackFile=track_file, | 112 trackFile=track_file, |
