Example #1
0
    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]
Example #2
0
	def __init__(self):		
		# go through each database directory and create custom_data if it does not exist.
		for db_ver,db_dir in sett["data_dir"].items():
			# create all directories in the custom_data dir if they do not already exist
			for org in self.get_org(db_ver):
				custom_dir = os.path.join(os.path.split(db_dir)[0],"custom_data")
				logger.info("Processing genomic features for {}".format(org))
				if not os.path.exists(custom_dir): os.mkdir(custom_dir)
				cust_sub_dir = ["backgrounds","gfs","fois","rsid_conversion"]
				for c in cust_sub_dir:
					tmp = os.path.join(custom_dir,c)
					if not os.path.exists(tmp): os.mkdir(tmp)
					c_dir = os.path.join(custom_dir,c,org)
					if not os.path.exists(c_dir): os.mkdir(c_dir)
				# Read the genomic feature files and generate html files
				paths = PathNode()
				paths.name = "Root"
				paths.organisms = self.get_org(db_ver) 
				paths.traverse(os.path.join(db_dir,org))
				grsnp_path.write_treeview_json(os.path.join(db_dir,org))
		self._index_html = {}
Example #3
0
 def __init__(self):
     # go through each database directory and create custom_data if it does not exist.
     for db_ver, db_dir in sett["data_dir"].items():
         # create all directories in the custom_data dir if they do not already exist
         for org in self.get_org(db_ver):
             custom_dir = os.path.join(
                 os.path.split(db_dir)[0], "custom_data")
             logger.info("Processing genomic features for {}".format(org))
             if not os.path.exists(custom_dir): os.mkdir(custom_dir)
             cust_sub_dir = [
                 "backgrounds", "gfs", "fois", "rsid_conversion"
             ]
             for c in cust_sub_dir:
                 tmp = os.path.join(custom_dir, c)
                 if not os.path.exists(tmp): os.mkdir(tmp)
                 c_dir = os.path.join(custom_dir, c, org)
                 if not os.path.exists(c_dir): os.mkdir(c_dir)
             # Read the genomic feature files and generate html files
             paths = PathNode()
             paths.name = "Root"
             paths.organisms = self.get_org(db_ver)
             paths.traverse(os.path.join(db_dir, org))
             paths.write_treeview_html(db_dir, org)
     self._index_html = {}
Example #4
0
	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]