diff TrackHub.py @ 39:75edbc203532 draft

planemo upload for repository https://github.com/Yating-L/jbrowse_hub commit faeedda55e23f1197bc454d3db2d52af29d786e8-dirty
author yating-l
date Fri, 17 Mar 2017 19:00:01 -0400
parents 046c5bfc0413
children a5108e5010b4
line wrap: on
line diff
--- a/TrackHub.py	Fri Mar 17 16:28:21 2017 -0400
+++ b/TrackHub.py	Fri Mar 17 19:00:01 2017 -0400
@@ -46,7 +46,12 @@
     def addTrack(self, track):
         track_label = track['label']
         track_color = track['track_color']
-        track_type = track['track_type']
+        if track['dataType'] == 'blastxml':
+            track_type = "G-OnRamp_plugin/BlastAlignment"
+        elif track['dataType'] == 'gff3_transcript' or track['dataType'] == 'gff3_mrna':
+            track_type = "G-OnRamp_plugin/GenePred"
+        else:
+            track_type = "CanvasFeatures"
         if track['dataType'] == 'bam':
             self.createTrackList()
             json_file = os.path.join(self.json, "trackList.json")
@@ -54,7 +59,6 @@
             bam_track['type'] = 'JBrowse/View/Track/Alignments2'
             bam_track['storeClass'] = 'JBrowse/Store/SeqFeature/BAM'
             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')
@@ -64,7 +68,8 @@
             json_file = os.path.join(self.json, "trackList.json")
             bigwig_track = dict()
             bigwig_track['label'] = track_label
-            bigwig_track['color'] = track_color
+            #color_setting = {"pos_color" : track['pos_color'], "neg_color" : track['neg_color']} 
+            bigwig_track['style'] = {"pos_color" : track['pos_color'], "neg_color" : track['neg_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'
@@ -72,15 +77,11 @@
         else: 
             gff3_file = os.path.join(self.raw, track['fileName'])
             if track['dataType'] == 'bedSpliceJunctions' or track['dataType'] == 'gtf':
-                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])
+                p = subprocess.Popen(['flatfile-to-json.pl', '--gff', gff3_file, '--trackType', track_type, '--trackLabel', track_label, '--Config', '{"glyph": "JBrowse/View/FeatureGlyph/Segments"}', '--clientConfig', '{"color" : "%s"}' % track_color, '--out', self.json])
             elif track['dataType'] == 'gff3_transcript':
-                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', 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])
+                p = subprocess.Popen(['flatfile-to-json.pl', '--gff', gff3_file, '--trackType', track_type, '--trackLabel', track_label, '--Config', '{"transcriptType": "transcript"}', '--clientConfig', '{"color" : "%s"}' % track_color, '--out', self.json])
             else:
-                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 = subprocess.Popen(['flatfile-to-json.pl', '--gff', gff3_file, '--trackType', track_type, '--trackLabel', track_label, '--clientConfig', '{"color" : "%s"}' % track_color, '--out', self.json])
             p.communicate()
             
     def indexName(self):