dash_bio_manhattanplot Examples and Reference

see ManhattanPlot in action.

ManhattanPlot

An example of a default ManhattanPlot component without any extra properties.

This example has not been ported to Julia yet - showing the Python version instead.

Visit the old docs site for Julia at: https://community.plotly.com/c/dash/julia/20

Threshold value

import pandas as pd
from dash import Dash, html, dcc, Input, Output, callback
import dash_bio as dashbio

app = Dash()

df = pd.read_csv('https://git.io/manhattan_data.csv')

app.layout = html.Div([
    'Threshold value',
    dcc.Slider(
        id='default-manhattanplot-input',
        min=1,
        max=10,
        marks={
            i: {'label': str(i)} for i in range(10)
        },
        value=6
    ),
    html.Br(),
    html.Div(
        dcc.Graph(
            id='default-dashbio-manhattanplot',
            figure=dashbio.ManhattanPlot(
                dataframe=df
            )
        )
    )
])

@callback(
    Output('default-dashbio-manhattanplot', 'figure'),
    Input('default-manhattanplot-input', 'value')
)
def update_manhattanplot(threshold):

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

if __name__ == '__main__':
    app.run(debug=True)

Customization

Line Colors

Change the colors of the suggestive line and the genome-wide line.

This example has not been ported to Julia yet - showing the Python version instead.

Visit the old docs site for Julia at: https://community.plotly.com/c/dash/julia/20

import pandas as pd
from dash import dcc
import dash_bio as dashbio

df = pd.read_csv('https://git.io/manhattan_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)

manhattanplot = dashbio.ManhattanPlot(
    dataframe=DATASET,
    suggestiveline_color='#AA00AA',
    genomewideline_color='#AA5500'
)

dcc.Graph(figure=manhattanplot)

Highlighted Points Color

Change the color of the points that are considered significant.

This example has not been ported to Julia yet - showing the Python version instead.

Visit the old docs site for Julia at: https://community.plotly.com/c/dash/julia/20

import pandas as pd
from dash import dcc
import dash_bio as dashbio

df = pd.read_csv('https://git.io/manhattan_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)

manhattanplot = dashbio.ManhattanPlot(
    dataframe=DATASET,
    highlight_color='#00FFAA'
)

dcc.Graph(figure=manhattanplot)

dash_bio.ManhattanPlot is a Python-based component,
and may not be available in other languages.

Example Data