Exemplo n.º 1
0
def toggle_bf_distribution(data, value, open):
    if data:
        cutoff = data['points'][0]['x']
        rank_method = Plot(app.compass_module).plot_rank_name[value]
        rank = app.compass_compendium.rank_biological_features(
            app.compass_module, rank_method=rank_method,
            cutoff=cutoff)['ranking']['name']
        return ','.join(rank)
Exemplo n.º 2
0
def toggle_bf_plot_type(value):
    if app.compass_module:
        plot = json.loads(
            Plot(app.compass_module).plot_distribution(plot_type=value,
                                                       output_format='json'))
        p = dcc.Graph(id="bf-edit-json", figure=plot)
        return p
    return {}
Exemplo n.º 3
0
def toggle_accordion_tool_bf(value):
    if app.compass_module:
        plot_type = [{
            'label': p,
            'value': p
        } for p in Plot(app.compass_module).plot_types['distribution']
                     if p.startswith('biological_features_')]
        d = dcc.Dropdown(id='bf-edit-dropdown',
                         options=plot_type,
                         value=plot_type[0]['value'])
        return d
    return ''
Exemplo n.º 4
0
def render_heatmap(heatmap):
    if app.compass_module:
        w = '100%'
        h = '100%'
        min = -5
        max = 5
        if app.compass_compendium.normalization == 'tpm':
            min = np.percentile(
                app.compass_module.
                values[~np.isnan(app.compass_module.values)], 1)
            max = np.percentile(
                app.compass_module.
                values[~np.isnan(app.compass_module.values)], 95)
        plot, sorted_bf, sorted_ss = Plot(app.compass_module).plot_heatmap(
            output_format='json', min=min, max=max)
        js = json.loads(plot)
        js['layout'][
            'plot_bgcolor'] = "rgba(100,100,100,100)"  # add gray background to missing values
        return js, {"height": h, "width": w}
    return {}
Exemplo n.º 5
0
def update_annotation_network_bf(value):
    if app.compass_module:
        return json.loads(
            Plot(app.compass_module).plot_network(output_format='json',
                                                  threshold=0.5))
    return '', None
Exemplo n.º 6
0
def update_network_output(value):
    if app.compass_module:
        return 'Pearson correlation threshold: {}'.format(value), json.loads(
            Plot(app.compass_module).plot_network(output_format='json',
                                                  threshold=value))
    return '', None