def _get_bioentries(self, biodb_name, start=0, limit=10): """Retreive bioentries associated with the database. """ start = int(request.params.get('start', start)) limit = int(request.params.get('limit', limit)) biosql_db = BioSeqDatabase.open_database() try: biodb = biosql_db[biodb_name] except KeyError: return [] biodb = biodb.get_biodatabase() return biodb.bioentries[start:start+limit]
def genbank_upload(self, *args, **kwargs): # XXX hack for os.linesep not being present; where did it go? os.linesep = "\n" biodb_name = config.get("biosql_biodb_name") biosql_db = BioSeqDatabase.open_database() try: biodb = biosql_db[biodb_name] except KeyError: biodb = biosql_db.new_database(biodb_name) handle = request.params['upload_file'].file biodb.load(SeqIO.parse(handle, "genbank")) handle.close() response.headers['content-type'] = 'text/javascript' return json.dumps(dict())