Mercurial > repos > yating-l > jbrowse_hub
diff TrackHub.py @ 37:046c5bfc0413 draft
planemo upload for repository https://github.com/Yating-L/jbrowse_hub commit faeedda55e23f1197bc454d3db2d52af29d786e8-dirty
author | yating-l |
---|---|
date | Fri, 17 Mar 2017 16:21:25 -0400 |
parents | d8049deb0c97 |
children | 75edbc203532 |
line wrap: on
line diff
--- 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):