Exemplo n.º 1
0
def modelStats(request):
    user = request.authenticated_userid

    return {
        'numModels': Models.numModels(),
        'correctModels': Models.numCorrectModels(),
        'user': user
    }
Exemplo n.º 2
0
def checkForMoreJobs(task):
    txn = db.getTxn()
    problem = task['problem']
    modelSums = db.ModelSummaries(task['user'], task['hub'], task['track'],
                                  problem['chrom'],
                                  problem['chromStart']).get(txn=txn,
                                                             write=True)
    Models.checkGenerateModels(modelSums, problem, task, txn=txn)
    txn.commit()
Exemplo n.º 3
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()
Exemplo n.º 4
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()
Exemplo n.º 5
0
def submitPregenWithData(doPregen, user, hub, track, coverageUrl, txn=None):
    recs = doPregen.to_dict('records')
    for problem in recs:
        penalties = Models.getPrePenalties()
        job = Jobs.PregenJob(user,
                             hub,
                             track['track'],
                             problem,
                             penalties,
                             trackUrl=coverageUrl)

        job.putNewJob(checkExists=False)
Exemplo n.º 6
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
Exemplo n.º 7
0
def stats(request):
    numLabeledChroms, numLabels = Labels.stats()
    currentJobStats = Jobs.stats()

    user = request.authenticated_userid

    return {
        'numModels': Models.numModels(),
        'numLabeledChroms': numLabeledChroms,
        'numLabels': numLabels,
        'numJobs': currentJobStats['numJobs'],
        'newJobs': currentJobStats['newJobs'],
        'queuedJobs': currentJobStats['queuedJobs'],
        'processingJobs': currentJobStats['processingJobs'],
        'doneJobs': currentJobStats['doneJobs'],
        'avgTime': currentJobStats['avgTime'],
        'user': user
    }