def update_select_cluster_de_2(tumor, res): return ( [{'label': 'All', 'value': 'all'}] + [ {'label': 'Cluster {}'.format(clust), 'value': clust} for clust in sorted([int(x) for x in set(load_data.load_tumor_clusters(tumor, res))]) ], 'all' )
def build_layout(): layout = dcc.Tab( label='Cluster Markers', children=[ dbc.Row(html.Hr(), style={'height': '3%'}), html.Div([ 'Compare differentially expressed genes between tumor sub-clusters of cells.' ]), dbc.Row(html.Hr(), style={'height': '3%'}), dbc.Row([ dbc.Col([ dbc.CardHeader("Table 1", style={ "background-color": "#e3e3e3", "font-weight": "bold", "font-size": "Large", "text-align": "center" }), dbc.CardBody([ html.Div([ dbc.Row(children=[ dbc.Col([html.H6("Select a tumor:")], width=100, style={"width": "40%"}), dbc.Col([ common.build_tumor_dropdown( 'select-tumor-de-1') ]) ]) ]), html.Div([ dbc.Row(children=[ dbc.Col( [html.H6("Select cluster resolution:")], width=100, style={"width": "40%"}), dbc.Col([ common.build_cluster_res_dropdown( 'select-cluster-res-de-1') ]) ]) ]), html.Div([ dbc.Row(children=[ dbc.Col([html.H6("Select a cluster:")], width=100, style={"width": "40%"}), dbc.Col([ dcc.Dropdown(options=[{ 'label': 'Cluster {}'.format(clust), 'value': clust } for clust in sorted( set( load_data.load_tumor_clusters( DEFAULT_TUMOR_1, 1)))], id='select-cluster-de-1', value='0') ]) ]) ]), dbc.Row(html.Hr(), style={'height': '0.5%'}), DataTable( columns=[{ "id": "de-genes-col-1", "name": "DE Genes" }, { "id": "de-lfc-col-1", "name": "log-FC" }, { "id": "de-alfc-col-1", "name": "Abs. log-FC" }, { "id": "de-sig-col-1", "name": "Significance Rank" }], data=build_table_data("1", "PJ025", "0", 1), # TODO add resolution style_cell_conditional=[{ 'textAlign': 'center' }], id='de-table-1', filter_action="native", sort_action="native", page_size=PAGE_SIZE, export_format='csv', export_headers='display') ]) ]), dbc.Col([], width=100, style={"width": "15px"}), dbc.Col([ dbc.CardHeader("Table 2", style={ "background-color": "#e3e3e3", "font-weight": "bold", "font-size": "Large", "text-align": "center" }), dbc.CardBody([ html.Div([ dbc.Row(children=[ dbc.Col([html.H6("Select a tumor:")], width=100, style={"width": "40%"}), dbc.Col([ common.build_tumor_dropdown( 'select-tumor-de-2') ]) ]) ]), html.Div([ dbc.Row(children=[ dbc.Col( [html.H6("Select cluster resolution:")], width=100, style={"width": "40%"}), dbc.Col([ common.build_cluster_res_dropdown( 'select-cluster-res-de-2') ]) ]) ]), html.Div([ dbc.Row(children=[ dbc.Col([html.H6("Select a cluster:")], width=100, style={"width": "40%"}), dbc.Col([ dcc.Dropdown(options=[{ 'label': 'Cluster {}'.format(clust), 'value': clust } for clust in sorted( set( load_data.load_tumor_clusters( DEFAULT_TUMOR_1, 1)))], id='select-cluster-de-2', value='0') ]) ]) ]), dbc.Row(html.Hr(), style={'height': '0.5%'}), DataTable( columns=[{ "id": "de-genes-col-2", "name": "DE Genes" }, { "id": "de-lfc-col-2", "name": "log-FC" }, { "id": "de-alfc-col-2", "name": "Abs. log-FC" }, { "id": "de-sig-col-2", "name": "Significance Rank" }], data=build_table_data("1", "PJ025", "0", 1), # TODO add resolution style_cell_conditional=[{ 'textAlign': 'center' }], id='de-table-2', filter_action="native", sort_action="native", page_size=PAGE_SIZE, export_format='csv', export_headers='display') ]) ]) ]) ]) return layout
def _build_control_panel(plot_num): return [ dbc.Row([ dbc.Col([], width=100, style={"width": "15px"}), dbc.Col([ html.Div([ dbc.Row(children=[ dbc.Col([ html.H6("Select a tumor to visualize:") ], width=100, style={"width": "40%"}), dbc.Col([ common.build_tumor_dropdown('select-tumor-dist-{}'.format(plot_num)) ]) ]) ]), html.Div([ dbc.Row(children=[ dbc.Col([ html.H6("Select cluster resolution:") ], width=100, style={"width": "40%"}), dbc.Col([ common.build_cluster_res_dropdown('select-cluster-res-dist-{}'.format(plot_num)) ]) ]) ]), html.Div([ dbc.Row(children=[ dbc.Col([ html.H6("Select a cluster:") ], width=100, style={"width": "40%"}), dbc.Col([ dcc.Dropdown( options=[{'label': 'All', 'value': 'all'}] + [ {'label': 'Cluster {}'.format(clust), 'value': clust} for clust in sorted([int(x) for x in set(load_data.load_tumor_clusters(DEFAULT_TUMOR_1, DEFAULT_RES))]) ], #style={"width": '60%'}, id='select-cluster-dist-{}'.format(plot_num), value='0' ) ]) ]) ]), html.Div([ dbc.Row(children=[ dbc.Col([ html.H6("Enter gene: ") ], width=100, style={"width": "40%"}), dbc.Col([ html.Div([ #dcc.Input(id='color-by-feature-dist-{}'.format(plot_num), value=DEFAULT_GENE) dcc.Dropdown( options=[ {'label': gene, 'value': gene} for gene in load_data.load_genes_sorted(DEFAULT_TUMOR_1) ], id='color-by-feature-dist-{}'.format(plot_num) ) ], id='color-by-feature-container-dist-{}'.format(plot_num)) ]) ]) ]) ]) ]) ]
def update_select_cluster_de_2(tumor, res): return ([{ 'label': 'Cluster {}'.format(clust), 'value': clust } for clust in sorted(set(load_data.load_tumor_clusters(tumor, res)))], '0')