2eaf153a2692e3b848b565fd7637ede585390d32,workers/data_refinery_workers/processors/management/commands/remove_invalid_qn_targets.py,,remove_invalid_qn_targets,#Any#Any#,28

Before Change


        .order_by("-created_at")
    qn_target_ids = []
    for annotation in computational_result_annotations:
        organism = Organism.objects.get(id=annotation.data.organism_id)
        if not organism_can_have_qn_target(organism, min_samples):
            // remove the referenced QN Target because it shouldn"t have a qn target
            logger.debug("Removing QN Target because it does not have enough samples on its biggest microarray platform",
                         computational_result=annotation.result,

After Change


def remove_invalid_qn_targets(min_samples, dry_run):
    qn_target_ids = []

    for organism in Organism.object.filter(qn_target__isnull=False):
        if not organism_can_have_qn_target(organism, min_samples):
            // Remove all qn targets associated with this object
            qn_target_ids += ComputationalResultAnnotation.objects\
                                .filter(data__is_qn=True, organism_id=organism.id)\
                                .values_list("result__id", flat=True)
            logger.debug("Remove all QN targets for organism", organism=organism)

    if not dry_run:
        // delete all invalid qn targets
        qn_targets = ComputationalResult.objects.filter(id__in=qn_target_ids)
        for qn_target in qn_targets:
            qn_target.remove_from_s3()

        ComputationalResult.objects.filter(id__in=qn_target_ids).delete()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: AlexsLemonade/refinebio
Commit Name: 2eaf153a2692e3b848b565fd7637ede585390d32
Time: 2019-10-16
Author: arielsvn@gmail.com
File Name: workers/data_refinery_workers/processors/management/commands/remove_invalid_qn_targets.py
Class Name:
Method Name: remove_invalid_qn_targets


Project Name: AlexsLemonade/refinebio
Commit Name: ce380e58d567ff1966eed4a5c144b29f80759773
Time: 2017-06-02
Author: kurt.wheeler91@gmail.com
File Name: workers/data_refinery_workers/processors/utils.py
Class Name:
Method Name: start_job


Project Name: chakki-works/doccano
Commit Name: adb852f0e78dfbc8664417a6cd314821fefab917
Time: 2018-05-15
Author: light.tree.1.13@gmail.com
File Name: doccano/app/server/views.py
Class Name: AnnotationAPIView
Method Name: get