comparison TrackHub.py @ 26:a4a54b925c73 draft

planemo upload for repository https://github.com/Yating-L/jbrowse_hub commit e81fecac281f299db00cfc88a068e056b031ae9d-dirty
author yating-l
date Wed, 15 Mar 2017 10:51:23 -0400
parents 55c62db02917
children d8049deb0c97
comparison
equal deleted inserted replaced
25:55c62db02917 26:a4a54b925c73
52 except OSError as e: 52 except OSError as e:
53 print "Cannot prepare reference error({0}): {1}".format(e.errno, e.strerror) 53 print "Cannot prepare reference error({0}): {1}".format(e.errno, e.strerror)
54 #TODO: hard coded the bam and bigwig tracks. Need to allow users to customize the settings 54 #TODO: hard coded the bam and bigwig tracks. Need to allow users to customize the settings
55 def addTrack(self, track): 55 def addTrack(self, track):
56 if track['dataType'] == 'bam': 56 if track['dataType'] == 'bam':
57 self.createTrackList()
57 json_file = os.path.join(self.json, "trackList.json") 58 json_file = os.path.join(self.json, "trackList.json")
58 bam_track = dict() 59 bam_track = dict()
59 bam_track['type'] = 'JBrowse/View/Track/Alignments2' 60 bam_track['type'] = 'JBrowse/View/Track/Alignments2'
60 bam_track['storeClass'] = 'JBrowse/Store/SeqFeature/BAM' 61 bam_track['storeClass'] = 'JBrowse/Store/SeqFeature/BAM'
61 bam_track['label'] = track['fileName'] 62 bam_track['label'] = track['fileName']
62 bam_track['urlTemplate'] = os.path.join('../raw', track['fileName']) 63 bam_track['urlTemplate'] = os.path.join('../raw', track['fileName'])
63 #bam_track['baiUrlTemplate'] = os.path.join('../raw', track['fileName']) 64 bam_track['baiUrlTemplate'] = os.path.join('../raw', track['index'])
64 utils.add_tracks_to_json(json_file, bam_track, 'add_tracks') 65 utils.add_tracks_to_json(json_file, bam_track, 'add_tracks')
65 print "add bam track\n" 66 print "add bam track\n"
66 elif track['dataType'] == 'bigwig': 67 elif track['dataType'] == 'bigwig':
68 self.createTrackList()
67 json_file = os.path.join(self.json, "trackList.json") 69 json_file = os.path.join(self.json, "trackList.json")
68 bigwig_track = dict() 70 bigwig_track = dict()
69 bigwig_track['label'] = track['fileName'] 71 bigwig_track['label'] = track['fileName']
70 bigwig_track['urlTemplate'] = os.path.join('../raw', track['fileName']) 72 bigwig_track['urlTemplate'] = os.path.join('../raw', track['fileName'])
71 bigwig_track['type'] = 'JBrowse/View/Track/Wiggle/XYPlot' 73 bigwig_track['type'] = 'JBrowse/View/Track/Wiggle/XYPlot'
111 htmlstr += zipfiles % relative_file_path 113 htmlstr += zipfiles % relative_file_path
112 114
113 #htmlstr = htmlstr % zipfile 115 #htmlstr = htmlstr % zipfile
114 htmlfile.write(htmlstr) 116 htmlfile.write(htmlstr)
115 117
118 def createTrackList(self):
119 trackList = os.path.join(self.json, "trackList.json")
120 if not os.path.exists(trackList):
121 os.mknod(trackList)
122 #open(trackList,'w').close()
123
124
116 125
117 126
118 127
119 128