Example #1
0
def db(mock_plugins):
    MOCK_CONFIG = {
        'use': 'mock',
        'database': {
            'mock': {
                'type': 'excel',
                'dir': str(MOCK_DB),
            }
        }
    }
    return load_db(config=MOCK_CONFIG)
Example #2
0
def check(use=None):
    db = load_db(use)
    n_total = len(db)
    n_passed = 0

    for tag, construct in tqdm(db.items()):
        try:
            construct.check()
            n_passed += 1
        except CheckError as err:
            err.report()

    print(f"{n_total} sequences found.")
    print(f"{n_passed} passed all checks.")
Example #3
0
def query(tags, attrs):
    db = load_db()

    print('\t'.join(['tag', *attrs]))

    for tag in tags:
        try:
            hit = db[tag]
        except QueryError:
            print(tag)
            continue

        row = []
        for attr in attrs:
            try:
                row.append(getattr(hit, attr))
            except (QueryError, AttributeError):
                row.append('')

        print('\t'.join(str(x) for x in [hit.tag, *row]))
Example #4
0
 def get_db(self):
     if self._db is None:
         self._db = freezerbox.load_db()
     return self._db
Example #5
0
 def __bareinit__(self):
     self.db = freezerbox.load_db()
Example #6
0
args = docopt.docopt(__doc__)
p = stepwise.Protocol()

huh = stepwise.MasterMix.from_text("""\
Reagent      Stock    Volume  MM?
==========  ======  ========  ===
water               to 10 µL  yes
buffer         10x      1 µL  yes
dCas9-PCV2    1 µM      1 µL  yes
sgRNA         1 µM      1 µL  yes
EDTA        500 mM      1 µL
DNA         200 nM      5 µL
""")

db = freezerbox.load_db()

dna = args['<dna>']
dna_nM = min([round(db[x].conc_nM) for x in dna])

huh.num_reactions = int(args['--num-reactions'] or len(dna))
huh.extra_min_volume = '0.5 µL'

huh['buffer'].name = args['--buffer']
huh['dCas9-PCV2'].hold_conc.stock_conc = args['--cas9-stock-conc'], 'µM'
huh['sgRNA'].hold_conc.stock_conc = 10, 'µM'
huh['EDTA'].hold_stock_conc.conc = 30 / 2.5 * float(
    args['--buffer-divalent-conc']), 'mM'
huh['DNA'].hold_conc.stock_conc = dna_nM, 'nM'
huh['DNA'].name = ','.join(dna)
Example #7
0
def test_load_db_err(config, error):
    with error:
        load_db(config=config)
def test_ignore_external_freezerbox_db():
    import freezerbox
    db = freezerbox.load_db()
    assert db.name == "WARNING: ACCESSING EXTERNAL DATABASE"