# HG changeset patch # User yating-l # Date 1489782085 14400 # Node ID 046c5bfc0413173166bc760dc40eb13c264e18b3 # Parent d5ec43607f6665768fc584b0b5bfbb4d6a5852dc planemo upload for repository https://github.com/Yating-L/jbrowse_hub commit faeedda55e23f1197bc454d3db2d52af29d786e8-dirty diff -r d5ec43607f66 -r 046c5bfc0413 TrackHub.py --- a/TrackHub.py Fri Mar 17 13:04:11 2017 -0400 +++ b/TrackHub.py Fri Mar 17 16:21:25 2017 -0400 @@ -44,37 +44,43 @@ print "Cannot prepare reference error({0}): {1}".format(e.errno, e.strerror) #TODO: hard coded the bam and bigwig tracks. Need to allow users to customize the settings def addTrack(self, track): + track_label = track['label'] + track_color = track['track_color'] + track_type = track['track_type'] if track['dataType'] == 'bam': self.createTrackList() json_file = os.path.join(self.json, "trackList.json") bam_track = dict() bam_track['type'] = 'JBrowse/View/Track/Alignments2' bam_track['storeClass'] = 'JBrowse/Store/SeqFeature/BAM' - bam_track['label'] = track['label'] + bam_track['label'] = track_label + bam_track['color'] = track_color bam_track['urlTemplate'] = os.path.join('../raw', track['fileName']) bam_track['baiUrlTemplate'] = os.path.join('../raw', track['index']) utils.add_tracks_to_json(json_file, bam_track, 'add_tracks') - print "add bam track\n" + # print "add bam track\n" elif track['dataType'] == 'bigwig': self.createTrackList() json_file = os.path.join(self.json, "trackList.json") bigwig_track = dict() - bigwig_track['label'] = track['label'] + bigwig_track['label'] = track_label + bigwig_track['color'] = track_color bigwig_track['urlTemplate'] = os.path.join('../raw', track['fileName']) bigwig_track['type'] = 'JBrowse/View/Track/Wiggle/XYPlot' bigwig_track['storeClass'] = 'JBrowse/Store/SeqFeature/BigWig' utils.add_tracks_to_json(json_file, bigwig_track, 'add_tracks') else: gff3_file = os.path.join(self.raw, track['fileName']) - label = track['label'] if track['dataType'] == 'bedSpliceJunctions' or track['dataType'] == 'gtf': - p = subprocess.Popen(['flatfile-to-json.pl', '--gff', gff3_file, '--trackType', 'CanvasFeatures', '--trackLabel', label, '--config', '{"glyph": "JBrowse/View/FeatureGlyph/Segments"}', '--out', self.json]) + p = subprocess.Popen(['flatfile-to-json.pl', '--gff', gff3_file, '--trackType', track_type, '--trackLabel', track_label, '--config', '{"glyph": "JBrowse/View/FeatureGlyph/Segments", "color" : "%s"}' % track_color, '--out', self.json]) elif track['dataType'] == 'gff3_transcript': - p = subprocess.Popen(['flatfile-to-json.pl', '--gff', gff3_file, '--trackType', 'MyPlugin/GenePred', '--trackLabel', label, '--config', '{"transcriptType": "transcript"}', '--out', self.json]) + p = subprocess.Popen(['flatfile-to-json.pl', '--gff', gff3_file, '--trackType', track_type, '--trackLabel', track_label, '--config', '{"transcriptType": "transcript", "color" : "%s"}' % track_color, '--out', self.json]) elif track['dataType'] == 'gff3_mrna': - p = subprocess.Popen(['flatfile-to-json.pl', '--gff', gff3_file, '--trackType', 'MyPlugin/GenePred', '--trackLabel', label, '--out', self.json]) + p = subprocess.Popen(['flatfile-to-json.pl', '--gff', gff3_file, '--trackType', track_type, '--trackLabel', track_label, '--config', '{"color" : "%s"}' % track_color, '--out', self.json]) + elif track['dataType'] == 'blastxml': + p = subprocess.Popen(['flatfile-to-json.pl', '--gff', gff3_file, '--trackType', track_type, '--trackLabel', track_label, '--config', '{"color" : "%s"}' % track_color, '--out', self.json]) else: - p = subprocess.Popen(['flatfile-to-json.pl', '--gff', gff3_file, '--trackType', 'CanvasFeatures', '--trackLabel', label, '--out', self.json]) + p = subprocess.Popen(['flatfile-to-json.pl', '--gff', gff3_file, '--trackType', track_type, '--trackLabel', track_label, '--config', '{"color" : "%s"}' % track_color, '--out', self.json]) p.communicate() def indexName(self): diff -r d5ec43607f66 -r 046c5bfc0413 jbrowse_hub.xml --- a/jbrowse_hub.xml Fri Mar 17 13:04:11 2017 -0400 +++ b/jbrowse_hub.xml Fri Mar 17 16:21:25 2017 -0400 @@ -38,7 +38,10 @@ #for $f in $format #set track_label = str($f.formatChoice.label) - #set extra_data_dict = {"label" : $track_label} + #set track_color = str($f.formatChoice.track_color) + #set track_type = str($f.formatChoice.track_type) + #set extra_data_dict = {"label" : $track_label, + "track_color" : $track_color} #if $f.formatChoice.format_select == 'bed' #if $f.formatChoice.bedChoice.bed_select == 'bed_simple_repeats_option' --bedSimpleRepeats $f.formatChoice.bedChoice.BED_simple_repeats @@ -104,7 +107,14 @@ type="data" label="BAM File" /> - + + + + + + + + @@ -129,7 +139,14 @@ /> - + + + + + + + + - + + + + + + + + + + + + - + + + + + + + + @@ -172,7 +207,18 @@ /> - + + + + + + + + + + + + - + + + + + + + + diff -r d5ec43607f66 -r 046c5bfc0413 trackObject.py --- a/trackObject.py Fri Mar 17 13:04:11 2017 -0400 +++ b/trackObject.py Fri Mar 17 16:21:25 2017 -0400 @@ -61,6 +61,13 @@ track['fileName'] = fileName track['dataType'] = dataType track.update(metaData) - if 'label' not in metaData.keys(): - track['label'] = fileName + #If the metadata is not set, use the default value + if 'name' not in metaData.keys() or track['name'] == '': + track['name'] = fileName + if 'label' not in metaData.keys() or track['label'] == '': + track['label'] = track['name'] + if 'track_color' not in metaData.keys() or track['track_color'] == '': + track['track_color'] = "#daa520" + if 'track_type' not in metaData.keys() or track['track_type'] == '': + track['track_type'] = "CanvasFeatures" self.tracks.append(track)