Esempio n. 1
0
from models import (
    User,
    DataStore,
)

user = User('*****@*****.**', 'weakpass')
ds = DataStore()


def test_default_attributes():
    assert user.id is not None
    assert user.created is not None
    assert user.modified is not None


def test_user_create():
    """ It should create a new user """
    email = '*****@*****.**'
    passw = 'lympass'
    users = ds.storage.get('users')
    if users is None:
        len_before = 0
    else:
        len_before = len(users)

    ds.create_user(first_name='Tom',
                   last_name='Riddle',
                   email=email,
                   password=passw)

    len_after = ds.storage.get('users').__len__()
Esempio n. 2
0
import pymongo
import time
from optparse import OptionParser

from models import DataStore

start_time = time.time()

parser = OptionParser()
parser.add_option("-s",
                  "--rsid",
                  dest="rsid",
                  help="rsid, eg rs7412",
                  metavar="STRING")
(options, args) = parser.parse_args()

connection = pymongo.MongoClient("mongodb://localhost")
db = connection.metadata

ds = DataStore(db, 'affy')

print "STUDY NAME", ds.get_studyname()
marker_data = ds.get_marker_summary_probs(options.rsid)
print marker_data["TOTALS"]
connection.close()

print "END:", time.time() - start_time, "seconds"
Esempio n. 3
0
            except:
                push_result = bitcoin.blockr_pushtx(tx)
            tx_total = sum(out.get('value') for out in outs)

            # This address has been successfully spent from, update tx info and don't check it again.
            address_info.spent = True
            address_info.spending_tx = tx_hash
            address_info.donation_amount = tx_total

            # Keep a total of all bitcoins tipped
            total_donated = DataStore.query.filter_by(
                key='total_donated').first()
            if total_donated:
                total_donated.value = int(int(total_donated.value) + tx_total)
            else:
                total_donated = DataStore('total_donated', tx_total)
                db.session.add(total_donated)
            db.session.commit()

            app.logger.info(
                'Transaction successfully sent {} satoshi from {} in tx {}.'.
                format(tx_total, address, tx_hash))
            return {
                'status': 'success',
                'data': {
                    'message':
                    '<strong>Success!</strong> Your transaction was received and forwarded to your selected relays. '
                    '<a target="_blank" href="https://blockchain.info/tx/' +
                    tx_hash + '">' + tx_hash[0:10] + '..</a>',
                    'tx_hash':
                    tx_hash
Esempio n. 4
0
# execution flow starts here
#
parser = OptionParser()
parser.add_option("-f",
                  "--filename",
                  dest="filename",
                  help="rsid file",
                  metavar="STR")
(options, args) = parser.parse_args()

connection = pymongo.MongoClient("mongodb://localhost")
db = connection.genomicsdb_test
#db = connection.gwas_metadata

ds = DataStore(db, "genomicsdb_test", "bpf", False)
start_time = time.time()
calls = ["0/0", "0/1", "1/1", "Missing"]
icalls = [0, 1, 2, -9]


def get_call(probs, threshold):
    max_prob = 0.0
    max_idx = 3

    #print "Probs:", probs
    for idx, prob in enumerate(probs):
        if float(prob) > max_prob:
            max_prob = float(prob)
            max_idx = idx
Esempio n. 5
0
from zipfile import ZIP_DEFLATED
from optparse import OptionParser

from models import DataStore

# execution flow starts here
#
parser = OptionParser()
parser.add_option("-r", "--rsid", dest="rsid", help="rsid id", metavar="STR")
(options, args) = parser.parse_args()

connection = pymongo.MongoClient("mongodb://localhost")
db = connection.genomicsdb_test
#db = connection.gwas_metadata

ds = DataStore(db, "genomicsdb_test", "akh", False)
start_time = time.time()
calls = ["0/0", "0/1", "1/1", "Missing"]
icalls = [0, 1, 2, -9]


def get_call(probs, threshold):
    max_prob = 0.0
    max_idx = 3

    #print "Probs:", probs
    for idx, prob in enumerate(probs):
        if float(prob) > max_prob:
            max_prob = float(prob)
            max_idx = idx
Esempio n. 6
0
import pymongo
import time
from zipfile import ZipFile
from zipfile import ZIP_DEFLATED
from optparse import OptionParser

from models import DataStore


# execution flow starts here
#
parser = OptionParser()
parser.add_option("-r", "--rsid", dest="rsid",
    help="dbSNP rsid", metavar="STR")
parser.add_option("-p", "--prochi", dest="prochi",
    help="prochi", metavar="STR")
(options, args) = parser.parse_args()

connection = pymongo.MongoClient("mongodb://localhost")
db = connection.gwas_metadata_2
#db = connection.gwas_metadata

ds = DataStore(db, 'akh')
start_time = time.time()

ds.get_rsid_prochi_data(options.rsid, options.prochi, 0.9, "csv_calls")
connection.close()

print "END:", time.time() - start_time, "seconds"