Mercurial > repos > yating-l > jbrowse_hub
comparison TrackHub.py @ 49:193e94a43f0f draft
planemo upload for repository https://github.com/Yating-L/jbrowse_hub commit 88aa9133c8eccdb21dbc755eb9643c9e7b09449e-dirty
author | yating-l |
---|---|
date | Wed, 29 Mar 2017 14:46:23 -0400 |
parents | 6803152ea92a |
children | 3e5b6f6a9abe |
comparison
equal
deleted
inserted
replaced
48:6803152ea92a | 49:193e94a43f0f |
---|---|
70 p = subprocess.Popen(['generate-names.pl', '-v', '--out', self.json]) | 70 p = subprocess.Popen(['generate-names.pl', '-v', '--out', self.json]) |
71 p.communicate() | 71 p.communicate() |
72 print "finished name index \n" | 72 print "finished name index \n" |
73 | 73 |
74 def makeArchive(self): | 74 def makeArchive(self): |
75 shutil.make_archive(self.out_path, 'zip', self.out_path) | 75 shutil.make_archive(self.out_path, 'zip', self.out_path) |
76 shutil.rmtree(self.out_path) | 76 data_folder = '/var/www/html/JBrowse-1.12.1/jbrowse_hub' |
77 try: | |
78 if os.path.exists(data_folder): | |
79 if os.path.isdir(data_folder): | |
80 shutil.rmtree(data_folder) | |
81 else: | |
82 os.remove(data_folder) | |
83 except OSError as oserror: | |
84 print "Cannot create data folder({0}): {1}".format(oserror.errno, oserror.strerror) | |
85 shutil.copytree(self.out_path, data_folder) | |
86 p = subprocess.Popen(['chmod', '-R', 'o+rx', '/var/www/html/JBrowse-1.12.1/jbrowse_hub']) | |
87 p.communicate() | |
88 shutil.rmtree(self.out_path) | |
77 | 89 |
78 #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 | 90 #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 |
79 #run it locally. May need modify | 91 #run it locally. May need modify |
80 def outHtml(self): | 92 def outHtml(self): |
81 with open(self.outfile, 'w') as htmlfile: | 93 with open(self.outfile, 'w') as htmlfile: |
82 htmlstr = 'The JBrowse Hub is created: <br>' | 94 htmlstr = 'The JBrowse Hub is created: <br>' |
83 zipfiles = '<li><a href = "%s">Download</a></li>' | 95 zipfiles = '<li><a href = "%s">Download</a></li>' |
96 jbrowse_hub = '<li><a href = "http://192.168.56.11/JBrowse-1.12.1/index.html?data=jbrowse_hub/json" target="_blank">View JBrowse Hub</a></li>' | |
84 filedir_abs = os.path.abspath(self.outfile) | 97 filedir_abs = os.path.abspath(self.outfile) |
85 filedir = os.path.dirname(filedir_abs) | 98 filedir = os.path.dirname(filedir_abs) |
86 filedir = os.path.join(filedir, self.outfolder) | 99 filedir = os.path.join(filedir, self.outfolder) |
87 for root, dirs, files in os.walk(filedir): | 100 for root, dirs, files in os.walk(filedir): |
88 for file in files: | 101 for file in files: |
89 if file.endswith('.zip'): | 102 if file.endswith('.zip'): |
90 relative_directory = os.path.relpath(root, filedir) | 103 relative_directory = os.path.relpath(root, filedir) |
91 relative_file_path = os.path.join(relative_directory, file) | 104 relative_file_path = os.path.join(relative_directory, file) |
92 htmlstr += zipfiles % relative_file_path | 105 htmlstr += zipfiles % relative_file_path |
93 | 106 htmlstr += jbrowse_hub |
94 htmlfile.write(htmlstr) | 107 htmlfile.write(htmlstr) |
95 | 108 |
96 def createTrackList(self): | 109 def createTrackList(self): |
97 trackList = os.path.join(self.json, "trackList.json") | 110 trackList = os.path.join(self.json, "trackList.json") |
98 if not os.path.exists(trackList): | 111 if not os.path.exists(trackList): |