Skip to content

Commit

Permalink
Merge pull request #143 from TRON-Bioinformatics/94_add_table_update_…
Browse files Browse the repository at this point in the history
…dash

Add feature table and update dependencies to newer versions
  • Loading branch information
Pablo Riesgo-Ferreiro authored Nov 9, 2023
2 parents b652204 + 1ecc7b8 commit 2a657b0
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 24 deletions.
2 changes: 1 addition & 1 deletion covigator/dashboard/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def get_application(self) -> dash.Dash:
app = dash.Dash(
name=__name__,
title="CoVigator",
external_stylesheets=[dbc.themes.BOOTSTRAP],
external_stylesheets=[dbc.themes.BOOTSTRAP, dbc.icons.FONT_AWESOME],
suppress_callback_exceptions=True,
meta_tags=[
# A description of the app, used by e.g.
Expand Down
53 changes: 33 additions & 20 deletions covigator/dashboard/tabs/overview.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,36 @@
import dash_bootstrap_components as dbc
import pandas as pd
from dash import dcc
from dash import Input, Output, State, html
from covigator.database.queries import Queries
from covigator.dashboard.tabs import COLOR_STATUS, NEWS_PATTERN


def get_tab_overview(queries: Queries):

present_icon = html.I(className="fas fa-check", style={"color": "green"})
absent_icon = html.I(className="fas fa-times", style={"color": "red"})
features = [
(present_icon, present_icon), # "Mutations per sample"
(present_icon, present_icon), # "Most frequent base substitutions"
(present_icon, present_icon), # "Indel length distribution"
(present_icon, present_icon), # "Most frequent mutation effects"
(present_icon, present_icon), # "Samples accumulation"
(present_icon, present_icon), # "Evolutionary pressure (dN/dS)"
(present_icon, present_icon), # "Instantaneous lineage prevalence"
(present_icon, present_icon), # "Top recurrent mutations"
(present_icon, present_icon), # "Genome/gene view"
(present_icon, absent_icon), # "Co-occurrence clustering"
(present_icon, absent_icon) # "Top intrahost mutations"
]
features = pd.DataFrame.from_records(features,
columns=["ENA (FASTQ)", "COVID-19 Data Portal (FASTA)"],
index=["Mutations per sample", "Most frequent base substitutions",
"Indel length distribution", "Most frequent mutation effects",
"Samples accumulation", "Evolutionary pressure (dN/dS)",
"Instantaneous lineage prevalence", "Top recurrent mutations",
"Genome/gene view", "Co-occurrence clustering",
"Top intrahost mutations"])
features.index.set_names("Dashboard features", inplace=True)
return dbc.CardBody([
get_header(),
dbc.Row([
Expand Down Expand Up @@ -85,28 +109,16 @@ def get_tab_overview(queries: Queries):

dbc.CardBody(
dbc.Row([
dbc.Col([html.Img(src="assets/wordcloud.png", style={"width": "100%"})]),
dbc.Col([
html.Br(),
html.Div([
dbc.ListGroup(
[
dbc.ListGroupItem("Mutations per sample"),
dbc.ListGroupItem("Most frequent base substitutions"),
dbc.ListGroupItem("Indel length distribution"),
dbc.ListGroupItem("Most frequent mutation effects"),
dbc.ListGroupItem("Samples accumulation"),
dbc.ListGroupItem("Evolutionary pressure (dN/dS)"),
dbc.ListGroupItem("Instantaneous lineage prevalence"),
dbc.ListGroupItem("Top recurrent mutations"),
dbc.ListGroupItem("Genome/gene view"),
dbc.ListGroupItem("Co-occurrence clustering"),
dbc.ListGroupItem("Top intrahost mutations")
],
flush=True
)
]),
dbc.Table.from_dataframe(features,
striped=True,
hover=True,
index=True,
className="center"),
]),
], width=7),
dbc.Col([
html.Br(),
dbc.Card(
Expand Down Expand Up @@ -145,7 +157,8 @@ def get_tab_overview(queries: Queries):
],
outline=False,
style={"width": "40rem", "height": "15rem", "margin-left": "40px"},
)]
),
dbc.Col([html.Img(src="assets/wordcloud.png", style={"width": "100%"})]), ]
),
])),
html.Br(),
Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ Werkzeug==2.0.1
cytoolz==0.11.0
logzero==1.6.3
psycopg2-binary==2.8.6
plotly==5.3.1
dash==2.1.0
dash_bootstrap_components==1.0.3
plotly==5.18.0
dash==2.14.1
dash_bootstrap_components==1.5.0
cyvcf2==0.30.4
pycountry==20.7.3
pycountry-convert==0.7.2
Expand Down

0 comments on commit 2a657b0

Please sign in to comment.