Пример #1
0
def get_pnl_day(data):
    pnl = []
    pnl.append(
        round((data.get('profit')[-2] - data.get('profit')[-1]) / 100000000,
              2))
    pnl.append(
        round((data.get('usd_profit')[-2] - data.get('usd_profit')[-1]) /
              100000000, 2))

    if pnl[0] != 0:
        if pnl[0] > 0:
            pnl_icon = '▲'
            pnl_icon_class = 'pnl-up-icon'
        if pnl[0] < 0:
            pnl_icon = '▼'
            pnl_icon_class = 'pnl-dn-icon'
    else:
        pnl_icon = ''
        pnl_icon_class = 'pnl-flat-icon'

    return html.Abbr(html.Div([
        '₿ {}'.format(pnl[0]),
        html.P('{}'.format(pnl_icon), className=pnl_icon_class)
    ],
                              className='pnl-container'),
                     title='${}'.format(pnl[1]),
                     className='abbr-no-underline')
Пример #2
0
def table_component():
    """
	Returns the children for a clean Html Div for the oligo tables
	"""

    return [
        html.Div(
            id='table-buttons',
            style={'display': 'none'},
            children=[
                html.Table(children=html.Tr(children=[
                    html.Td(children=html.H4(id='oligo-count', children=[])),
                    html.Td(
                        dcc.RadioItems(id='table-display-radio',
                                       options=[{
                                           'label': 'Oligo list',
                                           'value': 'oligo-summary'
                                       }, {
                                           'label': 'Full details',
                                           'value': 'oligo-details'
                                       }],
                                       value='oligo-summary',
                                       labelStyle={'display': 'inline-block'}),
                    ),
                    html.Td(children=html.Abbr(
                        '\u24D8',
                        title=
                        '"Oligo list" contains all the unique antisense oligos across all targeted sequences. "Full details" lists all targeted positions, so oligos may appear more than once.',
                        style={'display': 'inline-block'}))
                ]))
            ]),
        html.Div(id='table-container',
                 children=[],
                 style={
                     'width': '100%',
                     'display': 'inline-block',
                     'vertical-align': 'top',
                     'padding-left': 10
                 })
    ]
Пример #3
0
def upload_data(id):
    return html.Div([
        html.Div(
            [
                "Upload your own ticker: ",
                html.Abbr(
                    title=(
                        "Please provide a CSV following the rules below:\n"
                        "- The top of the file includes the columns:\n"
                        "  Date, Open, High, Low, Close\n"
                        "- Dates should be in the format of DD/MM/YYYY\n"
                        "- The csv file should have at least 1 year of data\n\n"
                        "Example of the format below:\n"
                        "Date,Open,High,Low,Close\n"
                        "13/03/1986,100,105,99,103\n"
                        "14/03/1986,103,106,103,103\n"),
                    className="fa fa-question-circle",
                ),
            ],
            className="has-text-centered",
            style={"margin": "10px"},
        ),
        dcc.Upload(
            id=f"upload-data-{id}",
            children=html.Div([
                "Drag and Drop or ",
                html.A("Select Files ", style={"color": OFFICIAL_COLOURS[0]}),
            ]),
            style={
                "width": "100%",
                "height": "60px",
                "lineHeight": "60px",
                "borderWidth": "1px",
                "borderStyle": "dashed",
                "borderRadius": "5px",
                "textAlign": "center",
            },
        ),
    ])
Пример #4
0
 def __init__(self,
              input_id,
              name,
              tooltip_text,
              value,
              input_type="number",
              step=1):
     self.input_id = input_id
     self.name = name
     self.tooltip_text = tooltip_text
     self.value = value
     self.input_type = input_type
     self.step = step
     self.label = html.Label(name)
     self.user_input = dcc.Input(id=input_id,
                                 value=value,
                                 type=input_type,
                                 step=step)
     self.callback_input = Input(component_id=input_id,
                                 component_property='value')
     self.tooltip = html.Abbr("\u003F", title=tooltip_text)
     self.container = html.Div(
         children=[self.label, self.user_input, self.tooltip],
         style={'columnCount': 3})
