comparison 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
comparison
equal deleted inserted replaced
38:3a3591cf27f9 39:75edbc203532
44 print "Cannot prepare reference error({0}): {1}".format(e.errno, e.strerror) 44 print "Cannot prepare reference error({0}): {1}".format(e.errno, e.strerror)
45 #TODO: hard coded the bam and bigwig tracks. Need to allow users to customize the settings 45 #TODO: hard coded the bam and bigwig tracks. Need to allow users to customize the settings
46 def addTrack(self, track): 46 def addTrack(self, track):
47 track_label = track['label'] 47 track_label = track['label']
48 track_color = track['track_color'] 48 track_color = track['track_color']
49 track_type = track['track_type'] 49 if track['dataType'] == 'blastxml':
50 track_type = "G-OnRamp_plugin/BlastAlignment"
51 elif track['dataType'] == 'gff3_transcript' or track['dataType'] == 'gff3_mrna':
52 track_type = "G-OnRamp_plugin/GenePred"
53 else:
54 track_type = "CanvasFeatures"
50 if track['dataType'] == 'bam': 55 if track['dataType'] == 'bam':
51 self.createTrackList() 56 self.createTrackList()
52 json_file = os.path.join(self.json, "trackList.json") 57 json_file = os.path.join(self.json, "trackList.json")
53 bam_track = dict() 58 bam_track = dict()
54 bam_track['type'] = 'JBrowse/View/Track/Alignments2' 59 bam_track['type'] = 'JBrowse/View/Track/Alignments2'
55 bam_track['storeClass'] = 'JBrowse/Store/SeqFeature/BAM' 60 bam_track['storeClass'] = 'JBrowse/Store/SeqFeature/BAM'
56 bam_track['label'] = track_label 61 bam_track['label'] = track_label
57 bam_track['color'] = track_color
58 bam_track['urlTemplate'] = os.path.join('../raw', track['fileName']) 62 bam_track['urlTemplate'] = os.path.join('../raw', track['fileName'])
59 bam_track['baiUrlTemplate'] = os.path.join('../raw', track['index']) 63 bam_track['baiUrlTemplate'] = os.path.join('../raw', track['index'])
60 utils.add_tracks_to_json(json_file, bam_track, 'add_tracks') 64 utils.add_tracks_to_json(json_file, bam_track, 'add_tracks')
61 # print "add bam track\n" 65 # print "add bam track\n"
62 elif track['dataType'] == 'bigwig': 66 elif track['dataType'] == 'bigwig':
63 self.createTrackList() 67 self.createTrackList()
64 json_file = os.path.join(self.json, "trackList.json") 68 json_file = os.path.join(self.json, "trackList.json")
65 bigwig_track = dict() 69 bigwig_track = dict()
66 bigwig_track['label'] = track_label 70 bigwig_track['label'] = track_label
67 bigwig_track['color'] = track_color 71 #color_setting = {"pos_color" : track['pos_color'], "neg_color" : track['neg_color']}
72 bigwig_track['style'] = {"pos_color" : track['pos_color'], "neg_color" : track['neg_color']}
68 bigwig_track['urlTemplate'] = os.path.join('../raw', track['fileName']) 73 bigwig_track['urlTemplate'] = os.path.join('../raw', track['fileName'])
69 bigwig_track['type'] = 'JBrowse/View/Track/Wiggle/XYPlot' 74 bigwig_track['type'] = 'JBrowse/View/Track/Wiggle/XYPlot'
70 bigwig_track['storeClass'] = 'JBrowse/Store/SeqFeature/BigWig' 75 bigwig_track['storeClass'] = 'JBrowse/Store/SeqFeature/BigWig'
71 utils.add_tracks_to_json(json_file, bigwig_track, 'add_tracks') 76 utils.add_tracks_to_json(json_file, bigwig_track, 'add_tracks')
72 else: 77 else:
73 gff3_file = os.path.join(self.raw, track['fileName']) 78 gff3_file = os.path.join(self.raw, track['fileName'])
74 if track['dataType'] == 'bedSpliceJunctions' or track['dataType'] == 'gtf': 79 if track['dataType'] == 'bedSpliceJunctions' or track['dataType'] == 'gtf':
75 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]) 80 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])
76 elif track['dataType'] == 'gff3_transcript': 81 elif track['dataType'] == 'gff3_transcript':
77 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]) 82 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])
78 elif track['dataType'] == 'gff3_mrna':
79 p = subprocess.Popen(['flatfile-to-json.pl', '--gff', gff3_file, '--trackType', track_type, '--trackLabel', track_label, '--config', '{"color" : "%s"}' % track_color, '--out', self.json])
80 elif track['dataType'] == 'blastxml':
81 p = subprocess.Popen(['flatfile-to-json.pl', '--gff', gff3_file, '--trackType', track_type, '--trackLabel', track_label, '--config', '{"color" : "%s"}' % track_color, '--out', self.json])
82 else: 83 else:
83 p = subprocess.Popen(['flatfile-to-json.pl', '--gff', gff3_file, '--trackType', track_type, '--trackLabel', track_label, '--config', '{"color" : "%s"}' % track_color, '--out', self.json]) 84 p = subprocess.Popen(['flatfile-to-json.pl', '--gff', gff3_file, '--trackType', track_type, '--trackLabel', track_label, '--clientConfig', '{"color" : "%s"}' % track_color, '--out', self.json])
84 p.communicate() 85 p.communicate()
85 86
86 def indexName(self): 87 def indexName(self):
87 p = subprocess.Popen(['generate-names.pl', '-v', '--out', self.json]) 88 p = subprocess.Popen(['generate-names.pl', '-v', '--out', self.json])
88 p.communicate() 89 p.communicate()