Exemplo n.º 1
0
    def test_get_up_to_date_assembly_annotation_jobs_should_retrieve_all_jobs_in_priority_order(self):
        study = mgnify.create_study_obj(study_data)
        accessions = ['ERZ795049', 'ERZ795050']
        assemblies = []
        for accession in accessions:
            data = copy.deepcopy(assembly_data)
            data['analysis_accession'] = accession
            assemblies.append(mgnify.get_or_save_assembly(ena, accession, data, study))
        pipeline = Pipeline(version=4.1)
        pipeline.save()
        pipeline = Pipeline(version=5.0)
        pipeline.save()

        user = mgnify.create_user(user_data['webin_id'], user_data['email_address'],
                                  user_data['first_name'],
                                  user_data['surname'])
        request = mgnify.create_user_request(user, 0, 1)

        assert 0 == len(AnnotationJob.objects.all())

        mgnify.create_annotation_job(request, assemblies[0], 0, 4.1)
        mgnify.create_annotation_job(request, assemblies[1], 1)

        up_to_date_assemblies_latest = mgnify.get_up_to_date_assembly_annotation_jobs(
            study_data['secondary_study_accession'])
        assert 1 == len(up_to_date_assemblies_latest)

        up_to_date_assemblies_v4 = mgnify.get_up_to_date_assembly_annotation_jobs(
            study_data['secondary_study_accession'], 4.1)
        assert 1 == len(up_to_date_assemblies_v4)

        up_to_date_assemblies_v5 = mgnify.get_up_to_date_assembly_annotation_jobs(
            study_data['secondary_study_accession'], 5)
        assert 1 == len(up_to_date_assemblies_v5)
Exemplo n.º 2
0
def create_annotation_jobs_without_ena_services(rt_ticket=0, priority=0):
    study = mgnify.create_study_obj(study_data)
    run_accessions = ['ERR164407', 'ERR164408', 'ERR164409']

    for run_acc in run_accessions:
        run_data["run_accession"] = run_acc
        mgnify.create_run_obj(study, run_data)

    pipeline = Pipeline(version=4.1)
    pipeline.save()

    user = mgnify.create_user(user_data['webin_id'], user_data['email_address'],
                              user_data['first_name'],
                              user_data['surname'])
    request = mgnify.create_user_request(user, priority, rt_ticket)

    runs = []
    for run_acc in run_accessions:
        run = mgnify.get_backlog_run(run_acc)
        runs.append(run)
        mgnify.create_annotation_job(request, run, 4)
    return study, runs