Пример #5
0
page_1_layout = html.Div([
    html.H1("Dashboard Covid-19 datos diarios, Noviembre 30, 2020",
            style={
                'color': '#FFFFFF',
                'background-color': '#5e03fc'
            }),
    dcc.Link('Volver al menú', href='/'),
    html.Br(),
    html.Br(),
    html.Div([
        html.Div([
            html.Div(
                [
                    html.Abbr(
                        "\u003F",
                        title=
                        "Contador del número total de fallecidos por Covid-19 en el último día actualizado",
                        style={'float': 'right'}),
                    daq.LEDDisplay(id="dead",
                                   label="Fallecidos",
                                   labelPosition='top',
                                   color='black',
                                   value=contador_fallecidos_diario)
                ],
                style={
                    'width': '48%',
                    'float': 'left',
                    'display': 'inline-block',
                    "border": "2px black solid"
                }),
            html.Div(
Пример #6
0
def get_pca_options_form():
    try:
        collection_options = [{
            'label': f'{collection.id}: {collection.name}',
            'value': collection.id
        } for collection in get_collections(current_user, {'kind': 'data'})]
    except:
        collection_options = []
    try:
        pca_data = PCAModel(load_data=True)
        label_options = [{
            'label': label,
            'value': label
        } for label in pca_data.labels]
        loaded_badges = pca_data.get_collection_badges()
        collection_load_info = pca_data.get_collection_load_info()
    except:
        loaded_badges = [
            html.Span([dbc.Badge('None', className='badge-pill')])
        ]
        collection_load_info = 'Loaded collections.'
        label_options = []

    return dbc.Card(
        dbc.CardBody(
            dbc.Form([
                dbc.Row([
                    dbc.Col([
                        dbc.FormGroup([
                            dbc.Label('Collection ID',
                                      html_for='collection-id'),
                            dcc.Dropdown(options=collection_options,
                                         id='collection-id',
                                         multi=True)
                        ])
                    ]),
                    dbc.Col([
                        dbc.FormGroup([
                            dbc.Label(collection_load_info,
                                      html_for='loaded-display',
                                      id='collections-label'),
                            dcc.Loading([
                                dbc.InputGroup([
                                    dbc.Button(
                                        'Get',
                                        id='get-collection',
                                        className='col-sm-2 btn-success'),
                                    html.H4(loaded_badges,
                                            id='loaded-collections',
                                            className='col-sm-10')
                                ],
                                               id='loaded-display')
                            ])
                        ])
                    ])
                ]),
                dbc.Row([
                    dbc.Col([
                        dbc.FormGroup([
                            dbc.Label([
                                'Scale by label(s)',
                                html.Abbr(
                                    '\uFE56',
                                    title=
                                    'The mean of the records satisfying conditions on these '
                                    'fields will be subtracted from each record, then each'
                                    ' record will be scaled by the standard deviation of the'
                                    ' records satisfying the conditions.')
                            ],
                                      html_for='scale-by'),
                            dcc.Dropdown(id='scale-by',
                                         options=label_options,
                                         multi=True),
                        ])
                    ]),
                    dbc.Col([
                        dbc.FormGroup([
                            dbc.Label([
                                'Scale by conditions',
                                html.Abbr(
                                    '\uFE56',
                                    title=
                                    'The conditions for the records to use for scaling. If '
                                    'left blank, then no scaling is performed.'
                                )
                            ],
                                      html_for='scale-by-value'),
                            dcc.Dropdown(id='scale-by-value',
                                         options=[{
                                             'label': 'All Records',
                                             'value': 'index'
                                         }],
                                         multi=True),
                        ])
                    ])
                ]),
                dbc.Row([
                    dbc.Col([
                        dbc.FormGroup([
                            dbc.Label([
                                'Model by label(s)',
                                html.Abbr(
                                    '\uFE56',
                                    title=
                                    'Only consider records satisfying conditions on these'
                                    ' fields.')
                            ],
                                      html_for='model-by'),
                            dcc.Dropdown(id='model-by',
                                         options=label_options,
                                         multi=True)
                        ])
                    ]),
                    dbc.Col([
                        dbc.FormGroup([
                            dbc.Label([
                                'Model by conditions',
                                html.Abbr(
                                    '\uFE56',
                                    title=
                                    'The conditions which must be satisfied for the records'
                                    'to be considered.')
                            ],
                                      html_for='model-by-value'),
                            dcc.Dropdown(id='model-by-value',
                                         options=[],
                                         multi=True)
                        ])
                    ])
                ]),
                dbc.Row([
                    dbc.Col([
                        dbc.FormGroup([
                            dbc.Label([
                                'Ignore by label(s)',
                                html.Abbr(
                                    '\uFE56',
                                    title=
                                    'Exclude records satisfying conditions on these fields'
                                )
                            ],
                                      html_for='ignore-by'),
                            dcc.Dropdown(id='ignore-by',
                                         options=label_options,
                                         multi=True)
                        ])
                    ]),
                    dbc.Col([
                        dbc.FormGroup([
                            dbc.Label([
                                'Ignore by conditions',
                                html.Abbr(
                                    '\uFE56',
                                    title=
                                    'Conditions which apply to records to be excluded.'
                                )
                            ],
                                      html_for='ignore-by-value'),
                            dcc.Dropdown(id='ignore-by-value',
                                         options=[],
                                         multi=True)
                        ])
                    ])
                ]),
                dbc.Row([
                    dbc.Col([
                        dbc.FormGroup([
                            dbc.Label([
                                'Pair on label(s)',
                                html.Abbr(
                                    '\uFE56',
                                    title=
                                    'The paired analysis works on the difference between '
                                    'records in one class and other records, where the '
                                    'records are "paired" by some identity condition. The '
                                    '"pair on" label is used to pair all the records with '
                                    'equal values for that field.')
                            ],
                                      html_for='pair-on'),
                            dcc.Dropdown(id='pair-on',
                                         options=label_options,
                                         multi=True)
                        ])
                    ]),
                    dbc.Col([
                        dbc.FormGroup([
                            dbc.Label([
                                'Pair with label(s)',
                                html.Abbr(
                                    '\uFE56',
                                    title=
                                    'The "pair with" condition applies to the records to be '
                                    'subtracted from the others')
                            ],
                                      html_for='pair-with'),
                            dcc.Dropdown(id='pair-with',
                                         options=label_options,
                                         multi=True)
                        ])
                    ]),
                    dbc.Col([
                        dbc.FormGroup([
                            dbc.Label([
                                'Pair with conditions',
                                html.Abbr(
                                    '\uFE56',
                                    title=
                                    'The condition which must apply for the records which '
                                    'will be subtracted.')
                            ],
                                      html_for='pair-with-value'),
                            dcc.Dropdown(id='pair-with-value',
                                         options=[],
                                         multi=True)
                        ])
                    ]),
                ]),
                dbc.Row([
                    dbc.Col([
                        dbc.FormGroup([
                            dbc.Label([
                                'Project by label(s)',
                                html.Abbr(
                                    '\uFE56',
                                    title=
                                    'Select additional data to be projected'
                                    ' on the PC axes created by the model.')
                            ],
                                      html_for='additional-projection'),
                            dcc.Dropdown(id='project-by',
                                         options=label_options,
                                         multi=True)
                        ])
                    ]),
                    dbc.Col([
                        dbc.FormGroup([
                            dbc.Label([
                                'Project by conditions',
                                html.Abbr(
                                    '\uFE56',
                                    title=
                                    'The conditions which must be satisfied for the records'
                                    ' to be projected.')
                            ],
                                      html_for='project-by-value'),
                            dcc.Dropdown(id='project-by-value',
                                         options=[],
                                         multi=True)
                        ])
                    ])
                ]),
                dbc.FormGroup([
                    dcc.Loading([
                        dbc.Button('Run PCA',
                                   id='pca-button',
                                   color='primary',
                                   className='btn btn-block form-control'),
                        html.Small('', id='message', className='form-text')
                    ])
                ])
            ])))
Пример #7
0
def get_plot_options_form():
    try:
        pca_data = PCAModel(load_data=True)
        label_options = [{
            'label': label,
            'value': label
        } for label in pca_data.labels]
        results_exist = pca_data.results_exist
        pc_options = pca_data.get_pc_options()
    except:
        label_options = []
        results_exist = False
        pc_options = []
    plot_data = PCAModel.get_plot_data()
    return dbc.Card(
        dbc.CardBody(
            dbc.Form([
                html.H5('Scores Plots'),
                dbc.Row([
                    dbc.Col([
                        dbc.FormGroup([
                            dbc.Label('x-axis', html_for='abscissa-select'),
                            dcc.Dropdown(id='abscissa-select',
                                         options=pc_options,
                                         multi=False,
                                         value=0)
                        ])
                    ]),
                    dbc.Col([
                        dbc.FormGroup([
                            dbc.Label('y-axis', html_for='ordinate-select'),
                            dcc.Dropdown(id='ordinate-select',
                                         options=pc_options,
                                         multi=False,
                                         value=1)
                        ])
                    ]),
                    dbc.Col([
                        dbc.FormGroup([
                            dbc.Label('z-axis', html_for='applicate-select'),
                            dcc.Dropdown(id='applicate-select',
                                         options=[{
                                             'label': f'None',
                                             'value': -1
                                         }] + pc_options,
                                         multi=False,
                                         value=-1)
                        ])
                    ]),
                    dbc.Col([
                        dbc.FormGroup([
                            dbc.Label('Color by label(s)',
                                      html_for='color-by-select'),
                            dcc.Dropdown(id='color-by-select',
                                         options=label_options,
                                         multi=True)
                        ])
                    ]),
                    dbc.Col([
                        dbc.FormGroup([
                            dbc.Label('Point label(s)',
                                      html_for='label-by-select'),
                            dcc.Dropdown(id='label-by-select',
                                         options=label_options,
                                         multi=True)
                        ])
                    ]),
                    dbc.Col([
                        dbc.FormGroup([
                            dbc.Label([
                                'Encircle metric',
                                html.Abbr(
                                    '\uFE56',
                                    title=
                                    'This will draw an oval shape to represent a category\'s'
                                    ' spread. These can be stacked as concentric rings.\n'
                                    'SEM: standard error of the mean\n'
                                    '\u03C3: standard deviation\n')
                            ],
                                      html_for='encircle-by-select'),
                            dcc.Dropdown(id='encircle-by-select',
                                         options=[
                                             {
                                                 'label': '2 SEM',
                                                 'value': '2sem'
                                             },
                                             {
                                                 'label': 'SEM',
                                                 'value': '1sem'
                                             },
                                             {
                                                 'label': '2\u03C3',
                                                 'value': '2std'
                                             },
                                             {
                                                 'label': '\u03C3',
                                                 'value': '1std'
                                             },
                                             {
                                                 'label': 'Range',
                                                 'value': 'range'
                                             },
                                             {
                                                 'label': '95% Confidence',
                                                 'value': '95conf'
                                             },
                                             {
                                                 'label': '95th percentile',
                                                 'value': '95percentile'
                                             },
                                         ],
                                         multi=True)
                        ])
                    ])
                ],
                        className='form-row'),
                dbc.Row([
                    html.Div([
                        dbc.Checkbox(id='db-index'),
                        dbc.Label([
                            ' Include DB index table?',
                            html.Abbr(
                                '\uFE56',
                                title=
                                'Davies-Bouldin indices are calculated from the "Color by" label'
                            )
                        ],
                                  className='form-check-label',
                                  html_for='db-index')
                    ],
                             className='form-check form-check-inline')
                ],
                        className='form-row'),
                dbc.Row([
                    html.Div([
                        dbc.Checkbox(id='centroid'),
                        dbc.Label([
                            ' Mark centroids?',
                            html.Abbr(
                                '\uFE56',
                                title=
                                'Centroids are calculated from the "Color by" label.'
                            )
                        ],
                                  className='form-check-label',
                                  html_for='centroid')
                    ],
                             className='form-check form-check-inline')
                ],
                        className='form-row'),
                dbc.Row([
                    html.Div([
                        dbc.Checkbox(id='medoid'),
                        dbc.Label([
                            ' Mark medoids?',
                            html.Abbr(
                                '\uFE56',
                                title=
                                'Medoids are calculated from the "Color by" label.'
                            )
                        ],
                                  className='form-check-label',
                                  html_for='medoid')
                    ],
                             className='form-check form-check-inline')
                ],
                        className='form-row'),
                dbc.Row([], className='form-row'),
                dbc.Row([
                    dbc.FormGroup([
                        dbc.Button([html.I(className='fas fa-plus'), ' Add'],
                                   id='score-plot-add-button',
                                   className='btn btn-success')
                    ])
                ],
                        className='form-row'),
                dbc.Row([
                    dbc.ListGroup([
                        dbc.ListGroupItem(
                            f'PC{score_plot["ordinate"] + 1} vs PC{score_plot["abscissa"] + 1} '
                            f'by {score_plot["color_by"]}') for score_plot in
                        PCAModel.get_plot_data()["score_plots"]
                    ],
                                  id='score-plot-list')
                ],
                        className='form-row',
                        id='score-plot-list-wrapper'),
                dbc.Row([
                    dbc.FormGroup([
                        dbc.Button(
                            [html.I(className='fas fa-eraser'), ' Clear'],
                            id='score-plot-clear-button',
                            className='btn btn-danger')
                    ])
                ],
                        className='form-row'),
                html.Br(),
                html.H5('Loadings Plots'),
                dbc.Row([
                    dbc.Col([
                        dbc.FormGroup([
                            dbc.Label('Loadings', html_for='loading-select'),
                            dcc.Dropdown(
                                id='loading-select', options=[], multi=True)
                        ])
                    ]),
                ],
                        className='form-row'),
                dbc.Row([
                    dbc.FormGroup([
                        dbc.Button([html.I(className='fas fa-plus'), ' Add'],
                                   id='loading-plot-add-button',
                                   className='btn btn-success')
                    ])
                ],
                        className='form-row'),
                dbc.Row([
                    dbc.ListGroup([
                        dbc.ListGroupItem(
                            PCAModel.component_list(plot['indices']))
                        for plot in plot_data['loading_plots']
                    ],
                                  id='loading-plot-list')
                ],
                        className='form-row',
                        id='loading-plot-list-wrapper'),
                dbc.Row([
                    dbc.FormGroup([
                        dbc.Button(
                            [html.I(className='fas fa-eraser'), ' Clear'],
                            id='loading-plot-clear-button',
                            className='btn btn-danger')
                    ])
                ],
                        className='form-row'),
                html.Br(),
                html.H5('Variance Plots'),
                dbc.Row([
                    dbc.Col([
                        dbc.FormGroup([
                            dbc.Label('PCs', html_for='variance-select'),
                            dcc.Dropdown(
                                id='variance-select', options=[], multi=True)
                        ])
                    ])
                ],
                        className='form-row'),
                dbc.Row([
                    html.Div([
                        dbc.Checkbox(id='variance-autoscale'),
                        dbc.Label(' Scale y axis?',
                                  className='form-check-label',
                                  html_for='variance-autoscale')
                    ],
                             className='form-check form-check-inline')
                ],
                        className='form-row'),
                dbc.Row([
                    dbc.FormGroup([
                        dbc.Button([html.I(className='fas fa-plus'), ' Add'],
                                   id='variance-plot-add-button',
                                   className='btn btn-success')
                    ])
                ],
                        className='form-row'),
                dbc.Row([
                    dbc.ListGroup([
                        dbc.ListGroupItem(
                            PCAModel.component_list(plot['indices']) +
                            (' (scaled y-axis)' if plot['scale_y'] else ''))
                        for plot in plot_data['variance_plots']
                    ],
                                  id='variance-plot-list')
                ],
                        className='form-row',
                        id='variance-plot-list-wrapper'),
                dbc.Row([
                    dbc.FormGroup([
                        dbc.Button(
                            [html.I(className='fas fa-eraser'), ' Clear'],
                            id='variance-plot-clear-button',
                            className='btn btn-danger')
                    ])
                ],
                        className='form-row'),
                html.H5('Cumulative Variance Plots'),
                dbc.Row([
                    dbc.Col([
                        dbc.FormGroup([
                            dbc.Label('Variance Threshold',
                                      html_for='cumulative-variance-input'),
                            dbc.Input(id='cumulative-variance-input',
                                      type='number',
                                      value=95)
                        ])
                    ])
                ],
                        className='form-row'),
                dbc.Row([
                    dbc.FormGroup([
                        dbc.Button([html.I(className='fas fa-plus'), ' Add'],
                                   id='cumulative-variance-plot-add-button',
                                   className='btn btn-success')
                    ])
                ],
                        className='form-row'),
                dbc.Row([
                    dbc.ListGroup([
                        dbc.ListGroupItem([
                            f"{cumulative_variance_plot['threshold']}"
                            for cumulative_variance_plot in PCAModel.
                            get_plot_data()['cumulative_variance_plots']
                        ])
                    ],
                                  id='cumulative-variance-plot-list')
                ],
                        className='form-row',
                        id='cumulative-variance-plot-list-wrapper'),
                dbc.Row([
                    dbc.FormGroup([
                        dbc.Button(
                            [html.I(className='fas fa-eraser'), ' Clear'],
                            id='cumulative-variance-plot-clear-button',
                            className='btn btn-danger')
                    ])
                ],
                        className='form-row')
            ])))
Пример #8
0
def get_opls_options_form():
    try:
        collection_options = [{
            'label': f'{collection.id}: {collection.name}',
            'value': collection.id
        } for collection in get_collections(current_user, {'kind': 'data'})]
    except:
        collection_options = []
    try:
        opls_data = OPLSModel(load_data=True)
        label_options = [{
            'label': label,
            'value': label
        } for label in opls_data.labels]
        label_options_with_type = [{
            'label': label,
            'value': label
        } for label in opls_data.get_label_data(True)]
        loaded_badges = opls_data.get_collection_badges()
        collection_load_info = opls_data.get_collection_load_info()
    except:
        loaded_badges = [
            html.Span([dbc.Badge('None', className='badge-pill')])
        ]
        collection_load_info = 'Loaded collections.'
        label_options = []
        label_options_with_type = []

    return dbc.Form([
        dbc.Row([
            dbc.Col([
                dbc.FormGroup([
                    dbc.Label('Collection ID', html_for='collection-id'),
                    dcc.Dropdown(options=collection_options,
                                 id='collection-id',
                                 multi=False)
                ])
            ]),
            dbc.Col([
                dbc.FormGroup([
                    dbc.Label(collection_load_info,
                              html_for='loaded-display',
                              id='collections-label'),
                    dcc.Loading([
                        dbc.InputGroup([
                            dbc.Button('Get',
                                       id='get-collection',
                                       className='col-sm-2 btn-success'),
                            html.H4(loaded_badges,
                                    id='loaded-collections',
                                    className='col-sm-10')
                        ],
                                       id='loaded-display')
                    ])
                ])
            ])
        ]),
        dbc.Row([
            dbc.Col([
                dbc.FormGroup([
                    dbc.Label([
                        'Target variable.',
                        html.Abbr('\uFE56', title='The target ("y") variable.')
                    ],
                              html_for='target-variable'),
                    dcc.Dropdown(id='target-variable',
                                 options=label_options_with_type,
                                 multi=False)
                ])
            ]),
            dbc.Col([
                dbc.FormGroup([
                    dbc.Label([
                        'Regression type.',
                        html.Abbr('\uFE56',
                                  title='For categorical target variables,'
                                  ' choose Discrimination. When The'
                                  ' magnitudes of values are important'
                                  ' choose Regression.')
                    ],
                              html_for='regression-type'),
                    dcc.Dropdown(id='regression-type',
                                 options=[{
                                     'label': 'Regression',
                                     'value': 'regression'
                                 }, {
                                     'label': 'Discrimination',
                                     'value': 'discrimination'
                                 }],
                                 multi=False)
                ])
            ]),
            dbc.Col([
                dbc.FormGroup([
                    dbc.Label([
                        'Multiclass discrimination behavior',
                        html.Abbr(
                            '\uFE56',
                            title=
                            'How to handle multiclass targets. One regressor is'
                            ' created for each class or pair of classes and the '
                            'cross-validation is performed on each one separately. '
                            '"One v. One" will try to discriminate between each pair'
                            ' of classes. "One v. All" will discriminate each class '
                            'from all the other classes. You can select both.\n\n'
                            'If "Regression" is selected in the previous option, an '
                            'attempt will be made to coerce the values of the target '
                            'variable into floating-point numbers and treat the target '
                            'as a continuous variable and this option will be ignored.'
                        )
                    ],
                              html_for='multiclass-behavior'),
                    dcc.Dropdown(id='multiclass-behavior',
                                 options=[{
                                     'label': 'One v. one',
                                     'value': 'one_v_one',
                                 }, {
                                     'label': 'One v. all',
                                     'value': 'one_v_all'
                                 }],
                                 multi=True)
                ])
            ]),
        ]),
        dbc.Row([
            dbc.Col([
                dbc.FormGroup([
                    dbc.Label([
                        'Cross-validation folds',
                        html.Abbr(
                            '\uFE56',
                            title=
                            'The number of test/train splits for the test to determine '
                            'the significance of regression quality metrics.')
                    ],
                              html_for='cross-val-k'),
                    dbc.Input(id='cross-val-k',
                              type='number',
                              value=-1,
                              min=-1)
                ])
            ]),
            dbc.Col([
                dbc.FormGroup([
                    dbc.Label([
                        'Minimum orthogonal components.',
                        html.Abbr(
                            '\uFE56',
                            title=
                            'The minimum number of orthogonal components to remove.'
                        )
                    ],
                              html_for='min-n-components'),
                    dbc.Input(id='min-n-components',
                              type='number',
                              value=1,
                              min=1)
                ])
            ]),
        ]),
        dbc.Row([
            dbc.Col([
                dbc.FormGroup([
                    dbc.Label([
                        'Inner test \u03B1',
                        html.Abbr(
                            '\uFE56',
                            title=
                            'A two-sided p-value threshold which is used to determine '
                            'which features need further scrutiny.')
                    ],
                              html_for='inner-test-alpha'),
                    dbc.Input(id='inner-test-alpha',
                              type='number',
                              value=0.2,
                              step=0.05)
                ])
            ]),
            dbc.Col([
                dbc.FormGroup([
                    dbc.Label([
                        'Outer test \u03B1',
                        html.Abbr(
                            '\uFE56',
                            title=
                            'A two-sided p-value threshold which is used to determine '
                            'which features are significant.')
                    ],
                              html_for='outer-test-alpha'),
                    dbc.Input(id='outer-test-alpha',
                              type='number',
                              value=0.01,
                              step=0.01)
                ])
            ])
        ]),
        dbc.Row([
            dbc.Col([
                dbc.FormGroup([
                    dbc.Label([
                        'Metric test permutations',
                        html.Abbr(
                            '\uFE56',
                            title=
                            'How many permutations (of the target) to determine '
                            'p-values for regression quality metrics.')
                    ],
                              html_for='permutations'),
                    dbc.Input(id='permutations', type='number', value=1000)
                ])
            ]),
            dbc.Col([
                dbc.FormGroup([
                    dbc.Label([
                        'Inner test permutations',
                        html.Abbr(
                            '\uFE56',
                            title=
                            'How many permutations (of the data in one feature) to '
                            'perform for every feature to estimate its significance.'
                        )
                    ],
                              html_for='inner-permutations'),
                    dbc.Input(id='inner-permutations',
                              type='number',
                              value=100)
                ])
            ]),
            dbc.Col([
                dbc.FormGroup([
                    dbc.Label([
                        'Outer test permutations',
                        html.Abbr(
                            '\uFE56',
                            title=
                            'How many permutations (of the data in one feature) to '
                            'perform for every feature determined to be potentially '
                            'significant in the first round.')
                    ],
                              html_for='outer-permutations'),
                    dbc.Input(id='outer-permutations',
                              type='number',
                              value=500)
                ])
            ])
        ]),
        dbc.Row([
            dbc.Col([
                dbc.FormGroup([
                    dbc.Label([
                        'Scale by label(s)',
                        html.Abbr(
                            '\uFE56',
                            title=
                            'The mean of the records satisfying conditions on these '
                            'fields will be subtracted from each record, then each'
                            ' record will be scaled by the standard deviation of the'
                            ' records satisfying the conditions.')
                    ],
                              html_for='scale-by'),
                    dcc.Dropdown(id='scale-by',
                                 options=label_options,
                                 multi=True),
                ])
            ]),
            dbc.Col([
                dbc.FormGroup([
                    dbc.Label([
                        'Scale by conditions',
                        html.Abbr(
                            '\uFE56',
                            title=
                            'The conditions for the records to use for scaling. If '
                            'left blank, then no scaling is performed.')
                    ],
                              html_for='scale-by-value'),
                    dcc.Dropdown(id='scale-by-value',
                                 options=[{
                                     'label': 'All Records',
                                     'value': 'index'
                                 }],
                                 multi=True),
                ])
            ])
        ]),
        dbc.Row([
            dbc.Col([
                dbc.FormGroup([
                    dbc.Label([
                        'Model by label(s)',
                        html.Abbr(
                            '\uFE56',
                            title=
                            'Only consider records satisfying conditions on these'
                            ' fields.')
                    ],
                              html_for='model-by'),
                    dcc.Dropdown(id='model-by',
                                 options=label_options,
                                 multi=True)
                ])
            ]),
            dbc.Col([
                dbc.FormGroup([
                    dbc.Label([
                        'Model by conditions',
                        html.Abbr(
                            '\uFE56',
                            title=
                            'The conditions which must be satisfied for the records'
                            'to be considered.')
                    ],
                              html_for='model-by-value'),
                    dcc.Dropdown(id='model-by-value', options=[], multi=True)
                ])
            ])
        ]),
        dbc.Row([
            dbc.Col([
                dbc.FormGroup([
                    dbc.Label([
                        'Ignore by label(s)',
                        html.Abbr(
                            '\uFE56',
                            title=
                            'Exclude records satisfying conditions on these fields'
                        )
                    ],
                              html_for='ignore-by'),
                    dcc.Dropdown(id='ignore-by',
                                 options=label_options,
                                 multi=True)
                ])
            ]),
            dbc.Col([
                dbc.FormGroup([
                    dbc.Label([
                        'Ignore by conditions',
                        html.Abbr(
                            '\uFE56',
                            title=
                            'Conditions which apply to records to be excluded.'
                        )
                    ],
                              html_for='ignore-by-value'),
                    dcc.Dropdown(id='ignore-by-value', options=[], multi=True)
                ])
            ])
        ]),
        dbc.Row([
            dbc.Col([
                dbc.FormGroup([
                    dbc.Label([
                        'Pair on label(s)',
                        html.Abbr(
                            '\uFE56',
                            title=
                            'The paired analysis works on the difference between '
                            'records in one class and other records, where the '
                            'records are "paired" by some identity condition. The '
                            '"pair on" label is used to pair all the records with '
                            'equal values for that field.')
                    ],
                              html_for='pair-on'),
                    dcc.Dropdown(id='pair-on',
                                 options=label_options,
                                 multi=True)
                ])
            ]),
            dbc.Col([
                dbc.FormGroup([
                    dbc.Label([
                        'Pair with label(s)',
                        html.Abbr(
                            '\uFE56',
                            title=
                            'The "pair with" condition applies to the records to be '
                            'subtracted from the others')
                    ],
                              html_for='pair-with'),
                    dcc.Dropdown(id='pair-with',
                                 options=label_options,
                                 multi=True)
                ])
            ]),
            dbc.Col([
                dbc.FormGroup([
                    dbc.Label([
                        'Pair with conditions',
                        html.Abbr(
                            '\uFE56',
                            title=
                            'The condition which must apply for the records which '
                            'will be subtracted.')
                    ],
                              html_for='pair-with-value'),
                    dcc.Dropdown(id='pair-with-value', options=[], multi=True)
                ])
            ]),
        ]),
        dbc.FormGroup([
            dcc.Loading([
                dbc.Button('Run OPLS',
                           id='opls-button',
                           color='primary',
                           className='btn btn-block form-control'),
                html.Small('', id='message', className='form-text')
            ])
        ])
    ])
Пример #9
0
     This app is constructed using Dash, a web application framework for Python. Any questions, suggestion or comments mail [email protected]
 '''),
 #html.ObjectEl(type="text/html",name='../myvinkhead.cgi'),
 html.Br(),
 html.Div(children='This application can be used to assess the fire weather risk, quantified by the monthly drought code, for the following fire season. The seasonal forecasts is based on a statistical emprical forecasting model, which uses past observations to deduce relations between the weather in the last three months (up to the beginning of the month) and the weather over the next months (from the end of the month). The main predictors are large scale climate indices (such as e.g. El Nino), the trends due to global warming and the previous value of the MDC. Overfitting is avoided as much as possible. The system has been documented in Eden et al. 2015 and Eden et al. 2019.'),
 html.Div(children='- The dropdown menus allow to change the region of interest, forecast starting time, forecast lead times, plot type'),
 html.Div(children='- By clicking on the map you can further specify the region of interest. The square denotes the region on which the subsequent figures are based on'),
 html.Br(),
 dcc.Link('Click here to examine the sources of predictability', href=bd2+'/kprep-mdc-sop'),
 html.Br(),
 dcc.Link('Click here to examine predictor-predictand relations', href=bd2+'/kprep-mdc-pp'),
 html.Br(),
 html.Br(),
 html.Br(),
 html.Br(),   
 html.Abbr(" \u003F ",title='Select your region of interest'),  
 html.Div(children='Select region',style={'width': '19vh', 'display': 'inline-block'}),
 html.Abbr(" \u003F ",title='Select the forecast variable:'),    
 html.Div(children='Select forecasted variable',style={'width': '19vh', 'display': 'inline-block'}),
 html.Abbr(" \u003F ",title='Select the plot type'),     
 html.Div(children='Select plot type',style={'width': '19vh', 'display': 'inline-block'}),
 html.Abbr(" \u003F ",title='Select the month when the forecast is started from. Preferably, choose the latest month available for the most accurate forecast'),     
 html.Div(children='Select forecast base time',style={'width': '19vh', 'display': 'inline-block'}),
 html.Abbr(" \u003F ",title='Select the month for which you want the information. The data is plotted in Figure 1'), 
 html.Div(children='Select forecast valid time',style={'width': '19vh', 'display': 'inline-block'}),
 html.Abbr(" \u003F ",title='Select the area size, the data shown in figure 2 is the area averaged data over this area'),     
 html.Div(children='Select area size',style={'width': '19vh', 'display': 'inline-block'}),
 html.Br(),
          #Select forecasted variable        Select plottype  Select forecast base time   Select valid forecast time'),
 # Create dropdown menu to choose region
 html.Div([
Пример #10
0
                  } for i in dfx.columns],
                  value='att7'),
 ]),
 dbc.FormGroup([
     dbc.Label("Select y"),
     dcc.Dropdown(id='y-filter',
                  options=[{
                      'label': i.title(),
                      'value': i
                  } for i in dfx.columns],
                  value='att9')
 ]),
 dbc.FormGroup([
     html.Abbr(
         "Size of the points",
         title=
         "greater the size of the point, larger the value of the indicator"
     ),
     dcc.Dropdown(id='size-filter',
                  options=[{
                      'label': i.title(),
                      'value': i
                  } for i in prek_opt],
                  value='P')
 ]),
 dbc.FormGroup([
     html.Abbr(
         "Select demographic 1",
         title="Select a demographic variable for the violin plot"),
     dcc.Dropdown(
         id='cat1-filter',
Пример #11
0
         html.P(
             [
                 "The following is rendered in bold text ",
                 html.Strong("using html.Strong"),
             ]
         ),
         html.P(
             [
                 "The following is rendered in italics ",
                 html.Em("using html.Em"),
             ]
         ),
         html.P(
             [
                 "html.Abbr represents an abbreviation or acronym like this:",
                 html.Abbr("abbr", title="abbreviation"),
             ]
         ),
     ],
     className="p-4",
     lg=4,
 ),
 dbc.Col(
     [
         html.H2("Emphasis classes"),
         html.P(
             "text with className='text-muted'",
             className="text-muted",
         ),
         html.P(
             "Text with className='text-primary'",
Пример #12
0
def layout_multiseq_params_div():
    return html.Div(children=[
        html.Table([
            html.Tr([
                html.Th([
                    'For >1 input sequence ',
                    html.Abbr(
                        '\u24D8',
                        title=
                        'For best performance when calculating shared oligos, align your sequences using a tool such as CLUSTAL or MUSCLE and output as a FASTA file prior to uploading here'
                    )
                ],
                        colSpan=2,
                        style={'textAlign': 'left'}),
                html.Th()
            ]),
            html.Tr([
                html.Td(dcc.RadioItems(
                    id='multi-mode-radio',
                    options=[
                        {
                            'label':
                            'Independently design oligos for each sequence',
                            'value': 'basic'
                        },
                        {
                            'label':
                            'Sequences are not aligned, design shared oligos',
                            'value': 'combined'
                        },
                        {
                            'label':
                            'Sequences are aligned, design shared oligos',
                            'value': 'aligned'
                        },
                    ],
                    value='basic',
                    labelStyle={'display': 'inline-block'}),
                        colSpan=3)
            ]),
        ]),
        html.Div(
            id='shared-oligo-params',
            children=[
                html.Table([
                    html.Tr([
                        html.Td([], style={'width': '30px'}),
                        html.Td([
                            html.Div(
                                'Max wildcard expansions',
                                style={'font-weight': 'normal'})
                        ]),
                        html.
                        Td([
                            dcc.Input(id='num-wildcards-input',
                                      type='number',
                                      min=1,
                                      max=16,
                                      placeholder='1 = no wildcards'),
                            html.
                            Abbr(
                                "\u24D8",
                                title=
                                'Wildcards represent combinations of bases (e.g., R means A or G, N means any base). Expansions are the number of targets per oligo, as a function of number of wildcards encoded. E.g., 0 wildcards = 1 expansion, 2 wildcards each representing 2 possible bases is 2x2 = 4 total expansions'
                            )
                        ])
                    ]),
                    html.Tr([
                        html.Td([]),
                        html.Td([
                            dcc.Checklist(id='trim-wildcards-checkbox',
                                          options=[{
                                              'label':
                                              'Trim terminal wildcards',
                                              'value': 'trim'
                                          }],
                                          value=['trim'])
                        ]),
                        html.Td([
                            html.Abbr(
                                '\u24D8',
                                title=
                                'If an oligo begins or ends with a wildcard base, trim it off even if it violates the oligo length range'
                            )
                        ])
                    ])
                ])
            ])
    ])
Пример #13
0
def get_options_form():
    try:
        collection_options = [{
            'label': f'{collection.id}: {collection.name}',
            'value': collection.id
        } for collection in get_collections(current_user, {'kind': 'data'})]
        analysis_options = [{
            'label': f'{analysis.id}: {analysis.name}',
            'value': analysis.id
        } for analysis in get_analyses(current_user)]
    except:
        collection_options = []
        analysis_options = []
    try:
        editor_data = CollectionEditorModel(load_data=True)
        label_options = [{
            'label': label,
            'value': label
        } for label in editor_data.labels]
        loaded_badges = editor_data.get_collection_badges()
        collection_load_info = editor_data.get_collection_load_info()
        if len(loaded_badges) == 2:
            collection_ids = editor_data.unique_vals('original_collection_id')
            collection_id_options = [{
                'label': f'collection_id={i}',
                'value': i
            } for i in collection_ids]
        else:
            collection_id_options = []
    except:
        loaded_badges = [
            html.Span([dbc.Badge('None', className='badge-pill')])
        ]
        collection_load_info = 'Loaded collections.'
        label_options = []
        collection_id_options = []

    return dbc.Form([
        dbc.Row([
            dbc.Col([
                dbc.FormGroup([
                    dbc.Label('Collection IDs', html_for='collection-id'),
                    dcc.Dropdown(options=collection_options,
                                 id='collection-id',
                                 multi=True)
                ])
            ]),
            dbc.Col([
                dbc.FormGroup([
                    dbc.Label(collection_load_info,
                              html_for='loaded-display',
                              id='collections-label'),
                    dcc.Loading([
                        dbc.InputGroup([
                            dbc.Button('Get',
                                       id='get-collection',
                                       className='col-sm-2 btn-success'),
                            html.H4(loaded_badges,
                                    id='loaded-collections',
                                    className='col-sm-10')
                        ],
                                       id='loaded-display')
                    ])
                ])
            ])
        ]),
        html.H5('Filter/Join Collections'),
        dbc.Row([
            dbc.Col([
                dbc.FormGroup([
                    dbc.Label([
                        'Filter by label(s)',
                        html.Abbr(
                            '\uFE56',
                            title=
                            'Only consider records satisfying conditions on these'
                            ' fields.')
                    ],
                              html_for='filter-by'),
                    dcc.Dropdown(id='filter-by',
                                 options=label_options,
                                 multi=True)
                ])
            ]),
            dbc.Col([
                dbc.FormGroup([
                    dbc.Label([
                        'Filter by conditions',
                        html.Abbr(
                            '\uFE56',
                            title=
                            'The conditions which must be satisfied for the records'
                            'to be considered.')
                    ],
                              html_for='filter-by-value'),
                    dcc.Dropdown(id='filter-by-value', options=[], multi=True)
                ])
            ])
        ]),
        dbc.Row([
            dbc.Col([
                dbc.FormGroup([
                    dbc.Label([
                        'Ignore by label(s)',
                        html.Abbr(
                            '\uFE56',
                            title=
                            'Exclude records satisfying conditions on these fields'
                        )
                    ],
                              html_for='ignore-by'),
                    dcc.Dropdown(id='ignore-by',
                                 options=label_options,
                                 multi=True)
                ])
            ]),
            dbc.Col([
                dbc.FormGroup([
                    dbc.Label([
                        'Ignore by conditions',
                        html.Abbr(
                            '\uFE56',
                            title=
                            'Conditions which apply to records to be excluded.'
                        )
                    ],
                              html_for='ignore-by-value'),
                    dcc.Dropdown(id='ignore-by-value', options=[], multi=True)
                ])
            ])
        ]),
        dbc.Row([
            dbc.Col([
                dbc.FormGroup([
                    dbc.Label([
                        'Join on label(s)',
                        html.Abbr(
                            '\uFE56',
                            title=
                            'A combination of values forming a unique key on which '
                            'the two collections are joined.')
                    ],
                              html_for='join-on'),
                    dcc.Dropdown(id='join-on',
                                 options=label_options,
                                 multi=True,
                                 disabled=(len(loaded_badges) != 2))
                ])
            ]),
            dbc.Col([
                dbc.FormGroup([
                    dbc.Label([
                        '"Left" Collection ID',
                        html.Abbr(
                            '\uFE56',
                            title=
                            'The collection id for the collection which will have '
                            'positive values for "x" and appear on the left side of '
                            'the plots')
                    ],
                              html_for='positive-collection'),
                    dcc.Dropdown(id='positive-collection',
                                 options=collection_id_options,
                                 multi=False,
                                 disabled=(len(loaded_badges) != 2))
                ])
            ])
        ]),
        html.H5('Post Collection'),
        dbc.Row([
            dbc.Col([
                dbc.FormGroup([
                    dbc.Label('Name', html_for='name-input-wrapper-wrapper'),
                    html.Div(html.Div(dbc.Input(id='name-input'),
                                      id='name-input-wrapper'),
                             id='name-input-wrapper-wrapper')
                ])
            ]),
            dbc.Col([
                dbc.FormGroup([
                    dbc.Label('Analyses', html_for='analysis-select'),
                    dcc.Dropdown(id='analysis-select',
                                 options=analysis_options,
                                 multi=True)
                ])
            ]),
            dbc.Col([
                dbc.FormGroup([
                    dbc.Label('Post', html_for='post-button-group'),
                    dbc.FormGroup([
                        dbc.Button(
                            [html.I(className='fas fa-upload'), ' Post'],
                            id='post-button',
                            className='btn btn-success')
                    ],
                                  id='post-button-group')
                ])
            ])
        ],
                className='form-row'),
        dcc.Loading(html.Small('', id='post-message', className='form-text'))
        # will inject link when results posted
    ])
Пример #14
0
             className="radio-tab",
             style=radio_tab_style,
             selected_style=tab_selected_style)
     ]),
 html.Div(
     className="row padding-top-bot",
     children=[
         html.Div(
             className="nine columns",
             children=[
                 html.Abbr(
                     className="pretty-abbr",
                     title=
                     "Automatically creating pdf copy of chart after downloading this chart.",
                     children=[
                         dcc.Markdown(
                             className=
                             "pretty-markdown-left",
                             children=[
                                 "**Auto-PDF**"
                             ])
                     ]),
             ],
             style={
                 "padding-top": "6px",
             }),
         html.Div(className="three columns",
                  children=[
                      daq.BooleanSwitch(
                          id="pdf-copy",
                          on=True,
                      ),
Пример #15
0
                            {
                                'label': 'PA14',
                                'value': 'PA14'
                            },
                        ],
                        value='PAO1')
     ]),
 ],
         width=2),
 dbc.Col([
     html.Div([
         'Select the network order: ',
         html.Abbr(
             '?',
             title=
             (('Zero-order: Maps direct interactions between your queried genes. '
               '\nRecommended for long lists (>200 genes).'
               '\n\nFirst-order: Uses your queried genes as "seed" genes and finds any '
               'interaction between them and the other genes in the database. '
               '\nRecommended for short lists (<200 genes).'))),
         dbc.RadioItems(id='order',
                        options=[
                            {
                                'label': 'Zero-order',
                                'value': 0
                            },
                            {
                                'label': 'First-order',
                                'value': 1
                            },
                        ],
                        value=0)
Пример #16
0
def make_vis_layout(network_df, enrichment_results, cyto_network,
                    network_params):
    """Generates a custom layout depending on the network type."""
    network_params = json.loads(network_params)

    # This filter is only used with RNASeq/Combined networks
    regulation_filter = html.Details(
        id='diff-exp-details',
        open=True,
        children=[
            html.Summary('By differential expression'),
            dbc.Checklist(
                # ID type for pattern matching callback
                id={
                    'type': 'filter',
                    'index': 3
                },
                options=[{
                    'label': 'Up-Regulated',
                    'value': 'up'
                }, {
                    'label': 'Down-Regulated',
                    'value': 'down'
                }],
                value=[],
            )
        ],
    )

    # This filter is only used with Combined networks
    source_filter = html.Details(
        id='source-details',
        open=True,
        children=[
            html.Summary('By experiment '),
            dbc.Checklist(
                # ID type for pattern matching callback
                id={
                    'type': 'filter',
                    'index': 4
                },
                options=[{
                    'label': 'RNA-Seq',
                    'value': 'RNASeq'
                }, {
                    'label': 'Tn-Seq',
                    'value': 'TnSeq'
                }],
                value=[],
            )
        ],
    )

    # These filters are used for all networks
    sidebar_filters = [
        html.H5('Select nodes'),
        html.Details(
            open=True,
            children=[
                html.Summary('By name'),
                dcc.Dropdown(
                    # ID type for pattern-matching callback
                    id={
                        'type': 'filter',
                        'index': 0
                    },
                    # Allow search by both short name and locus tag (index)
                    options=[{
                        'label': term,
                        'value': term
                    } for term in network_df['shortName']] + [{
                        'label': term,
                        'value': term
                    } for term in network_df.index],
                    multi=True,
                    optionHeight=50)
            ],
        ),
        html.Br(),
        html.Details(
            open=True,
            children=[
                html.Summary('By localization '),
                dcc.Dropdown(
                    # ID type for pattern-matching callback
                    id={
                        'type': 'filter',
                        'index': 1
                    },
                    options=[
                        dict(label=location, value=location)
                        for location in network_df['localization'].unique()
                    ],
                    multi=True,
                )
            ],
        ),
        html.Br(),
        html.Details(
            open=True,
            children=[
                html.Summary('By enriched GO term'),
                dcc.Dropdown(
                    # ID type for pattern-matching callback
                    id={
                        'type': 'filter',
                        'index': 2
                    },
                    # Use enriched GO terms as options.
                    options=[{
                        'label': term,
                        'value': term
                    } for term in enrichment_results['name']],
                    multi=True,
                    optionHeight=50)
            ],
        ),
        html.Br()
    ]

    # Add extra filters for DE/Combined networks
    if network_params['type'] == 'rna_seq' or network_params[
            'type'] == 'combined':
        sidebar_filters.extend([regulation_filter, html.Br()])
        if network_params['type'] == 'combined':
            sidebar_filters.extend([source_filter])

    color_mapping = [html.Div(id='color-map'), html.Div(id='legend')]
    stylesheet = stylesheets.default
    # Add color mapping functionality for DE/Combined networks
    if network_params['type'] == 'gene_list':
        stylesheet = stylesheets.default
    elif network_params['type'] == 'rna_seq':
        color_mapping = [
            html.H5('Color Mapping'),
            html.Div(id='color-map'),
            html.Div(style={'padding': '10px'},
                     children=html.Img(src=app.get_asset_url('de_legend.svg'),
                                       id='legend',
                                       width=100))
        ]
        stylesheet = stylesheets.fold_change
    elif network_params['type'] == 'combined':
        color_mapping = [
            html.H5('Color Mapping'),
            dbc.RadioItems(
                options=[{
                    'label': 'Experiment',
                    'value': 'experiment'
                }, {
                    'label': 'Differential Expression',
                    'value': 'regulation'
                }],
                value='experiment',
                id='color-map',
            ),
            html.Div(style={'padding': '10px'},
                     children=html.Img(id='legend', width=100))
        ]

    # Layout begins here
    return html.Div([
        html.Div(
            style={
                'width': '24vw',
                'backgroundColor': '#a6edff',
                'padding': '10px',
                'display': 'inline-block',
                'height': 'calc(100vh - 65px)',
                'vertical-align': 'top',
                'overflow': 'auto'
            },
            children=[
                html.Div(color_mapping),
                # legend,
                dbc.Checklist(id='show-labels',
                              options=[{
                                  'label': 'Show node labels',
                                  'value': 1
                              }],
                              switch=True,
                              value=[]),
                html.Hr(),
                html.Div(id='full-network-panel',
                         children=[
                             html.Div(id='node-filters',
                                      children=sidebar_filters),
                             html.P(id='num-selected-nodes',
                                    style={'padding-top': '5px'}),
                             dbc.Button('Make Sub-Network',
                                        id='make-subnetwork',
                                        color='primary',
                                        style={'display': 'none'})
                         ]),
                html.Div(
                    id='subnetwork-btns',
                    style={'display': 'none'},
                    children=[
                        dbc.Checklist(id='include-extra-genes',
                                      options=[{
                                          'label': 'Include additional genes',
                                          'value': 1
                                      }],
                                      switch=True,
                                      value=[]),
                        html.Abbr(
                            'Help',
                            title=
                            (('Include additional genes, called Steiner nodes, that are are not '
                              'included in the original data, but help connect other genes that are. '
                              'Useful to connect subnetworks with '
                              'many smaller components.')),
                        ),
                        html.Br(),
                        dbc.Checklist(
                            id='include-low-confidence',
                            options=[{
                                'label': 'Include low-confidence interactions',
                                'value': 1
                            }],
                            switch=True,
                            value=[]),
                        html.Abbr(
                            'Help',
                            title=
                            (('Include all interactions in the subnetwork, instead of prioritizing '
                              'experimental interactions.')),
                        ),
                        html.Br(),
                        dbc.Button(
                            'Return to selection',
                            id='reset-network',
                            color='primary',
                        )
                    ]),
                html.Hr(),
                dbc.DropdownMenu(
                    id='download-dropdown',
                    color='primary',
                    style={'padding-top': '5px'},
                    label='Download',
                    direction='right',
                    children=[
                        dbc.DropdownMenuItem('Network (.graphml)',
                                             id='download-network'),
                        dbc.DropdownMenuItem('Network Image (.png)',
                                             id='download-network-img'),
                        dbc.DropdownMenuItem('Table (.csv)',
                                             id='download-table',
                                             style={'display': 'none'})
                    ]),
                Download(id='graphml-download'),
                Download(id='csv-download'),
                # Hidden Divs to store node details and subnetwork for download
                html.Div(id='filtered-node-details', style={'display':
                                                            'none'}),
                html.Div(id='hidden-subnetwork', style={'display': 'none'})
            ],
        ),
        html.Div(style={
            'display': 'inline-block',
            'width': '74vw'
        },
                 children=dbc.Container(
                     fluid=True,
                     children=[
                         dbc.Row([
                             dbc.Col(children=cyto.Cytoscape(
                                 id='main-view',
                                 style={
                                     'width': '100%',
                                     'height': 'calc(100vh - 80px)'
                                 },
                                 stylesheet=stylesheet,
                                 maxZoom=5,
                                 minZoom=0.3,
                                 zoom=1,
                                 layout={'name': 'preset'},
                                 elements=cyto_network,
                                 boxSelectionEnabled=True)),
                         ]),
                         dbc.Row(
                             dbc.Col(
                                 html.Div(id='node-details-table',
                                          style={'margin-top': '-25vh'})))
                     ]))
    ])
Пример #17
0
 html.Div(
     [
         html.H3('STEP 2', style={'margin-top': '0'}),
         html.Div(
             [
                 html.Div(
                     [
                         html.Div(
                             [
                                 html.P([
                                     'Insert crRNA sequence(s)',
                                     html.Abbr(
                                         '\uD83D\uDEC8',
                                         style={
                                             'text-decoration':
                                             'none'
                                         },
                                         title=
                                         'One sequence per line. All sequences must have the same lenght and PAM characters are not required'
                                     )
                                 ],
                                        style={
                                            'word-wrap':
                                            'break-word'
                                        }),
                                 dcc.Textarea(
                                     id='text-guides',
                                     placeholder=
                                     'GAGTCCGAGCAGAAGAAGAA\nCCATCGGTGGCCGTTTGCCC',
                                     style={
                                         'width': '275px',
final_list.append(
    html.Div(
        [
            html.P(['Download the offline version here: ', html.A('InfOmics/CRISPRitz', href = 'https://github.com/InfOmics/CRISPRitz', target="_blank"), ' or ', html.A('Pinellolab/CRISPRitz', href = 'https://github.com/pinellolab/CRISPRitz', target="_blank") ])
        ]
    )
)
checklist_div = html.Div(
    [
        dbc.FormGroup(
            [
                dbc.Checkbox(
                    id="checkbox-gecko", className="form-check-input"
                ),
                dbc.Label(
                    html.P(['Activate Gecko ', html.Abbr('comparison', title ='The results of your test guides will be compared with results obtained from a previous computed analysis on gecko library')]) ,
                    html_for="checkbox-gecko",
                    className="form-check-label",
                ),
                dbc.Checkbox(
                    id="checkbox-ref-comp", className="form-check-input"
                ),
                dbc.Label(
                    html.P(['Activate Reference genome ', html.Abbr('comparison', title ='The results of your test guides will be compared with the results obtained from a computed analysis on the corresponding reference genome. Note: this may increase computational time')]) ,
                    html_for="checkbox-ref-comp",
                    className="form-check-label",
                ),
                # dbc.Checkbox(
                #     id="checkbox-email", className="form-check-input"
                # ),
                # dbc.Label(
Пример #19
0
                         step=1,
                         value=age_off_site_range,
                         updatemode='drag',
                         allowCross=False),
         dbc.Label('', id='age-max-moved-off-site')
     ],
     style={
         'display': 'grid',
         'grid-template-columns': '6% 4% 80% 10%',
         'margin-bottom': '25px'
     }),
 html.Header([
     html.B('Residents with Comorbidity '),
     html.Abbr(
         '\u2139',
         title=
         'Comorbidity - the simultaneous presence of two or more diseases or medical conditions in a patient'
     ),
 ],
             className='card-text'),
 html.Header(
     'What is the total number of people with known comorbidity of COVID-19?',
     className='card-text',
     style={'color': 'darkgray'}),
 dbc.Input(id='number-known-comorbidity',
           placeholder='Optional',
           type='number',
           min=0,
           max=100000,
           step=1,
           bs_size='sm',
Пример #20
0
df = nuts_data.get_data()
import dash_bootstrap_components as dbc

import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import plotly.express as px

app = dash.Dash(external_stylesheets=[dbc.themes.BOOTSTRAP])

controls = dbc.Card(
    [
        dbc.FormGroup([
            html.Abbr(
                "Select one of the PREK indicator",
                title="The colors in the map show the value of the indicator"),
            dcc.Dropdown(
                id="PREK-filter",
                options=[{
                    'label': i.title(),
                    'value': i
                } for i in df.columns],
                value="PRG",
                clearable=False,
                className="dropdown",
            ),
        ]),
        dbc.FormGroup([
            html.Abbr(
                "Select Context Var(s)",