def update_volcanoplot(effects): return dashbio.VolcanoPlot( dataframe=df, genomewideline_value=2.5, effect_size_line=effects )
def test_dbvp006_test_layout_props(dash_duo): app = dash.Dash(__name__) app.layout = html.Div( nested_component_layout( dash_bio.VolcanoPlot( dataframe=_data, width=600, legend={ 'x': 0.85, 'orientation': 'h', 'yanchor': 'bottom', 'y': 1.02, 'bgcolor': '#f2f5fa' }, xaxis={"color": "red"}, yaxis={"color": "blue"}, template="simple_white", ))) nested_component_app_callback(app, dash_duo, component=dash_bio.VolcanoPlot, component_data=_data, test_prop_name='plot_bgcolor', test_prop_value='pink', prop_value_type='string', data_prop_name='dataframe', take_snapshot=True)
def layout(): return html.Div(id='pileup-body', className='app-body', children=[ html.Div(id='pileup-control-tabs', className='control-tabs', children=[ dcc.Tabs( id='pileup-tabs', value='data', children=[ dcc.Tab( label='Data', value='data', children=html.Div(className='control-tab', children=[ dcc.Graph( id='pileup-dashbio-volcanoplot', figure=dash_bio.VolcanoPlot( dataframe=DE_dataframe, effect_size='log2FoldChange', title="Differentially Expressed Genes", genomewideline_value=-np.log10(0.05), p='padj', snp='SNP', gene='Gene', ) ) ]) ), dcc.Tab( label='About', value='what-is', children=html.Div(className='control-tab', children=[ html.H4(className='what-is', children='What is pileup.js?'), dcc.Markdown( """ The Dash pileup.js component is a high-performance genomics data visualization component developed originally by the Hammer Lab (https://github.com/hammerlab/pileup.js). pileup.js supports visualization of genomic file formats, such as vcfs, bam, and bigbed files. pileup.js additionally allows flexible interaction with non-standard data formats. Users can visualize GA4GH JSON formatted alignments, features and variants. Users can also connect with and visualize data stored in GA4GH formatted data stores. """ ) ]) ) ] ) ]), dcc.Loading(parent_className='dashbio-loading', id='pileup-output', children=html.Div([ dash_bio.Pileup( id=_COMPONENT_ID, range=HOSTED_CASE_DICT['rna-differential']['range'], reference=REFERENCE, tracks=HOSTED_CASE_DICT['rna-differential']['tracks'], ) ])), ])
def update_graph(u_lim, l_lim, genomic_line, datadset_id): """Update the data set of interest upon change the dashed lines value. """ return dash_bio.VolcanoPlot( DATASETS[datadset_id]['dataframe'], genomewideline_value=float(genomic_line), effect_size_line=[float(l_lim), float(u_lim)], **DATASETS[datadset_id]['dataprops'])
def update_graph(effect_lims, genomic_line, datadset_id, color): """Update rendering of data points upon changing x-value of vertical dashed lines.""" l_lim = effect_lims[0] u_lim = effect_lims[1] if 'hex' in color: color = color.get('hex', 'red') return dash_bio.VolcanoPlot( DATASETS[datadset_id]['dataframe'], genomewideline_value=float(genomic_line), effect_size_line=[float(l_lim), float(u_lim)], highlight_color=color, **DATASETS[datadset_id]['dataprops'])
def update_volcano(effects): return dash_bio.VolcanoPlot( dataframe=DE_dataframe, margin=go.layout.Margin(l=0, r=0, b=0), legend={"orientation": "h", "yanchor": "bottom", "y": 1.02, "x": 0.0,}, effect_size="log2FoldChange", effect_size_line=effects, title="Differentially Expressed Genes", genomewideline_value=-np.log10(0.05), p="padj", snp="SNP", gene="Gene", )
def test_dbvp005_effect_size_line_value(dash_duo): app = dash.Dash(__name__) app.layout = html.Div( nested_component_layout(dash_bio.VolcanoPlot(dataframe=_data))) nested_component_app_callback(app, dash_duo, component=dash_bio.VolcanoPlot, component_data=_data, test_prop_name='effect_size_line', test_prop_value=json.dumps([-0.5, 1.5]), prop_value_type='list', data_prop_name='dataframe', take_snapshot=True)
def test_dbvp004_genomewideline_value(dash_duo): app = dash.Dash(__name__) app.layout = html.Div( nested_component_layout(dash_bio.VolcanoPlot(dataframe=_data))) nested_component_app_callback(app, dash_duo, component=dash_bio.VolcanoPlot, component_data=_data, test_prop_name='genomewideline_value', test_prop_value=4, prop_value_type='int', data_prop_name='dataframe', take_snapshot=True)
def test_dbvp002_points_color(dash_duo): app = dash.Dash(__name__) app.layout = html.Div( nested_component_layout(dash_bio.VolcanoPlot(dataframe=_data))) nested_component_app_callback(app, dash_duo, component=dash_bio.VolcanoPlot, component_data=_data, test_prop_name='col', test_prop_value='rgb(12, 254, 42)', prop_value_type='string', data_prop_name='dataframe', take_snapshot=True)
def layout(app): HOSTED_CASE_DICT = rna_differential(app) return html.Div( id="pileup-body", className="app-body", children=[ html.Div( id="pileup-control-tabs", className="control-tabs", children=[ dcc.Tabs( id="pileup-tabs", value="data", children=[ dcc.Tab( label="Volcano plot", value="data", children=html.Div( className="control-tab", children=[ "Effect Size", dcc.RangeSlider( id="pileup-volcanoplot-input", min=df_min, max=df_max, step=None, marks={ i: {"label": str(i)} for i in range(df_min, df_max + 1, 2) }, value=[-1, 1], ), html.Br(), dcc.Graph( id="pileup-dashbio-volcanoplot", figure=dash_bio.VolcanoPlot( dataframe=DE_dataframe, margin=go.layout.Margin(l=0, r=0, b=0), legend={ "orientation": "h", "yanchor": "bottom", "y": 1.02, "bgcolor": "#f2f5fa", }, effect_size="log2FoldChange", effect_size_line=[-1, 1], title="Differentially Expressed Genes", genomewideline_value=-np.log10(0.05), p="padj", snp="SNP", gene="Gene", ), ), ], ), ), dcc.Tab( label="About this tutorial", value="description", children=html.Div( className="control-tab", children=[ html.H4( className="description", children="""Visualizing RNA-seq data with pileup.js and volcano plots""", ), dcc.Markdown( """ In this example, we use the pileup.js and volcano plot components from dash-bio to visualize two RNA-sequencing (RNA-seq) samples from two conditions. RNA-seq allows us to learn how the expression of genes changes between different samples of interest. Here, we are looking at RNA-seq from two samples that are taken from two different mouse cell types. We refer to these different cell types as basal and luminal cell types. On the right, we use pileup.js to visualize aligned reads from RNA-seq samples. On the left, we have a volcano plot, that visualizes the magnitude of change in gene expression between the two samples. On the x-axis, the `Effect Size` indicates the log2 fold change in expression between the two conditions. On the y-axis, `-log10(p)` indicates the -log10(p-value) for each gene. This p-value, along with the effect size, can help determine whether each gene is significantly differentially expressed between the conditions of interest. To explore a gene, you can click on a gene in the volcano plot. After clicking on a gene, the genomic region overlapping that gene will show up in the pileup.js browser on the right. Now, you can investigate RNA-seq alignments at each gene of interest. You may notice that genes with a negative effect size in the volcano plot have more RNA-seq reads in the top sample (the basal cell type), while genes with a positive effect size have more reads in the bottom sample (the luminal cell type). """ ), ], ), ), dcc.Tab( label="About pileup.js", value="what-is", children=html.Div( className="control-tab", children=[ html.H4( className="what-is", children="What is pileup.js?", ), dcc.Markdown( """ The Dash pileup.js component is a high-performance genomics data visualization component developed originally by the Hammer Lab (https://github.com/hammerlab/pileup.js). pileup.js supports visualization of genomic file formats, such as vcf, bam, and bigbed files. pileup.js additionally allows flexible interaction with non-standard data formats. Users can visualize GA4GH JSON formatted alignments, features and variants. Users can also connect with and visualize data stored in GA4GH formatted data stores. """ ), ], ), ), ], ) ], ), dcc.Loading( parent_className="dashbio-loading", id="pileup-output", children=html.Div( [ dash_bio.Pileup( id=_COMPONENT_ID, range=HOSTED_CASE_DICT["range"], reference=REFERENCE, tracks=HOSTED_CASE_DICT["celltype"], ) ] ), ), ], )
dcc.RangeSlider( id='volcanoplot-input', min=-3, max=3, step=0.05, marks={ i: {'label': str(i)} for i in range(-3, 3) }, value=[-0.5, 1] ), html.Br(), html.Div( dcc.Graph( id='my-dashbio-volcanoplot', figure=dashbio.VolcanoPlot( dataframe=df ) ) ) ]) @app.callback( dash.dependencies.Output('my-dashbio-volcanoplot', 'figure'), [dash.dependencies.Input('volcanoplot-input', 'value')] ) def update_volcanoplot(effects): return dashbio.VolcanoPlot( dataframe=df, genomewideline_value=2.5,
import dash_html_components as html import dash_core_components as dcc import dash_bio as dashbio import base64 import pandas as pd df = pd.read_csv("https://raw.githubusercontent.com/plotly/dash-bio/master/tests/dashbio_demos/sample_data/volcano_data1.csv") component = dcc.Graph(figure=dashbio.VolcanoPlot( dataframe=df ), style={'width': '800px'}) component_image = html.Img( src='data:image/png;base64,{}'.format( base64.b64encode( open( './images/pic_volcano.png', 'rb' ).read() ).decode() ), style={'width': '800px', 'position': 'relative', 'top': '1px'} ) def callbacks(app): return
import dash_html_components as html import dash_core_components as dcc import dash_bio as dashbio import base64 import pandas as pd df = pd.read_csv( "https://raw.githubusercontent.com/plotly/dash-bio/master/tests/dashbio_demos/dash-volcano-plot/data/data1.csv" ) component = dcc.Graph(figure=dashbio.VolcanoPlot(dataframe=df), style={'width': '800px'}) component_image = html.Img(src='data:image/png;base64,{}'.format( base64.b64encode(open('./images/pic_volcano.png', 'rb').read()).decode()), style={ 'width': '800px', 'position': 'relative', 'top': '1px' }) def callbacks(app): return