diff --git a/planet/controllers/admin/controls.py b/planet/controllers/admin/controls.py index be62f11..1cf9d1a 100644 --- a/planet/controllers/admin/controls.py +++ b/planet/controllers/admin/controls.py @@ -746,6 +746,20 @@ def calculate_enrichment(): return redirect(url_for('admin.controls.index')) +@admin_controls.route('/delete_enrichment') +@login_required +def delete_enrichment(): + """ + Controller to delete all existing GO enrichments + + :return: Redirect to admin main screen + """ + CoexpressionCluster.delete_enrichment() + + flash('Successfully removed GO enrichment for co-expression clusters', 'success') + return redirect(url_for('admin.controls.index')) + + @admin_controls.route('/calculate_cluster_similarity/') @login_required def calculate_cluster_similarity(gf_method_id): diff --git a/planet/models/expression/coexpression_clusters.py b/planet/models/expression/coexpression_clusters.py index 95366fa..83aa0f2 100644 --- a/planet/models/expression/coexpression_clusters.py +++ b/planet/models/expression/coexpression_clusters.py @@ -389,6 +389,20 @@ def calculate_enrichment(empty=True): # print(i, "\t cluster: ", cluster.method_id, cluster.name) cluster.__calculate_enrichment() + @staticmethod + def delete_enrichment(): + """ + Removes all GO enrichment data from the database + + :return: + """ + try: + db.session.query(ClusterGOEnrichment).delete() + db.session.commit() + except Exception as e: + db.session.rollback() + print(e) + @staticmethod @benchmark def calculate_similarities(gene_family_method_id=1, percentile_pass=0.95): diff --git a/planet/templates/admin/controls.html b/planet/templates/admin/controls.html index 35a769e..8f99f9d 100644 --- a/planet/templates/admin/controls.html +++ b/planet/templates/admin/controls.html @@ -15,9 +15,8 @@

Update

Co-expression clusters

-
- GO enrichment -
+Note: Calculating the GO enrichment will remove previous calculations from the database ! +GO enrichment Delete enrichment

Cluster Similarities