def index(self, organism=None, db_version=None): global results_dir, uploads_dir, sett if not organism: organism = sett["default_organism"] if DEBUG_MODE or not organism in self._index_html: tmpl = lookup.get_template("master.mako") paths = PathNode() paths.name = "Root" [html_dbversion, db_version ] = grsnp_path.get_database_versions_html(sett["data_dir"], db_version) paths.organisms = self.get_org(db_version) # Check if the organism actually exists in the current database. # If it is not, select the default organism if not organism in paths.organisms: organism = sett["default_organism"] custom_dir = os.path.join( os.path.split(sett["data_dir"][db_version])[0], "custom_data") # Use mako to render index.html body = lookup.get_template("index.mako").render( paths=paths, default_background=paths.get_backgrounds_combo( organism, custom_dir), custom_gfs=paths.get_custom_gfs(organism, custom_dir), demo_snps=paths.get_custom_fois(organism, custom_dir), data_dir=os.path.join(sett["data_dir"][db_version], organism), default_organism=organism, database_versions=html_dbversion, pct_scores=paths.get_scores( os.path.split(sett["data_dir"][db_version])[0])) script = lookup.get_template("index.js").render( default_organism=organism) self._index_html[organism] = tmpl.render(body=body, script=script) return self._index_html[organism]
def index(self,organism=None,db_version=None): if not organism: organism = sett["default_organism"] if DEBUG_MODE or not organism in self._index_html: tmpl = lookup.get_template("master.mako") paths = PathNode() paths.name = "Root" [html_dbversion, db_version] = grsnp_path.get_database_versions_html(sett["data_dir"],db_version) paths.organisms = self.get_org(db_version) # Check if the organism actually exists in the current database. # If it is not, select the default organism if not organism in paths.organisms: organism = sett["default_organism"] custom_dir = os.path.join(os.path.split(sett["data_dir"][db_version])[0],"custom_data") # Use mako to render index.html body = lookup.get_template("index.mako").render(paths=paths,default_background=paths.get_backgrounds_combo(organism,custom_dir), custom_gfs=paths.get_custom_gfs(organism,custom_dir),demo_snps=paths.get_custom_fois(organism,custom_dir), data_dir=os.path.join(sett["data_dir"][db_version],organism),default_organism=organism, database_versions=html_dbversion,pct_scores=paths.get_scores(os.path.split(sett["data_dir"][db_version])[0])) script = lookup.get_template("index.js").render(default_organism=organism) self._index_html[organism] = tmpl.render(body=body,script=script) return self._index_html[organism]