Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable button if there's ongoing computation in the analysis pages #106

Merged
merged 10 commits into from
Sep 4, 2023
13 changes: 12 additions & 1 deletion callbacks/coexpression/callbacks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from dash import Input, Output, State, html, dcc
from dash import Input, Output, State, html, dcc, ctx
from dash.exceptions import PreventUpdate
from collections import namedtuple

Expand Down Expand Up @@ -90,6 +90,17 @@ def display_coexpression_output(coexpression_is_submitted):

else:
return {'display': 'none'}

@app.callback(
Output('coexpression-submit', 'disabled'),

Input('coexpression-submit', 'n_clicks'),
Input('coexpression-module-graph', 'elements'),
Input('coexpression-pathways', 'data'),
Input('coexpression-module-stats', 'children')
)
def disable_coexpression_button_upon_run(n_clicks, *_):
return ctx.triggered_id == 'coexpression-submit' and n_clicks > 0

@app.callback(
Output('coexpression-parameter-slider', 'marks'),
Expand Down
12 changes: 11 additions & 1 deletion callbacks/lift_over/callbacks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from dash import Input, Output, State, dcc, html
from dash import Input, Output, State, dcc, html, ctx
from dash.exceptions import PreventUpdate

from .util import *
Expand Down Expand Up @@ -53,6 +53,16 @@ def display_lift_over_output(lift_over_is_submitted):
else:
return {'display': 'none'}

@app.callback(
Output('lift-over-submit', 'disabled'),

Input('lift-over-submit', 'n_clicks'),
Input('lift-over-results-table', 'data'),
Input('lift-over-results-statistics', 'children')
)
def disable_lift_over_button_upon_run(n_clicks, *_):
return ctx.triggered_id == 'lift-over-submit' and n_clicks > 0

@app.callback(
Output('lift-over-results-intro', 'children'),
Output('lift-over-results-tabs', 'children'),
Expand Down
8 changes: 8 additions & 0 deletions callbacks/lift_over/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
from ..general_util import *
from ..links_util import *

import regex as re


Genomic_interval = namedtuple('Genomic_interval', ['chrom', 'start', 'stop'])

Expand Down Expand Up @@ -122,6 +124,12 @@ def to_genomic_interval(genomic_interval_str):
if is_one_digit_chromosome(chrom):
chrom = pad_one_digit_chromosome(chrom)

# Change 'chr' to 'Chr'
chrom = re.sub(r'chr', 'Chr', chrom, flags=re.IGNORECASE)

if not chrom.startswith('Chr') or not chrom[3].isdigit():
return errors['NO_CHROM_INTERVAL_SEP'].code, genomic_interval_str

except ValueError:
return errors['NO_CHROM_INTERVAL_SEP'].code, genomic_interval_str

Expand Down
16 changes: 14 additions & 2 deletions callbacks/text_mining/callbacks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from dash import Input, Output, State, ctx, ALL, html, no_update
from dash import Input, Output, State, ctx, ALL, html, no_update, dcc
from dash.exceptions import PreventUpdate

from .util import *
Expand Down Expand Up @@ -92,7 +92,7 @@ def display_coexpression_output(text_mining_is_submitted):
State('text-mining-query', 'value'),
Input('text-mining-result-table', 'data'),
)
def trigger(n_clicks, text_mining_query, *_):
def disable_text_mining_button_upon_run(n_clicks, text_mining_query, *_):
is_there_error, _ = is_error(text_mining_query)

if is_there_error:
Expand Down Expand Up @@ -144,3 +144,15 @@ def display_text_mining_results(text_mining_is_submitted, homepage_submitted, te
)
def reset_table_filters(*_):
return ''

@app.callback(
Output('text-mining-download-df-to-csv', 'data'),
Input('text-mining-export-table', 'n_clicks'),
State('text-mining-result-table', 'data'),
)
def download_text_mining_table_to_csv(download_n_clicks, text_mining_df, ):
if download_n_clicks >= 1:
df = pd.DataFrame(text_mining_df)
return dcc.send_data_frame(df.to_csv, f'Text Mining Analysis Table.csv', index=False)

raise PreventUpdate
152 changes: 87 additions & 65 deletions pages/analysis/co_expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,73 +4,90 @@
from callbacks.constants import Constants
from callbacks.coexpression.util import *

# ============================
# Module Detection Algorithms
# ============================

coach = html.Li(
[html.B('COACH'),
html.Span(

coach = html.Li([
html.B('COACH'),
html.Span(
' Detects highly connected gene subnetworks (referred to as "cores") and expands them by including closely associated genes',
className='algo-desc'),
html.Div([
html.Span(
html.Div([
html.Span(
'Wu, M., Li, X., Kwoh, C. K., & Ng, S. K. (2009). A core-attachment based method to detect protein complexes in PPI networks. '),
html.I('BMC Bioinformatics, 10'),
html.Span('(169). '),
html.A('https://doi.org/10.1186/1471-2105-10-169',
href='https://doi.org/10.1186/1471-2105-10-169',
target='_blank')],
className='reference'
)]
)
html.I('BMC Bioinformatics, 10'),
html.Span('(169). '),
html.A(
'https://doi.org/10.1186/1471-2105-10-169',
href='https://doi.org/10.1186/1471-2105-10-169',
target='_blank')
], className='reference')
])

demon = html.Li(
[html.B('DEMON'),
html.Span(
demon = html.Li([
html.B('DEMON'),
html.Span(
' Adopts a bottom-up approach where genes "vote" to determine the subnetwork to which connected genes belong',
className='algo-desc'),
html.Div([
html.Span(
html.Div([
html.Span(
'Coscia, M., Rossetti, G., Giannotti, F., & Pedreschi, D. (2012). DEMON: A local-first discovery method for overlapping communities. In '),
html.I('KDD\'12: Proceedings of the 18th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining '),
html.Span('(pp. 615–623). Association for Computing Machinery. '),
html.A('https://doi.org/10.1145/2339530.2339630',
href='https://doi.org/10.1145/2339530.2339630',
target='_blank')],
className='reference'
)]
)
html.I('KDD\'12: Proceedings of the 18th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining '),
html.Span('(pp. 615–623). Association for Computing Machinery. '),
html.A(
'https://doi.org/10.1145/2339530.2339630',
href='https://doi.org/10.1145/2339530.2339630',
target='_blank')
], className='reference')
])

clusterone = html.Li(
[html.B('ClusterONE'),
html.Span(
clusterone = html.Li([
html.B('ClusterONE'),
html.Span(
' Forms cohesive gene subnetworks from an initial set of seed genes. ',
className='algo-desc'),
html.Div([
html.Span(
html.Div([
html.Span(
'Nepusz, T., Yu, H., & Paccanaro, A. (2012). Detecting overlapping protein complexes in protein-protein interaction networks. '),
html.I('Nature Methods, 9, '),
html.Span('471–472. '),
html.A('https://doi.org/10.1038/nmeth.1938',
href='https://doi.org/10.1038/nmeth.1938',
target='_blank')],
className='reference'
)],
)
html.I('Nature Methods, 9, '),
html.Span('471–472. '),
html.A(
'https://doi.org/10.1038/nmeth.1938',
href='https://doi.org/10.1038/nmeth.1938',
target='_blank')
], className='reference')
])

fox = html.Li([html.B('FOX'),
html.Span(
' Determines the membership of a gene to a subnetwork by counting the number of triangles formed by the gene with other genes in the subnetwork',
className='algo-desc'),
fox = html.Li([
html.B('FOX'),
html.Span(
' Determines the membership of a gene to a subnetwork by counting the number of triangles formed by the gene with other genes in the subnetwork',
className='algo-desc'),
html.Div([
html.Span(
'Lyu, T., Bing, L., Zhang, Z., & Zhang, Y. (2020). FOX: Fast overlapping community detection algorithm in big weighted networks. '),
'Lyu, T., Bing, L., Zhang, Z., & Zhang, Y. (2020). FOX: Fast overlapping community detection algorithm in big weighted networks. '),
html.I('ACM Transactions on Social Computing, 3'),
html.Span('(3), 1–23. '),
html.A('https://doi.org/10.1145/3404970',
href='https://doi.org/10.1145/3404970',
target='_blank')],
className='reference mb-3',
),
html.Span('RicePilaf uses LazyFox for a parallelized implementation of FOX')
html.A(
'https://doi.org/10.1145/3404970',
href='https://doi.org/10.1145/3404970',
target='_blank')
], className='reference mb-3'),
html.Span(
'RicePilaf uses LazyFox for a parallelized implementation of FOX. LazyFox is run with the queue size and thread count set to 20.',
className='algo-desc'),
html.Div([
html.Span(
'Garrels, T., Khodabakhsh, A., Renard, B. Y., & Baum, K. (2023). LazyFox: Fast and parallelized overlapping community detection in large graphs. '),
html.I('PeerJ Computer Science, 9, '),
html.Span('e1291. '),
html.A(
'https://doi.org/10.7717/peerj-cs.1291',
href='https://doi.org/10.7717/peerj-cs.1291',
target='_blank')
], className='reference mb-3')
])

module_detection_algo_modal = dbc.Modal([
Expand All @@ -86,13 +103,18 @@
])],
id='coexpression-clustering-algo-modal',
is_open=False,
size='xl'
size='xl',
scrollable=True
)

# ======================
# Coexpression Networks
# ======================


coexpression_network_modal = dbc.Modal([
dbc.ModalHeader(
dbc.ModalTitle('Module Detection Algorithms')
dbc.ModalTitle('Coexpression Networks')
),
dbc.ModalBody([
html.P(
Expand Down Expand Up @@ -123,19 +145,19 @@
html.Div([
html.P(
[
'In this page, you can search for modules (a.k.a. communities, clusters) in rice co-expression networks, '
'which are significantly enriched in the genes implicated by your GWAS. '
'Likely functions of the modules are inferred by enrichment analysis against several ontologies and pathway databases. Click ',
dcc.Link(
['here ', html.I(
id='demo-link',
className='fa-solid fa-up-right-from-square fa-2xs'
)],
href='https://github.com/bioinfodlsu/rice-pilaf/wiki/2.3-Co%E2%80%90expression-Network-Analysis',
target='_blank',
className='top-navbar-item'
),
' for user guide.'
'In this page, you can search for modules (a.k.a. communities, clusters) in rice co-expression networks, '
'which are significantly enriched in the genes implicated by your GWAS. '
'Likely functions of the modules are inferred by enrichment analysis against several ontologies and pathway databases. Click ',
dcc.Link(
['here ', html.I(
id='demo-link',
className='fa-solid fa-up-right-from-square fa-2xs'
)],
href='https://github.com/bioinfodlsu/rice-pilaf/wiki/2.3-Co%E2%80%90expression-Network-Analysis',
target='_blank',
className='top-navbar-item'
),
' for user guide.'

]
)
Expand Down
19 changes: 9 additions & 10 deletions pages/homepage.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,14 @@
html.Span('Enter genomic intervals like so: '), html.Span(
'Chr01:100000-200000', className='text-muted'),
html.Br(),
html.Span(
'Multiple intervals should be separated by a semicolon like so: '),
html.Span('Chr01:100000-200000;Chr02:300000-400000',
className='text-muted'),
html.Br(),
html.Span(
html.P([
html.Span(
'Multiple intervals should be separated by a semicolon like so: '),
html.Span('Chr01:100000-200000;Chr02:300000-400000',
className='text-muted')
]),
html.P(
'These intervals are obtained from LD-based clumping of significant GWAS SNPs or from QTL mapping studies.'),
html.Br(),
html.Br(),

html.P(
'We also provide some sample genomic intervals, taken from the following GWAS/QTL analyses:'),
html.Ul([
Expand Down Expand Up @@ -65,7 +63,8 @@
])],
id='genomic-interval-modal',
is_open=False,
size='xl'
size='xl',
scrollable=True
)

# ======
Expand Down