def databanks(name=None): if name is None: databanks = list(storage.db.databanks.find({})) else: databanks = [storage.db.databanks.find_one({'name': name})] db_tree = get_databank_hierarchy() return render_template('databank.html', db_tree=db_tree, nav_disabled='databanks', databanks=databanks)
def search(pdb_id): _log.info("request for pdb_id " + pdb_id) # On old browsers, the pdb id might end up in the url parameters: urlparam = request.args.get('pdb_id', '') if len(urlparam) == 4: pdb_id = urlparam db_tree = get_databank_hierarchy() results = search_results_for(pdb_id) db_order = names_from_hierarchy(db_tree) return render_template('search_results.html', db_tree=db_tree, db_order=db_order, pdb_id=pdb_id, results=results)
def entries(): collection = request.args.get('collection') databank_name = request.args.get('databank') comment_text = request.args.get('comment') _log.info("request for entries %s %s %s" % (collection, databank_name, comment_text)) title = 'No entries selected' entries = [] files = [] comments = {} if databank_name and collection: entries = list(get_entries_from_collection(databank_name, collection)) title = "%s %s" % (databank_name, collection) elif databank_name and comment_text: entries = list(get_entries_with_comment(databank_name, comment_text)) title = comment_text elif comment_text: entries = list(get_all_entries_with_comment(comment_text)) title = comment_text databank = storage.db.databanks.find_one({'name': databank_name}) for entry in entries: if databank and 'filepath' in entry: f = {'name': os.path.basename(entry['filepath']), 'url': get_file_link(databank, entry['pdb_id'])} files.append(f) elif 'comment' in entry: if entry['comment'] not in comments: comments[entry['comment']] = [] comments[entry['comment']].append( '%s,%s' % (entry['databank_name'], entry['pdb_id'])) comment_tree = comments_to_tree(comments) db_tree = get_databank_hierarchy() return render_template('entries.html', db_tree=db_tree, nav_disabled='entries', collection=collection, databank_name=databank_name, comment=comment_text, title=title, entries=entries, files=files, comment_tree=comment_tree)
def docs(): from whynot.api.routes import annotations, entries p = re.compile(r"\@bp\.route\s*\(\'([\w\/\<\>]*)\'\)") fs = [annotations, entries] docs = {} for f in fs: src = inspect.getsourcelines(f) m = p.search(src[0][0]) if not m: # pragma: no cover _log.debug("Unable to document function '{}'".format(f)) continue url = m.group(1) docstring = inspect.getdoc(f) docs[url] = docstring db_tree = get_databank_hierarchy() return render_template('docs.html', docs=docs, db_tree=db_tree)
bp = Blueprint('dashboard', __name__) date_format = '%d/%m/%Y %H:%M' from storage import storage def names_from_hierarchy(d): names = [] for key in sorted(d.keys()): names.append(key) names.extend(names_from_hierarchy(d [key])) return names db_tree = get_databank_hierarchy() db_order = names_from_hierarchy(db_tree) @bp.route('/') def index(): return render_template('home/HomePage.html', db_tree=db_tree) @bp.route('/search/pdbid/<pdbid>/') def search(pdbid): _log.info("request for pdbid " + pdbid) # On old browsers, the pdb id might end up in the url parameters: urlparam = request.args.get('pdbid', '') if len(urlparam) == 4: pdbid = urlparam
def comment(): db_tree = get_databank_hierarchy() return render_template('comments.html', db_tree=db_tree, nav_disabled='comments')
def about(): db_tree = get_databank_hierarchy() return render_template('about.html', db_tree=db_tree, nav_disabled='about')
def index(): db_tree = get_databank_hierarchy() return render_template('index.html', db_tree=db_tree)
def statistics(): db_tree = get_databank_hierarchy() return render_template('stats.html', nav_disabled='statistics', db_tree=db_tree)
date_format = '%d/%m/%Y %H:%M' from storage import storage def names_from_hierarchy(d): names = [] for key in sorted(d.keys()): names.append(key) names.extend(names_from_hierarchy(d[key])) return names db_tree = get_databank_hierarchy() db_order = names_from_hierarchy(db_tree) @bp.route('/') def index(): return render_template('home/HomePage.html', db_tree=db_tree) @bp.route('/search/pdbid/<pdbid>/') def search(pdbid): _log.info("request for pdbid " + pdbid) # On old browsers, the pdb id might end up in the url parameters: urlparam = request.args.get('pdbid', '') if len(urlparam) == 4: