db.py 627 Bytes
Newer Older
aknecht2's avatar
aknecht2 committed
1
from pymongo import MongoClient
2
3
4
import gridfs
import sys
import traceback
aknecht2's avatar
aknecht2 committed
5

6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
class MongoDB(object):

    def __init__(self, host, username, password):
        self.client = MongoClient(args.host)
        self.db = client.chipseq
        try:
            self.db.authenticate(args.username, args.password, mechanism="SCRAM-SHA-1")
        except:
            print("Could not authenticate to db %s!" % (host,))
            print traceback.format_exc()
            sys.exit(1)
        self.gfs = gridfs.GridFS(self.db)
        return

    def load_bed(self, collection, result_id, bed_file, attributes = {}):

        return