Skip to content

Commit

Permalink
Added more templated quieries
Browse files Browse the repository at this point in the history
  • Loading branch information
wumirose committed Sep 26, 2024
1 parent c6dbdc2 commit 330be79
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 40 deletions.
54 changes: 26 additions & 28 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,8 @@
)

server = app.server


robokop_link = html.A(
id = "robokop-link",
children=html.Img(src='/assets/robokop.png',style={'height':'2em','width':'6em','padding-left':'1em'}),
href='https://robokop.renci.org/',
target='_blank',
rel='noopener noreferrer')

app.title = 'EDGAR'
app._favicon = 'Logo.ico'

colors = {'background': 'white', 'background': '#7794B8', 'dropdown': '#6c6f73', 'text': '#000000'}

Expand Down Expand Up @@ -108,25 +101,30 @@ def resolvename(name):
),
html.Br(),
html.Div([
html.Div(
html.Article([
"This research explores pathway enrichment strategies in biomedical Knowledge Graphs (KGs) as a versatile link-prediction approach, with drug repurposing exemplifying a significant application. Leveraging systems biology, network expression analysis, pathway analysis (PA), and machine learning (ML) methods, KGs aid in uncovering novel interactions among biomedical entities of interest. ",
html.P(),
"While these approaches excel in inferring missing edges within the KG, PA may overlook candidates with similar pathway effects. ",
html.P(),
"By utilizing enrichment-driven analyses on KG data from ROBOKOP, our EDGAR paper applied this method on Alzheimer's disease case study, demonstrating the efficacy of enrichment strategies in linking entities for drug repurposing. Our approach is validated through literature-based evidence derived from clinical trials, showcasing the potential of enrichment-driven strategies in linking biomedical entities."
],
style={'font-size': '20px'}
)
),
html.Br(),
html.Div(
robokop_link
html.Div(
html.Article([
"Leveraging systems biology, network expression analysis, pathway analysis (PA), rule learning and machine learning (ML) methods, KGs aid in uncovering novel interactions among biomedical entities of interest. ",
"While these approaches excel in inferring missing edges within the KG, they may overlook candidates with similar pathway effects. ",
html.P(),
"This research explores pathway enrichment strategies in biomedical Knowledge Graphs (KGs) as a versatile link-prediction approach, with drug repurposing exemplifying a significant application in the paper. ",
html.P(),
"By utilizing enrichment-driven analyses on KG data from ",
html.A(
"ROBOKOP",
href='https://robokop.renci.org/',
target='_blank',
rel='noopener noreferrer',
style={'color': 'blue', 'text-decoration': 'underline'}
),
", our EDGAR paper demonstrates the efficacy of enrichment strategies in linking entities for drug repurposing. Our approach is validated through literature-based evidence derived from clinical trials, showcasing the potential of enrichment-driven strategies in linking biomedical entities."
],
style={'font-size': '20px'}
)

],
style={'background-color': 'whitesmoke', 'display': 'flex', 'flex-direction': 'row',
'align-items': 'center', 'justify-content': 'center'}
),
html.Br(),
],
style={'background-color': 'whitesmoke', 'display': 'flex', 'flex-direction': 'row',
'align-items': 'center', 'justify-content': 'center'}
),
], className="p-3 bg-body-secondary rounded-3")

Expand Down Expand Up @@ -242,4 +240,4 @@ def normalizeterm(searchterm, click):

#### Visualize the Output ######
if __name__ == "__main__":
app.run_server(debug=False)
app.run_server(debug=True)
3 changes: 2 additions & 1 deletion assets/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@900&display=swap');

@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@900&display=swap');




