Skip to content

Commit

Permalink
Merge pull request #35 from TheJacksonLaboratory/G3-544-gene-count-in…
Browse files Browse the repository at this point in the history
…-threshold-issue

G3-544 fix to gene counts within threshold
  • Loading branch information
francastell authored Jan 6, 2025
2 parents d254b69 + ab4dff1 commit 7ce2d5c
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "geneweaver-legacy"
version = "1.5.7"
version = "1.5.8"
description = ""
authors = ["Alexander Berger <[email protected]>"]
readme = "README.md"
Expand Down
6 changes: 3 additions & 3 deletions src/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(',')
Expand Down Expand Up @@ -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])]
Expand Down
22 changes: 22 additions & 0 deletions src/geneweaverdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 5 additions & 3 deletions src/templates/viewgenesetdetails.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,11 @@ <h3 class="panel-title">Gene List &bull; {{ totalGenes }} Genes</h3>
<div class="panel-body" style="padding-top:10px;">
<div class="row">
<div class="col-xs-12 col-md-9">
<div class="row">
<p>Genes in threshold: {{ num_genes_in_threshold }}</p>
</div>
{% if geneset.threshold_type != 3 %}
<div class="row">
<p>Genes in threshold: {{ num_genes_in_threshold }}</p>
</div>
{% endif %}
</div>
<div class="col-xs-6 col-md-3" style="margin:0; padding:0;">
{% if g.user is defined and not curation_view %}
Expand Down

0 comments on commit 7ce2d5c

Please sign in to comment.