Skip to content


Browse files Browse the repository at this point in the history
groundwork clade enrichment
  • Loading branch information
proost committed Nov 23, 2017
1 parent fc2f053 commit 45befec
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 100 deletions.
24 changes: 22 additions & 2 deletions conekt/controllers/admin/controls/
@@ -1,13 +1,14 @@
import json

from flask import flash, url_for, request
from flask import flash, url_for, request, Markup
from conekt.extensions import admin_required
from werkzeug.exceptions import abort
from werkzeug.utils import redirect

from conekt.controllers.admin.controls import admin_controls
from conekt.forms.admin.add_clades import AddCladesForm
from conekt.models.clades import Clade
from conekt.models.expression.coexpression_clusters import CoexpressionCluster

Expand Down Expand Up @@ -52,4 +53,23 @@ def add_clades():
flash('Unable to validate data, potentially missing fields', 'danger')
return redirect(url_for('admin.index'))

def calculate_clade_enrichment(gf_method_id):
Controller to start GO enrichment calculations
:return: Redirect to admin main screen
except Exception as e:
flash(Markup('An error occurred! Please ensure the file is <strong>correctly formatted</strong>' +
' and <strong>update the counts</strong> if necessary'), 'warning')
flash('Successfully calculated clade enrichment for co-expression clusters', 'success')

return redirect(url_for('admin.controls.index'))
2 changes: 1 addition & 1 deletion conekt/controllers/admin/views/
Expand Up @@ -22,7 +22,7 @@ class CoexpressionClusteringMethodAdminView(MyModelView):

class ClusterSimilaritiesView(AdminBaseView):
Control panel for administrators. Contains links to
Control panel for administrators. Contains links to start computing cluster similarities
def index(self):
Expand Down
23 changes: 23 additions & 0 deletions conekt/models/expression/
Expand Up @@ -16,6 +16,7 @@
from conekt.models.relationships.sequence_family import SequenceFamilyAssociation
from conekt.models.relationships.sequence_go import SequenceGOAssociation
from conekt.models.relationships.cluster_go import ClusterGOEnrichment
from conekt.models.relationships.cluster_clade import ClusterCladeEnrichment
from conekt.models.sequences import Sequence
from conekt.models.expression.profiles import ExpressionProfile

Expand Down Expand Up @@ -472,6 +473,28 @@ def calculate_enrichment(empty=True):
# print(i, "\t cluster: ", cluster.method_id,

def calculate_clade_enrichment(gene_family_method_id, empty=True):
Calculates clade enrichment for co-expression clusters
:param gene_family_method_id:
:param empty:
if empty:
except Exception as e:

# get background distribution

# calculate enrichment

def delete_enrichment():
Expand Down
4 changes: 3 additions & 1 deletion conekt/models/relationships/
Expand Up @@ -78,5 +78,7 @@
cluster_clade_enrichment = db.Table('cluster_clade_enrichment',
db.Column('id', db.Integer, primary_key=True),
db.Column('cluster_id', db.Integer, db.ForeignKey(''), index=True),
db.Column('clade_id', db.Integer, db.ForeignKey(''), index=True)
db.Column('clade_id', db.Integer, db.ForeignKey(''), index=True),
db.Column('gene_family_methods_id', db.Integer,
db.ForeignKey(''), index=True)
2 changes: 2 additions & 0 deletions conekt/models/relationships/
Expand Up @@ -9,6 +9,8 @@ class ClusterCladeEnrichment(db.Model):
cluster_id = db.Column(db.Integer, db.ForeignKey('', ondelete='CASCADE'))
clade_id = db.Column(db.Integer, db.ForeignKey('', ondelete='CASCADE'))

gene_family_methods_id = db.Column(db.Integer, db.ForeignKey('', ondelete='CASCADE'))

cluster = db.relationship('CoexpressionCluster', backref=db.backref('clade_enrichment',
Expand Down
4 changes: 0 additions & 4 deletions docs/
Expand Up @@ -171,8 +171,4 @@ data and add everything to the database.

### Computing enrichments, similarities, and counts ...


## Using the build script

92 changes: 0 additions & 92 deletions migrations/versions/

This file was deleted.

0 comments on commit 45befec

Please sign in to comment.