Mercurial > repos > yating-l > jbrowse_hub
comparison TrackHub.py @ 45:15b4a74722d1 draft
planemo upload for repository https://github.com/Yating-L/jbrowse_hub commit 73ede51a133dc8914812195a1b4cd512bfb8f23d
author | yating-l |
---|---|
date | Wed, 22 Mar 2017 12:07:32 -0400 |
parents | 37422f705e9b |
children | 6803152ea92a |
comparison
equal
deleted
inserted
replaced
44:37422f705e9b | 45:15b4a74722d1 |
---|---|
43 p.communicate() | 43 p.communicate() |
44 except OSError as e: | 44 except OSError as e: |
45 print "Cannot prepare reference error({0}): {1}".format(e.errno, e.strerror) | 45 print "Cannot prepare reference error({0}): {1}".format(e.errno, e.strerror) |
46 #TODO: hard coded the bam and bigwig tracks. Need to allow users to customize the settings | 46 #TODO: hard coded the bam and bigwig tracks. Need to allow users to customize the settings |
47 def addTrack(self, track): | 47 def addTrack(self, track): |
48 print "false_path" , track['false_path'] | 48 #print "false_path" , track['false_path'] |
49 if track['false_path'] in self.metaData.keys(): | 49 if track['false_path'] in self.metaData.keys(): |
50 metadata = self.metaData[track['false_path']] | 50 metadata = self.metaData[track['false_path']] |
51 else: | 51 else: |
52 metadata = {} | 52 metadata = {} |
53 self.SetMetadata(track, metadata) | 53 self.SetMetadata(track, metadata) |
56 # print "add bam track\n" | 56 # print "add bam track\n" |
57 elif track['dataType'] == 'bigwig': | 57 elif track['dataType'] == 'bigwig': |
58 self.BigWig(track, metadata) | 58 self.BigWig(track, metadata) |
59 else: | 59 else: |
60 gff3_file = os.path.join(self.raw, track['fileName']) | 60 gff3_file = os.path.join(self.raw, track['fileName']) |
61 if track['dataType'] == 'bedSpliceJunctions' or track['dataType'] == 'gtf': | 61 if track['dataType'] == 'bedSpliceJunctions' or track['dataType'] == 'gtf' or track['dataType'] == 'blastxml': |
62 p = subprocess.Popen(['flatfile-to-json.pl', '--gff', gff3_file, '--trackType', metadata['type'], '--trackLabel', metadata['label'], '--Config', '{"glyph": "JBrowse/View/FeatureGlyph/Segments", "category" : "%s"}' % metadata['category'], '--clientConfig', '{"color" : "%s"}' % metadata['color'], '--out', self.json]) | 62 p = subprocess.Popen(['flatfile-to-json.pl', '--gff', gff3_file, '--trackType', metadata['type'], '--trackLabel', metadata['label'], '--Config', '{"glyph": "JBrowse/View/FeatureGlyph/Segments", "category" : "%s"}' % metadata['category'], '--clientConfig', '{"color" : "%s"}' % metadata['color'], '--out', self.json]) |
63 elif track['dataType'] == 'gff3_transcript': | 63 elif track['dataType'] == 'gff3_transcript': |
64 p = subprocess.Popen(['flatfile-to-json.pl', '--gff', gff3_file, '--trackType', metadata['type'], '--trackLabel', metadata['label'], '--Config', '{"transcriptType": "transcript", "category" : "%s"}' % metadata['category'], '--clientConfig', '{"color" : "%s"}' % metadata['color'], '--out', self.json]) | 64 p = subprocess.Popen(['flatfile-to-json.pl', '--gff', gff3_file, '--trackType', metadata['type'], '--trackLabel', metadata['label'], '--Config', '{"transcriptType": "transcript", "category" : "%s"}' % metadata['category'], '--clientConfig', '{"color" : "%s"}' % metadata['color'], '--out', self.json]) |
65 else: | 65 else: |
66 p = subprocess.Popen(['flatfile-to-json.pl', '--gff', gff3_file, '--trackType', metadata['type'], '--trackLabel', metadata['label'], '--Config', '{"category" : "%s"}' % metadata['category'], '--clientConfig', '{"color" : "%s"}' % metadata['color'], '--out', self.json]) | 66 p = subprocess.Popen(['flatfile-to-json.pl', '--gff', gff3_file, '--trackType', metadata['type'], '--trackLabel', metadata['label'], '--Config', '{"category" : "%s"}' % metadata['category'], '--clientConfig', '{"color" : "%s"}' % metadata['color'], '--out', self.json]) |
126 bigwig_track['category'] = metadata['category'] | 126 bigwig_track['category'] = metadata['category'] |
127 utils.add_tracks_to_json(json_file, bigwig_track, 'add_tracks') | 127 utils.add_tracks_to_json(json_file, bigwig_track, 'add_tracks') |
128 | 128 |
129 #If the metadata is not set, use the default value | 129 #If the metadata is not set, use the default value |
130 def SetMetadata(self, track, metadata): | 130 def SetMetadata(self, track, metadata): |
131 print metadata | 131 #print metadata |
132 #track.update(metadata) | 132 #track.update(metadata) |
133 if 'label' not in metadata.keys() or metadata['label'] == '': | 133 if 'label' not in metadata.keys() or metadata['label'] == '': |
134 metadata['label'] = track['fileName'] | 134 metadata['label'] = track['fileName'] |
135 if 'color' not in metadata.keys() or metadata['color'] == '': | 135 if 'color' not in metadata.keys() or metadata['color'] == '': |
136 metadata['color'] = "#daa520" | 136 metadata['color'] = "#daa520" |