Esempio n. 1
0
def test_dbmp002_suggestiveline_value(dash_duo):

    app = dash.Dash(__name__)

    app.layout = html.Div(
        nested_component_layout(dash_bio.ManhattanPlot(dataframe=_data)))

    nested_component_app_callback(app,
                                  dash_duo,
                                  component=dash_bio.ManhattanPlot,
                                  component_data=_data,
                                  data_prop_name='dataframe',
                                  test_prop_name='suggestiveline_value',
                                  test_prop_value=5,
                                  prop_value_type='int',
                                  take_snapshot=True)

    app = dash.Dash(__name__)

    app.layout = html.Div(
        nested_component_layout(dash_bio.ManhattanPlot(dataframe=_data)))

    nested_component_app_callback(app,
                                  dash_duo,
                                  component=dash_bio.ManhattanPlot,
                                  component_data=_data,
                                  data_prop_name='dataframe',
                                  test_prop_name='suggestiveline_value',
                                  test_prop_value=9,
                                  prop_value_type='int',
                                  take_snapshot=True)
Esempio n. 2
0
 def update_graph(slider_genome, slider_indic):
     """update the data sets upon change the genomewideline value"""
     return dash_bio.ManhattanPlot(
         df,
         genomewideline_value=float(slider_genome),
         suggestiveline_value=float(slider_indic),
     )
Esempio n. 3
0
def update_manhattanplot(threshold):

    return dashbio.ManhattanPlot(
        dataframe=df,
        genomewideline_value=threshold,
        suggestiveline_color='#AA00AA',
        genomewideline_color='#AA5500',
    )
Esempio n. 4
0
def test_dbmp005_highlight_color(dash_duo):

    app = dash.Dash(__name__)

    app.layout = html.Div(
        nested_component_layout(dash_bio.ManhattanPlot(dataframe=_data)))

    nested_component_app_callback(app,
                                  dash_duo,
                                  component=dash_bio.ManhattanPlot,
                                  component_data=_data,
                                  data_prop_name='dataframe',
                                  test_prop_name='highlight_color',
                                  test_prop_value='rgb(76, 184, 254)',
                                  prop_value_type='string',
                                  take_snapshot=True)
Esempio n. 5
0
def test_dbmp003_genomewide_color(dash_duo):

    app = dash.Dash(__name__)

    app.layout = html.Div(
        nested_component_layout(dash_bio.ManhattanPlot(dataframe=_data)))

    nested_component_app_callback(app,
                                  dash_duo,
                                  component=dash_bio.ManhattanPlot,
                                  component_data=_data,
                                  data_prop_name='dataframe',
                                  test_prop_name='genomewideline_color',
                                  test_prop_value='rgb(209, 171, 251)',
                                  prop_value_type='string')

    dash_duo.wait_for_style_to_equal(
        '#test-graph svg:nth-child(3) g.layer-above g.shapelayer > path:nth-child(2)',
        'stroke', 'rgb(209, 171, 251)')
Esempio n. 6
0
# Import required libraries
import os
import pandas as pd
import dash_html_components as html
import dash_core_components as dcc
from dash.dependencies import Input, Output

import dash_bio

DATAPATH = os.path.join(".", "tests", "dashbio_demos", "sample_data", "manhattan_")

# Load the data
df = pd.read_csv("{}data.csv".format(DATAPATH))

# Feed the data to a function which creates a Manhattan Plot figure
fig = dash_bio.ManhattanPlot(df)

text_style = {
    'color': "#506784",
    'font-family': 'Open Sans'
}


def description():
    return 'Display genomic studies results sorted out by chromosome with ' \
           'this Manhattan plot.\
    Perfect to visualize genome wide association studies (GWAS).'


