def update_mlps(**kwargs): print('Updating MLPs...') tasks = [] for lg in models.LocusGroup.objects.all(): for exp_type in models.ExperimentType.objects.all(): if models.Dataset.objects.filter( assembly=lg.assembly, experiment__experiment_type=exp_type, experiment__project__name='ENCODE', experiment__processed=True, experiment__revoked=False, processed=True, revoked=False, ).count() >= 20: nn = models.NeuralNetwork.objects.get_or_create( locus_group=lg, experiment_type=exp_type, metadata_field='cell_type', )[0] tasks.append(fit_neural_network.si(nn.pk)) nn = models.NeuralNetwork.objects.get_or_create( locus_group=lg, experiment_type=exp_type, metadata_field='target', )[0] tasks.append(fit_neural_network.si(nn.pk)) run_tasks(tasks, group_async=True) print('Done.')
def update_dendrograms(**kwargs): print('Updating dendrograms...') tasks = [] for org in models.Organism.objects.all(): for exp_type in models.ExperimentType.objects.all(): experiments = models.Experiment.objects.filter( organism=org, experiment_type=exp_type) if experiments.exists(): tasks.append(call_update_dendrogram.si(org.pk, exp_type.pk)) for my_user in models.MyUser.objects.all(): if experiments.filter(owners=my_user).exists(): tasks.append( call_update_dendrogram.si(org.pk, exp_type.pk, my_user_pk=my_user.pk)) run_tasks(tasks, group_async=True) print('Done.')
def update_networks(**kwargs): print('Updating network graphs...') tasks = [] for org in models.Organism.objects.all(): for exp_type in models.ExperimentType.objects.all(): experiments = models.Experiment.objects.filter( dataset__assembly__organism=org, experiment_type=exp_type, ) if experiments.exists(): tasks.append(update_organism_network.si(org.pk, exp_type.pk)) for my_user in models.MyUser.objects.all(): if experiments.filter(owners=my_user).exists(): tasks.append( update_organism_network.si(org.pk, exp_type.pk, my_user_pk=my_user.pk)) run_tasks(tasks, group_async=True) print('Done.')
def update_similarities(objects, sims_df, update_task, **kwargs): tasks = [] for obj in objects: row = sims_df[obj.pk] other_obj_pks = list([int(val) for val in row.index]) sims = list([bool(val) for val in row]) tasks.append(update_task.si(obj.pk, other_obj_pks, sims)) run_tasks(tasks, **kwargs)
def update_predictions(**kwargs): print('Updating dataset predictions...') tasks = [] for ds in models.Dataset.objects.all(): tasks.append(predict_dataset_fields.si(ds.pk)) run_tasks(tasks, group_async=True) print('Done.')
def update_transcript_selections(**kwargs): print('Updating transcript selections...') tasks = [] annotations = models.Annotation.objects.filter( gene__isnull=False).distinct() for annotation in annotations: tasks.append(_set_selected_transcripts_for_genes.si(annotation.pk)) run_tasks(tasks, group_async=True) print('Done.')
def update_normalized_read_coverage(**kwargs): print('Updating normalized read coverage...') tasks = [] dataset_intersections = models.DatasetIntersectionJson.objects.filter( dataset__processed=True).distinct() for dij in dataset_intersections: tasks.append(_normalize_dataset_intersections.si(dij.pk)) run_tasks(tasks, group_async=True) print('Done.')
def update_feature_values(**kwargs): print('Updating feature values...') tasks = [] for dataset in models.Dataset.objects.all(): for locus_group in models.LocusGroup.objects.filter( assembly=dataset.assembly): tasks.append( update_or_create_feature_values.si(dataset.pk, locus_group.pk)) run_tasks(tasks, group_async=True) print('Done.')
def update_pcas(**kwargs): print('Updating PCAs...') tasks = [] for lg in models.LocusGroup.objects.all(): for exp_type in models.ExperimentType.objects.all(): if models.Dataset.objects.filter( assembly=lg.assembly, experiment__experiment_type=exp_type, ).count() >= 3: # Verify that there are at least 3 datasets tasks.append(call_update_pca.si(lg.pk, exp_type.pk)) run_tasks(tasks, group_async=True) print('Done.')
def update_feature_attributes(**kwargs): print('Updating feature attributes...') tasks = [] for locus_group in models.LocusGroup.objects.all(): for experiment_type in models.ExperimentType.objects.all(): if models.Dataset.objects.filter( assembly=locus_group.assembly, experiment__experiment_type=experiment_type, experiment__project__isnull=False, ).exists(): tasks.append( update_or_create_feature_attributes.si( locus_group.pk, experiment_type.pk)) run_tasks(tasks, group_async=True) print('Done.')
def update_experiment_list_recommendations(experiments, **kwargs): tasks = [] for exp in experiments: tasks.append(update_experiment_recommendations.si(exp.pk, **kwargs)) run_tasks(tasks, **kwargs)