comparison TrackHub.py @ 15:8627394693c6 draft

planemo upload for repository https://github.com/Yating-L/jbrowse_hub commit f18ea51d27ec7addfa6413716391cfefebc8acbc-dirty
author yating-l
date Tue, 14 Mar 2017 14:57:39 -0400
parents e1f188b43750
children 49841ae99869
comparison
equal deleted inserted replaced
14:0e29c929a8ee 15:8627394693c6
95 95
96 def makeArchive(self): 96 def makeArchive(self):
97 shutil.make_archive(self.out_path, 'zip', self.out_path) 97 shutil.make_archive(self.out_path, 'zip', self.out_path)
98 shutil.rmtree(self.out_path) 98 shutil.rmtree(self.out_path)
99 99
100 #TODO: this will list all zip files in the filedir and sub-dirs. worked in Galaxy but all list zip files in test-data when
101 #run it locally. May need modify
100 def outHtml(self): 102 def outHtml(self):
101 #htmloutput = tempfile.NamedTemporaryFile(self.outfile, suffix = '.html', bufsize=0, delete=False) 103 #htmloutput = tempfile.NamedTemporaryFile(self.outfile, suffix = '.html', bufsize=0, delete=False)
102 with open(self.outfile, 'w') as htmlfile: 104 with open(self.outfile, 'w') as htmlfile:
103 htmlstr = 'The JBrowse Hub is created: <br>' 105 htmlstr = 'The JBrowse Hub is created: <br>'
104 zipfiles = '<li><a href = "%s">Download</a></li>' 106 zipfiles = '<li><a href = "%s">Download</a></li>'
109 for file in files: 111 for file in files:
110 if file.endswith('.zip'): 112 if file.endswith('.zip'):
111 relative_directory = os.path.relpath(root, filedir) 113 relative_directory = os.path.relpath(root, filedir)
112 relative_file_path = os.path.join(relative_directory, file) 114 relative_file_path = os.path.join(relative_directory, file)
113 htmlstr += zipfiles % relative_file_path 115 htmlstr += zipfiles % relative_file_path
116
114 #htmlstr = htmlstr % zipfile 117 #htmlstr = htmlstr % zipfile
115 htmlfile.write(htmlstr) 118 htmlfile.write(htmlstr)
116 119
117 120
118 121