# HG changeset patch # User yating-l # Date 1490813183 14400 # Node ID 193e94a43f0f297455ff8a0c49d2e416a55c294b # Parent 6803152ea92a6dc7ecef6fd0d92b5ea37554f018 planemo upload for repository https://github.com/Yating-L/jbrowse_hub commit 88aa9133c8eccdb21dbc755eb9643c9e7b09449e-dirty diff -r 6803152ea92a -r 193e94a43f0f TrackHub.py --- a/TrackHub.py Tue Mar 28 18:13:27 2017 -0400 +++ b/TrackHub.py Wed Mar 29 14:46:23 2017 -0400 @@ -72,8 +72,20 @@ print "finished name index \n" def makeArchive(self): - shutil.make_archive(self.out_path, 'zip', self.out_path) - shutil.rmtree(self.out_path) + shutil.make_archive(self.out_path, 'zip', self.out_path) + data_folder = '/var/www/html/JBrowse-1.12.1/jbrowse_hub' + try: + if os.path.exists(data_folder): + if os.path.isdir(data_folder): + shutil.rmtree(data_folder) + else: + os.remove(data_folder) + except OSError as oserror: + print "Cannot create data folder({0}): {1}".format(oserror.errno, oserror.strerror) + shutil.copytree(self.out_path, data_folder) + p = subprocess.Popen(['chmod', '-R', 'o+rx', '/var/www/html/JBrowse-1.12.1/jbrowse_hub']) + p.communicate() + shutil.rmtree(self.out_path) #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 #run it locally. May need modify @@ -81,6 +93,7 @@ with open(self.outfile, 'w') as htmlfile: htmlstr = 'The JBrowse Hub is created:
' zipfiles = '
  • Download
  • ' + jbrowse_hub = '
  • View JBrowse Hub
  • ' filedir_abs = os.path.abspath(self.outfile) filedir = os.path.dirname(filedir_abs) filedir = os.path.join(filedir, self.outfolder) @@ -90,7 +103,7 @@ relative_directory = os.path.relpath(root, filedir) relative_file_path = os.path.join(relative_directory, file) htmlstr += zipfiles % relative_file_path - + htmlstr += jbrowse_hub htmlfile.write(htmlstr) def createTrackList(self):