-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of ssh://github.com/KarrLab/datanator
- Loading branch information
Showing
3 changed files
with
158 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import pymongo | ||
from bson.binary import Binary | ||
import pickle | ||
from datanator_query_python.util import mongo_util | ||
import datanator.config.core | ||
from pathlib import Path | ||
|
||
|
||
def main(): | ||
db = 'test' | ||
collection_str = 'brenda_constants' | ||
username = datanator.config.core.get_config()[ | ||
'datanator']['mongodb']['user'] | ||
password = datanator.config.core.get_config( | ||
)['datanator']['mongodb']['password'] | ||
MongoDB = datanator.config.core.get_config( | ||
)['datanator']['mongodb']['server'] | ||
manager = mongo_util.MongoUtil(MongoDB=MongoDB, db=db, username=username, | ||
password=password, collection_str=collection_str) | ||
|
||
with open(str(Path('~/karr_lab/datanator/docs/brenda/brenda.pkl').expanduser()), 'rb') as f: | ||
data = pickle.load(f) | ||
coll.insert({'bin-data': Binary(thebytes)}) |
36 changes: 36 additions & 0 deletions
36
datanator/data_source/metabolite_concentration/doi_10_1038_nchembio_2077.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import pandas as pd | ||
from datanator.util import rna_halflife_util, file_util | ||
import datetime | ||
import datanator.config.core | ||
import datetime | ||
from pymongo.collation import Collation, CollationStrength | ||
import tempfile | ||
import shutil | ||
|
||
|
||
class Concentration(rna_halflife_util.RnaHLUtil): | ||
|
||
def __init__(self, cache_dir=None, server=None, src_db=None, protein_col=None, | ||
authDB=None, readPreference=None, username=None, password=None, | ||
verbose=None, max_entries=None, des_db=None, collection_str=None): | ||
"""Init | ||
Args: | ||
cache_dir (:obj:`str`, optional): Cache directory for logs. Defaults to None. | ||
server (:obj:`str`, optional): MongoDB server address. Defaults to None. | ||
db (:obj:`str`, optional): Database where initial uniprot collection resides. Defaults to None. | ||
collection_str (:obj:`str`, optional): name of collection. Defaults to None. | ||
authDB (:obj:`str`, optional): MongoDB authentication database. Defaults to None. | ||
readPreference (:obj:`str`, optional): MongoDB read preference. Defaults to None. | ||
username (:obj:`str`, optional): MongoDB username. Defaults to None. | ||
password (:obj:`str`, optional): MongoDB password. Defaults to None. | ||
verbose (:obj:`bool`, optional): Wheter to display verbose messages. Defaults to None. | ||
max_entries (:obj:`int`, optional): Number of records to be processed. Defaults to None. | ||
uniprot_col_db (:obj:`int`, optional): Database to which new uniprot records will be inserted. Defaults to None. | ||
""" | ||
super().__init__(server=server, username=username, password=password, src_db=src_db, | ||
des_db=des_db, protein_col=protein_col, rna_col=collection_str, authDB=authDB, readPreference=readPreference, | ||
max_entries=max_entries, verbose=verbose, cache_dir=cache_dir) | ||
self.collation = Collation('en', strength=CollationStrength.SECONDARY) | ||
self.max_entries = max_entries | ||
self.verbose = verbose |