diff --git a/pyproject.toml b/pyproject.toml index a3d493b0..3cc1f4a7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "geneweaver-legacy" -version = "1.5.7" +version = "1.5.8" description = "" authors = ["Alexander Berger "] readme = "README.md" diff --git a/src/application.py b/src/application.py index e46f15ba..3a0a5969 100644 --- a/src/application.py +++ b/src/application.py @@ -1968,7 +1968,7 @@ def render_set_threshold(gs_id): view = None # Determine if this is bi-modal, we won't display these is_bimodal = geneweaverdb.get_bimodal_threshold(gs_id) - gsv_values = geneweaverdb.get_all_geneset_values(gs_id) + gsv_values = geneweaverdb.get_all_geneset_values_by_gdb_id(gs_id) threshold_type = geneset.threshold_type threshold = str(geneset.threshold) thresh = threshold.split(',') @@ -2804,9 +2804,9 @@ def render_viewgeneset_main(gs_id, curation_view=None, curation_team=None, curat threshold_type = geneset.threshold_type curr_threshold = threshold.split(',') - gsv_values = geneweaverdb.get_all_geneset_values(gs_id) + gsv_values = geneweaverdb.get_all_geneset_values_by_gdb_id(gs_id) # get genes count for the current threshold - num_genes_in_threshold = 0; + num_genes_in_threshold = 0 if threshold_type == 1 or threshold_type == 2: gene_counts = calc_genes_count_in_threshold(gsv_values, curr_threshold) num_genes_in_threshold = num_genes_in_threshold if curr_threshold[0] == 'None' else gene_counts[float(curr_threshold[0])] diff --git a/src/geneweaverdb.py b/src/geneweaverdb.py index e91cc62a..c0cd9762 100644 --- a/src/geneweaverdb.py +++ b/src/geneweaverdb.py @@ -4273,6 +4273,28 @@ def get_all_geneset_values(gs_id): g.ode_pref='t' ORDER BY gv.gsv_value ASC''', (gs_id,)) return list(dictify_cursor(cursor)) if cursor.rowcount != 0 else None +def get_all_geneset_values_by_gdb_id(gs_id, gdb_id=7): + ''' + Generic function to get all geneset values geneset_value.gs_values + :param geneset_id: geneset id + :param gdb_id: gdb id -- default is 7 + + :return: + ''' + user_id = flask.session['user_id'] + geneset = get_geneset(gs_id, user_id) + with PooledCursor() as cursor: + if geneset.gene_id_type < 0: + cursor.execute('''SELECT gv.gsv_value as gsv, g.ode_ref_id as ref FROM geneset_value gv, gene g, geneset gs WHERE + g.ode_pref='t' AND gv.gs_id=%s AND gs.gs_id=gv.gs_id AND gs.sp_id=g.sp_id AND + gv.ode_gene_id=g.ode_gene_id AND g.gdb_id=%s ORDER BY gv.gsv_value ASC''', (gs_id, gdb_id,)) + else: + cursor.execute('''SELECT gv.gsv_value, g.ode_ref_id FROM geneset_value gv, gene g, geneset gs WHERE + gv.gs_id=%s AND gs.gs_id=gv.gs_id AND gs.sp_id=g.sp_id AND gv.ode_gene_id=g.ode_gene_id AND + g.ode_pref='t' AND g.gdb_id=%s ORDER BY gv.gsv_value ASC''', (gs_id, gdb_id,)) + return list(dictify_cursor(cursor)) if cursor.rowcount != 0 else None + + def get_species_homologs(hom_id): """ Uses a given homology ID to return a list of homologous species. diff --git a/src/templates/viewgenesetdetails.html b/src/templates/viewgenesetdetails.html index fab80879..b193051a 100644 --- a/src/templates/viewgenesetdetails.html +++ b/src/templates/viewgenesetdetails.html @@ -114,9 +114,11 @@

Gene List • {{ totalGenes }} Genes

-
-

Genes in threshold: {{ num_genes_in_threshold }}

-
+ {% if geneset.threshold_type != 3 %} +
+

Genes in threshold: {{ num_genes_in_threshold }}

+
+ {% endif %}
{% if g.user is defined and not curation_view %}