Пример #1
0
def removeLabel(data):
    toRemove = pd.Series({
        'chrom': data['ref'],
        'chromStart': data['start'],
        'chromEnd': data['end']
    })

    txn = db.getTxn()
    labels = db.Labels(data['user'], data['hub'], data['track'], data['ref'])
    removed, after = labels.remove(toRemove, txn=txn)
    db.Prediction('changes').increment(txn=txn)
    Models.updateAllModelLabels(data, after)
    txn.commit()
    return removed.to_dict()
Пример #2
0
def updateLabel(data):
    label = data['label']

    updateLabel = pd.Series({
        'chrom': data['ref'],
        'chromStart': data['start'],
        'chromEnd': data['end'],
        'annotation': label
    })
    txn = db.getTxn()
    labelDb = db.Labels(data['user'], data['hub'], data['track'], data['ref'])
    item, labels = labelDb.add(updateLabel, txn=txn)
    db.Prediction('changes').increment(txn=txn)
    Models.updateAllModelLabels(data, labels)
    txn.commit()
    return item.to_dict()
Пример #3
0
def addLabel(data):
    label = 'unknown'
    for i in range(100):
        print("#################################################")
    print("THIS IS THE DATA", data)
    for i in range(10):
        print("#################################################")

    # Duplicated because calls from updateLabel are causing freezing
    newLabel = pd.Series({
        'chrom': data['ref'],
        'chromStart': data['start'],
        'chromEnd': data['end'],
        'annotation': label
    })

    txn = db.getTxn()
    item, labels = db.Labels(data['user'], data['hub'], data['track'],
                             data['ref']).add(newLabel, txn=txn)
    db.Prediction('changes').increment(txn=txn)
    Models.updateAllModelLabels(data, labels)
    txn.commit()
    return data