body {
margin: 0;
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ PyYAML==6.0.1
requests==2.32.3
setuptools==71.0.4
urllib3==2.2.2
aiohttp==3.10.1
aiohttp~=3.10.1
gunicorn

26 changes: 20 additions & 6 deletions src/edgar_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
request_in_progress = False
response_status = 0
tk = bmt.Toolkit()
AC_URL = "https://answercoalesce-test.apps.renci.org/query"
AC_URL = "https://answercoalesce.renci.org/query"
all_node_classes = tk.get_all_classes('entity')


Expand Down Expand Up @@ -166,12 +166,16 @@ def send_post_request(data):
dcc.Dropdown(
id="example-query-dropdown",
options=[
{'label': "What Drugs treats Disease Y?",
{'label': "What Drugs treats Disease Y eg. MONDO:0004975?",
'value': "biolink:Drug-biolink:treats-biolink:Disease"},
{'label': "What Genes is associated with Disease X?",
'value': "biolink:Gene-biolink:associated_with-biolink:Disease"},
{'label': "What are the Biological Process and Molecular Activities that affects Genes X?",
'value': "biolink:BioProcessOrActivity-biolink:affects-biolink:Gene"}
{'label': "What Genes are genetically associated with Disease X eg. DOID:0050430?",
'value': "biolink:Gene-biolink:genetically_associated_with-biolink:Disease"},
{'label': "What are the Phenotypes of Disease X eg. MONDO:0005147?",
'value': "biolink:Disease-biolink:has_phenotype-biolink:PhenotypicFeature"},
{'label': "What are the Genes that affects Phenotype X eg. HP:0003637?",
'value': "biolink:Gene-biolink:affects-biolink:PhenotypicFeature"},
{'label': "What are the Phenotypes of Gene X eg. NCBIGene:122481?",
'value': "biolink:Gene-biolink:has_phenotype-biolink:PhenotypicFeature"}
],
value=None,
placeholder='Select an example query pattern...optional',
Expand Down Expand Up @@ -409,3 +413,13 @@ def visualize_data(store_data, visualize_nclicks):
return vizlayout(store_data)
return ""


@callback(
Output('output-data', 'children', allow_duplicate=True),
[Input('example-query-dropdown', 'value'),
Input('source_dropdown', 'value'),
Input('predicate_dropdown', 'value'),
Input('target_dropdown', 'value')]
)
def update_output(selected_query, source_value, predicate_value, target_value):
return f'Selected Query: {selected_query}, Source: {source_value}, Predicate: {predicate_value}, Target: {target_value}'
22 changes: 18 additions & 4 deletions src/visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@ def pickgroup2curieedge(enrichment2group_edge, group2curie_edge, kg_nodes, kg_ed
terminals = [group2curie_edge['subject'], group2curie_edge['object']]
finaledges = []
pvalues = set()

# print('enrichment2group_edge', enrichment2group_edge)
# print()
# print('group2curie_edge', group2curie_edge)
for attributes in enrichment2group_edge["attributes"]: # ususally one
enrichment2group_support_graphs = attributes["value"]
# Each of these exists in the auxiliary graph
Expand All @@ -229,10 +233,20 @@ def pickgroup2curieedge(enrichment2group_edge, group2curie_edge, kg_nodes, kg_ed
finaledge = [kg_nodes[object_]["name"], group2curie_edge["predicate"],
kg_nodes[next_element]["name"]]
elif object_ in terminals:
next_element = terminals[
terminals.index(object_) + 1] if object_ in terminals and terminals.index(
object_) + 1 < len(
object_) else None
try:
next_element = terminals[
terminals.index(object_) + 1] if object_ in terminals and terminals.index(
object_) + 1 < len(
object_) else None
except:
next_element = terminals[
terminals.index(object_)] if object_ in terminals and terminals.index(
object_) + 1 < len(object_) else None

# next_element = terminals[
# terminals.index(object_) + 1] if object_ in terminals and terminals.index(
# object_) + 1 < len(
# object_) else None
finaledge = [group2curie_edge["predicate"], kg_nodes[next_element]["name"]]
finaledges.append(theedge + finaledge)
return pvalues, finaledges
Expand Down

0 comments on commit 330be79

Please sign in to comment.