comparison TrackHub.py @ 54:9c45b81bc4e6 draft

planemo upload for repository https://github.com/Yating-L/jbrowse_hub commit a505d6c97db9d044761b5ce92be4a39cb84eda29-dirty
author yating-l
date Fri, 31 Mar 2017 12:04:59 -0400
parents 1e4806330e51
children 972b83917c18
comparison
equal deleted inserted replaced
53:1e4806330e51 54:9c45b81bc4e6
101 #run it locally. May need modify 101 #run it locally. May need modify
102 def outHtml(self, slink): 102 def outHtml(self, slink):
103 with open(self.outfile, 'w') as htmlfile: 103 with open(self.outfile, 'w') as htmlfile:
104 htmlstr = 'The JBrowse Hub is created: <br>' 104 htmlstr = 'The JBrowse Hub is created: <br>'
105 zipfiles = '<li><a href = "%s">Download</a></li>' 105 zipfiles = '<li><a href = "%s">Download</a></li>'
106 jbrowse_hub = '<li><a href = "/gonramp/static/JBrowse-1.12.1/index.html?data="%s" target="_blank">View JBrowse Hub</a></li>' 106 jbrowse_hub = '<li><a href = "/gonramp/static/JBrowse-1.12.1/index.html?data=%s" target="_blank">View JBrowse Hub</a></li>'
107 filedir_abs = os.path.abspath(self.outfile) 107 filedir_abs = os.path.abspath(self.outfile)
108 filedir = os.path.dirname(filedir_abs) 108 filedir = os.path.dirname(filedir_abs)
109 filedir = os.path.join(filedir, self.outfolder) 109 filedir = os.path.join(filedir, self.outfolder)
110 for root, dirs, files in os.walk(filedir): 110 for root, dirs, files in os.walk(filedir):
111 for file in files: 111 for file in files:
112 if file.endswith('.zip'): 112 if file.endswith('.zip'):
113 relative_directory = os.path.relpath(root, filedir) 113 relative_directory = os.path.relpath(root, filedir)
114 relative_file_path = os.path.join(relative_directory, file) 114 relative_file_path = os.path.join(relative_directory, file)
115 htmlstr += zipfiles % relative_file_path 115 htmlstr += zipfiles % relative_file_path
116 htmlstr += jbrowse_hub % slink 116 link_name = os.path.basename(slink)
117 relative_path = os.path.join('data', link_name + '/json')
118 htmlstr += jbrowse_hub % relative_path
117 htmlfile.write(htmlstr) 119 htmlfile.write(htmlstr)
118 120
119 def createTrackList(self): 121 def createTrackList(self):
120 trackList = os.path.join(self.json, "trackList.json") 122 trackList = os.path.join(self.json, "trackList.json")
121 if not os.path.exists(trackList): 123 if not os.path.exists(trackList):