Skip to content

Commit

Permalink
Merge pull request #117 from bioinfodlsu/input
Browse files Browse the repository at this point in the history
Sanitize browse loci input + Add coexpression node data div
  • Loading branch information
memgonzales authored Sep 12, 2023
2 parents b3d2a9d + a8872a9 commit 1d19771
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
6 changes: 5 additions & 1 deletion callbacks/browse_loci/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ def send_open_chromatin_panicle_url(filename):
)
def display_selected_genomic_intervals(nb_intervals_str, homepage_is_submitted, selected_nb_interval):
if homepage_is_submitted:
igv_options = nb_intervals_str.split(';')
igv_options = util.sanitize_nb_intervals_str(nb_intervals_str)
igv_options = igv_options.split(';')

if not selected_nb_interval:
selected_nb_interval = igv_options[0]
Expand Down Expand Up @@ -171,6 +172,9 @@ def display_igv(selected_nb_intervals_str, selected_tracks, homepage_is_submitte
display_tracks = [
track for track in track_info if selected_tracks and track['name'] in selected_tracks]

selected_nb_intervals_str = lift_over_util.to_genomic_interval(selected_nb_intervals_str)
selected_nb_intervals_str = str(selected_nb_intervals_str.chrom) + ':' + str(selected_nb_intervals_str.start) + '-' + str(selected_nb_intervals_str.stop)

return html.Div([
dashbio.Igv(
id='igv-Nipponbare-local',
Expand Down
4 changes: 3 additions & 1 deletion callbacks/browse_loci/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ def write_igv_tracks_to_file(nb_intervals_str):

def write_gff_igv_track_to_file(source_dir, source_file, nb_intervals_str):
if path_exists(source_dir):
loci_list = nb_intervals_str.split(';')
loci_list = util.sanitize_nb_intervals_str(nb_intervals_str)
loci_list = loci_list.split(';')

genomic_interval_list = util.get_genomic_intervals_from_input(
nb_intervals_str)

Expand Down
14 changes: 13 additions & 1 deletion callbacks/coexpression/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from ..lift_over import util as lift_over_util
from ..branch import *

import json

Input_parameter_module = namedtuple('Input_parameter_module', [
'param_slider_marks', 'param_slider_value'])

Expand Down Expand Up @@ -532,8 +534,18 @@ def download_coexpression_table_to_csv(download_n_clicks, coexpression_df, genom
State('coexpression-module-graph', 'elements'),
State('homepage-genomic-intervals-submitted-input', 'data')
)
def download_coexpression_table_to_csv(download_n_clicks, coexpression_dict, genomic_intervals):
def download_coexpression_graph_to_csv(download_n_clicks, coexpression_dict, genomic_intervals):
if download_n_clicks >= 1:
return dict(content='Hello world!', filename=f'[{genomic_intervals}] Co-Expression Network Analysis Graph.txt')

raise PreventUpdate

@app.callback(
Output('coexpression-module-graph-node-data', 'children'),
Input('coexpression-module-graph', 'tapNodeData')
)
def display_node_data(node_data):
if node_data:
return json.dumps(node_data)

raise PreventUpdate
2 changes: 2 additions & 0 deletions pages/analysis/co_expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,8 @@
]
),

html.Div(id='coexpression-module-graph-node-data', hidden=True),

dcc.Loading([
cyto.Cytoscape(
id='coexpression-module-graph',
Expand Down

0 comments on commit 1d19771

Please sign in to comment.