aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2022-06-20 14:03:54 +0530
committerArun Isaac2022-06-20 14:05:31 +0530
commit52b591d5b5201628f33043e62e5731ad919ee1b9 (patch)
treeb5afb0fe3a057c23bcf7c253e590f55b5ac07f47
parent7b694ff847aa84a548a63549d6b77662a4ab923c (diff)
downloadgenenetwork3-52b591d5b5201628f33043e62e5731ad919ee1b9.tar.gz
gn3: genodb: Retire get function.
* gn3/genodb.py (get): Delete function. (matrix): Use db.txn.get instead of get.
-rw-r--r--gn3/genodb.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/gn3/genodb.py b/gn3/genodb.py
index e4f26b6..3f7c71d 100644
--- a/gn3/genodb.py
+++ b/gn3/genodb.py
@@ -40,18 +40,14 @@ def open(path):
txn.abort()
env.close()
-def get(db, key):
- '''Get value associated with key in genotype database.'''
- return db.txn.get(key)
-
def get_metadata(db, hash, metadata):
'''Get metadata associated with hash in genotype database.'''
return db.txn.get(hash + b':' + metadata.encode())
def matrix(db):
'''Get current matrix from genotype database.'''
- hash = get(db, b'versions')[0:db.hash_length]
- read_optimized_blob = get(db, get(db, b'current'))
+ hash = db.txn.get(b'versions')[0:db.hash_length]
+ read_optimized_blob = db.txn.get(db.txn.get(b'current'))
nrows = int.from_bytes(get_metadata(db, hash, 'nrows'), byteorder='little')
ncols = int.from_bytes(get_metadata(db, hash, 'ncols'), byteorder='little')
return GenotypeMatrix(np.reshape(np.frombuffer(read_optimized_blob[0 : nrows*ncols],