def header_colors():
    return {
Esempio n. 7
0
DATAPATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data')

# Load dataset into a DataFrame
df = pd.read_csv(os.path.join(DATAPATH, 'data.csv'))

n_chr = 23  # number of chromosome pairs in humans
assert 'CHR' in df.columns
assert df['CHR'].max() == n_chr

# Trim down the data
DATASET = df.groupby('CHR').apply(lambda u: u.head(50))
DATASET = DATASET.droplevel('CHR').reset_index(drop=True)

# Feed the data to a function which creates a Manhattan Plot figure
fig = dash_bio.ManhattanPlot(DATASET)


def description():
    return 'Display genomic studies results sorted out by chromosome with ' \
           'this Manhattan plot.\
    Perfect to visualize genome-wide association studies (GWAS).'


def header_colors():
    return {'bg_color': '#0D76BF', 'font_color': '#fff', 'light_logo': True}


def layout():
    return html.Div(
        id='mhp-page-content',
                html.H1("Manhattan Plot", className="title"),
                html.P("Manhattan Plot is a type of scatter plot and commonly used in genome-wide association studies (GWAS) to visualize display significant SNPs efficiently.", 
                        className="subtitle is-5"),
                html.A("Go to Docs for 'Dash' library", href="https://dash.plot.ly/", target="_blank", className="button is-outlined is-info is-rounded"),
                html.Hr(style={"background": "#CCC"}),
                html.P("*The genome-wide significance threshold was set as 5e-8 and plotted with green line, and the most significant SNPs are colored in red.", className="subtitle is-5"), 
            ]),
            html.Div(className="column is-half is-centered", children=[
                
                # Here is Manhattan Plot 
                dcc.Graph(figure=dashbio.ManhattanPlot(
                    dataframe = gwas_data,
                    highlight_color = "#ff3860", # The color of the significant SNPs
                    genomewideline_value = -(m.log10(5e-8)), # The genome-wide significance threshold
                    genomewideline_width = 2, # Boldness of the genome-wide line
                    genomewideline_color = "#00d1b2", # The color of genome-wide significance line
                    suggestiveline_value = False, # If you would like to add a suggestive threshold, turn it into a float value.
                    annotation = "ADD_INFO", # If you would like to add extra info to the annotation part, here put the column name.
                    showgrid = False, # If you would like to see grid lines in the background, turn it into True.
                    title = None, # If you would like to add a title to the graph, just add "My Manhattan Plot"
                    xlabel = "chromosome"
                )), # ends of Manhattan Plot 

            ]),
        ]), 

    # Footer Part
    html.Div(className="columns is-centered is-vcentered has-background-light", style={"padding": "100px 0px"},
        children=[
            html.Div(className="column is-half is-centered is-vcentered", children=[
                html.H1("Thanks for your effort to open and come here!", className="title"),
                html.P("I will keep continue to append new interactive graphs and figures as much as I can.", className="subtitle is-5"),
Esempio n. 9
0
import dash_bio as dashbio
import dash_html_components as html
import dash_core_components as dcc
import base64
import pandas as pd

df = pd.read_csv(
    "https://raw.githubusercontent.com/plotly/dash-bio/master/tests/dashbio_demos/dash-manhattan-plot/data/data.csv"
)
component = dcc.Graph(figure=dashbio.ManhattanPlot(dataframe=df, ),
                      style={'width': '700px'})

component_image = html.Img(src='data:image/png;base64,{}'.format(
    base64.b64encode(open('./images/pic_manhattan.png',
                          'rb').read()).decode()),
                           style={'margin-left': '1px'})


def callbacks(app):
    return
Esempio n. 10
0
app.layout = html.Div([
    html.H1('Welcome to the app'),
    html.H3('You are successfully authorized'),
    dcc.Markdown(children=markdown_text),
    dcc.Slider(id='manhattanplot-input',
               min=1,
               max=6,
               marks={i: {
                   'label': str(i)
               }
                      for i in range(10)},
               value=6),
    html.Br(),
    html.Div(
        dcc.Graph(id='my-dashbio-manhattanplot',
                  figure=dashbio.ManhattanPlot(dataframe=df)))
])


@app.callback(dash.dependencies.Output('my-dashbio-manhattanplot', 'figure'),
              [dash.dependencies.Input('manhattanplot-input', 'value')])
def update_manhattanplot(threshold):

    return dashbio.ManhattanPlot(
        dataframe=df,
        genomewideline_value=threshold,
        suggestiveline_color='#AA00AA',
        genomewideline_color='#AA5500',
    )

Esempio n. 11
0
def update_manhattanplot(threshold):

    return dashbio.ManhattanPlot(dataframe=df, genomewideline_value=threshold)