Mercurial > repos > yating-l > jbrowsearchivecreator
diff TrackHub.py @ 11:45b5cb50c29e draft
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 479fc6490e24ca0e5034ae6c3579882e97e095e6-dirty
author | yating-l |
---|---|
date | Wed, 31 May 2017 15:42:51 -0400 |
parents | 91b3558fa73f |
children | cdc32923786d |
line wrap: on
line diff
--- a/TrackHub.py Wed May 31 13:38:46 2017 -0400 +++ b/TrackHub.py Wed May 31 15:42:51 2017 -0400 @@ -73,14 +73,6 @@ print "finished name index \n" def makeArchive(self): - #shutil.make_archive(self.out_path, 'zip', self.out_path) - os.chdir(os.path.dirname(self.out_path)) - with zipfile.ZipFile(self.out_path + '.zip', 'w', zipfile.ZIP_DEFLATED, allowZip64=True) as zf: - for root, _, filenames in os.walk(os.path.basename(self.out_path)): - for name in filenames: - name = os.path.join(root, name) - name = os.path.normpath(name) - zf.write(name, name) file_dir = os.path.abspath(self.outfile) source_dir = os.path.dirname(file_dir) folder_name = os.path.basename(self.outfolder) @@ -96,23 +88,11 @@ os.symlink(source, slink) return slink - #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 def outHtml(self, slink): with open(self.outfile, 'w') as htmlfile: htmlstr = 'The JBrowse Hub is created: <br>' - zipfiles = '<li><a href = "%s">Download</a></li>' url = self.jbrowse_host + "/JBrowse-1.12.1/index.html?data=%s" jbrowse_hub = '<li><a href = "%s" target="_blank">View JBrowse Hub</a></li>' % url - filedir_abs = os.path.abspath(self.outfile) - filedir = os.path.dirname(filedir_abs) - filedir = os.path.join(filedir, self.outfolder) - for root, dirs, files in os.walk(filedir): - for file in files: - if file.endswith('.zip'): - relative_directory = os.path.relpath(root, filedir) - relative_file_path = os.path.join(relative_directory, file) - htmlstr += zipfiles % relative_file_path link_name = os.path.basename(slink) relative_path = os.path.join('data', link_name + '/json') htmlstr += jbrowse_hub % relative_path