Exemplo n.º 1
0
def openKeyValDb(dbName, newDb=False, singleProcess=False, prefer=None):
    " factory function: returns the right db object given a filename "
    #return LevelDb(dbName, newDb=newDb)
    # possible other candidates: mdb, cdb, hamsterdb
    if prefer=="server":
        return pubKeyVal.RedisDb(dbName, newDb=newDb, singleProcess=singleProcess)
    else:
        return pubKeyVal.SqliteKvDb(dbName, newDb=newDb, singleProcess=singleProcess, tmpDir=pubConf.getFastTempDir())
Exemplo n.º 2
0
def isValidUniProt(word):
    " return true if word is a uniprot accession "
    global uniprotDb
    if uniprotDb is None:
        dbFname = join(DATADIR, "uniprot")
        logging.info("opening list of uniprot accessions %s" % dbFname)
        uniprotDb = pubKeyVal.SqliteKvDb(dbFname)
    if not word in uniprotDb:
        logging.debug("%s is not a uniProt accs" % word)
        return False
    return True