Esempio n. 1
0
def generate_TCGA_LUAD_MessengerRNA():
    return MessengerRNA(data=os.path.join(cohort_folder_path,
                                          "LUAD__geneExp.txt"),
                        transpose=True,
                        usecols="GeneSymbol|TCGA",
                        gene_index="GeneSymbol",
                        gene_level="gene_name")
Esempio n. 2
0
def get_expression_data(list_of_contents,
                        list_of_names,
                        data_type,
                        cohort_name=None,
                        genes_col_name=None,
                        columns_selected=None,
                        transposed=None):
    """
    Args:
        list_of_contents:
        list_of_names:
        data_type:
        cohort_name:
        genes_col_name:
        columns_selected:
        transposed:
    """
    if columns_selected:
        columns = "|".join(columns_selected)
    else:
        columns = None

    if transposed == "True":
        transposed = True
    elif transposed == "False":
        transposed = False

    file = handle_filestreams(list_of_contents, list_of_names)

    if data_type == MicroRNA.name():
        expression_data = MicroRNA(file, transpose=transposed, usecols=columns)
    elif data_type == MessengerRNA.name():
        expression_data = MessengerRNA(file,
                                       transpose=transposed,
                                       usecols=columns)
    elif data_type == LncRNA.name():
        expression_data = LncRNA(file, transpose=transposed, usecols=columns)
    elif data_type == Protein.name():
        expression_data = Protein(file, transpose=transposed, usecols=columns)
    else:
        print(data_type)

    return expression_data
Esempio n. 3
0
def test_TCGA_LUAD_multiomics_transcriptomics(generate_TCGA_LUAD):
    """
    Args:
        generate_TCGA_LUAD:
    """
    assert all(
        elem in generate_TCGA_LUAD.get_omics_list() for elem in
        [MessengerRNA.name(),
         MicroRNA.name(),
         LncRNA.name(),
         Protein.name()])
Esempio n. 4
0
def test_import_expression_table_size(generate_TCGA_LUAD_MessengerRNA,
                                      generate_TCGA_clinical):
    """
    Args:
        generate_TCGA_LUAD_MessengerRNA:
    """
    cohort_name = "LUAD"
    luad_data = MultiOmics(cohort_name)
    luad_data.add_clinical_data(generate_TCGA_clinical)
    luad_data.add_omic(generate_TCGA_LUAD_MessengerRNA)
    luad_data.build_samples()
    print(luad_data.data.keys())
    assert (luad_data.data[MessengerRNA.name()].shape ==
            generate_TCGA_LUAD_MessengerRNA.expressions.shape)
Esempio n. 5
0
def test_import_expression_table_size(generate_TCGA_LUAD_MessengerRNA):
    """
    Args:
        generate_TCGA_LUAD_MessengerRNA:
    """
    cohort_name = "LUAD"
    luad_data = MultiOmics(cohort_name)
    luad_data.add_clinical_data(clinical_data=os.path.join(
        cohort_folder_path,
        "nationwidechildrens.org_clinical_patient_luad.txt"))
    luad_data.add_omic(generate_TCGA_LUAD_MessengerRNA)
    luad_data.build_samples()
    print(luad_data.data.keys())
    assert luad_data.data[MessengerRNA.name(
    )].shape == generate_TCGA_LUAD_MessengerRNA.expressions.shape
Esempio n. 6
0
def generate_TCGA_LUAD_MessengerRNA():
    data = MessengerRNA(
        data=os.path.join(cohort_folder_path, "LUAD__geneExp.txt"),
        transpose=True,
        usecols="GeneSymbol|TCGA",
        gene_index="GeneSymbol",
        gene_level="gene_name",
    )
    data.drop_genes(data.expressions.columns[50:])
    data.drop_samples(data.expressions.index[:100])
    return data
Esempio n. 7
0
def generate_TCGA_LUAD_MessengerRNA_dask():
    data = MessengerRNA(
        data=os.path.join(cohort_folder_path, "LUAD__geneExp.txt"),
        transpose=True,
        usecols="GeneSymbol|TCGA",
        gene_index="GeneSymbol",
        gene_level="gene_name",
        npartitions=4,
    )
    data.drop_genes(data.expressions.columns[50:])
    data.initialize_annotations(index="gene_name", gene_list=None)

    return data
Esempio n. 8
0
def control_tabs():
    return html.Div(
        id='circos-control-tabs',
        className='control-tabs',
        children=[
            dcc.Tabs(
                id='circos-tabs',
                value='what-is',
                children=[
                    dcc.Tab(
                        label='Welcome',
                        value='what-is',
                        children=html.Div(
                            className='control-tab',
                            children=[
                                html.H5(className='what-is',
                                        children=
                                        "OpenOmics: The Multi-Omics Explorer"),
                                html.
                                P('OpenOmics provides a bioinformatics API and web-app '
                                  'platform integrate, analyze, and visualize the '
                                  'multi-omics and clinical data. You can interact with the '
                                  'data input tabs to integrate the various different data types '
                                  'including bio-databases, multi-omics expression, genomics, '
                                  'and clinical data.'),
                                html.Div([
                                    'Cite us at: ',
                                    html.
                                    A('OpenOmics paper',
                                      href=
                                      'http://www.doi.org/10.1101/gr.092759.109'
                                      ), '.'
                                ]),
                                html.Div([
                                    'For a look into the OpenOmics API and usage documentation, please visit the '
                                    'original repository ',
                                    html.
                                    A('OpenOmics GitHub',
                                      href=
                                      'https://github.com/JonnyTran/OpenOmics.git'
                                      ), '.'
                                ]),
                                html.Br(),
                                html.Button(id='start-button',
                                            style={"align": "center"},
                                            n_clicks=0,
                                            children='Get Started'),
                            ])),
                    dcc.Tab(
                        label='Import Clinical Data',
                        value='clinical-upload',
                        className='control-tab',
                        children=[
                            html.Div([
                                'Cohort name: ',
                            ]),
                            dcc.Input(
                                id='clinical-cohort',
                                style={'width': '100%'},
                                placeholder="Leave empty to use filename",
                                type='text'),
                            html.Br(),
                            html.Div(['Select clinical data type']),
                            dcc.RadioItems(
                                id='clinical-data-type',
                                options=[
                                    {
                                        'label': 'Patients data',
                                        'value': 'Patients data'
                                    },
                                    {
                                        'label': 'Samples data',
                                        'value': 'Samples data'
                                    },
                                    {
                                        'label': 'Drug responses',
                                        'value': 'Drug responses'
                                    },
                                ],
                                value='Patients data',
                            ),
                            html.Br(),
                            html.Div([
                                'Import Clinical Data',
                            ]),
                            html.Div(children=[
                                dcc.Upload(id='upload-clinical',
                                           children=html.Div([
                                               'Drag and Drop or ',
                                               html.A('Select Files')
                                           ]),
                                           style={
                                               'width': '100%',
                                               'height': '60px',
                                               'lineHeight': '60px',
                                               'borderWidth': '1px',
                                               'borderStyle': 'dashed',
                                               'borderRadius': '5px',
                                               'textAlign': 'center',
                                               'margin': '10px'
                                           },
                                           multiple=False)
                            ]),
                            html.Br(),
                            html.Div(
                                id='clinical-column-select',
                                children=[
                                    html.Div([
                                        'Select the patient id column to index by:'
                                    ]),
                                    dcc.Dropdown(
                                        id='clinical-patient-col-name',
                                        disabled=True),
                                    html.Div([
                                        'Select the column prefixes to import:'
                                    ]),
                                    dcc.Dropdown(
                                        id='clinical-data-columns-select',
                                        disabled=True,
                                    )
                                ]),
                            html.Br(),
                            html.Button(id='clinical-submit-button',
                                        n_clicks=0,
                                        children='Submit'),
                        ]),
                    dcc.Tab(
                        label='Import Omics Data',
                        value='data-upload',
                        className='control-tab',
                        children=[
                            html.Div([
                                'Cohort name: ',
                            ]),
                            dcc.Input(
                                id='data-table-cohort',
                                style={'width': '100%'},
                                placeholder="Leave empty to use filename",
                                type='text'),
                            html.Br(),
                            html.Br(),
                            html.Div([
                                'Select data type:',
                            ]),
                            dcc.RadioItems(
                                id='data-table-type',
                                options=[
                                    {
                                        'label': 'Protein Expression',
                                        'value': Protein.name()
                                    },
                                    {
                                        'label': 'miRNA Expression',
                                        'value': MicroRNA.name()
                                    },
                                    {
                                        'label': 'lncRNA Expression',
                                        'value': LncRNA.name()
                                    },
                                    {
                                        'label': 'mRNA Expression',
                                        'value': MessengerRNA.name()
                                    },
                                ],
                                value=MicroRNA.name(),
                            ),
                            html.Br(),
                            html.Div([
                                'Import a data file',
                            ]),
                            html.Div(children=[
                                dcc.Upload(id='upload-data-table',
                                           children=html.Div([
                                               'Drag and Drop or ',
                                               html.A('Select Files')
                                           ]),
                                           style={
                                               'width': '100%',
                                               'height': '60px',
                                               'lineHeight': '60px',
                                               'borderWidth': '1px',
                                               'borderStyle': 'dashed',
                                               'borderRadius': '5px',
                                               'textAlign': 'center',
                                               'margin': '10px'
                                           },
                                           multiple=True)
                            ]),
                            html.Br(),
                            html.Div(
                                id='data-table-column-select',
                                children=[
                                    html.Div([
                                        'Select the gene id/name column to index by:'
                                    ]),
                                    dcc.Dropdown(
                                        id='data-table-genes-col-name',
                                        disabled=True),
                                    html.Div([
                                        'Select the column prefixes to import:'
                                    ]),
                                    dcc.Dropdown(
                                        id='data-table-columns-select',
                                        disabled=True,
                                    )
                                ]),
                            html.Br(),
                            html.Div(['Each gene is indexed by:']),
                            dcc.RadioItems(
                                id='data-table-genes_index',
                                options=[
                                    {
                                        'label': 'Gene symbol',
                                        'value': 'gene_name'
                                    },
                                    {
                                        'label': 'Gene index',
                                        'value': 'gene_index'
                                    },
                                    {
                                        'label': 'Transcript name',
                                        'value': 'transcript_name'
                                    },
                                    {
                                        'label': 'Transcript index',
                                        'value': 'transcript_index'
                                    },
                                ],
                                value='gene_name',
                            ),
                            html.Br(),
                            html.Div(['Is the table transposed?']),
                            dcc.RadioItems(
                                id='data-table-transpose',
                                options=[
                                    {
                                        'label': 'Sample name columns',
                                        'value': "True"
                                    },
                                    {
                                        'label': 'Gene name in columns',
                                        'value': "False"
                                    },
                                ],
                                value="True",
                            ),
                            html.Br(),
                            html.Button(id='upload-data-table-submit',
                                        n_clicks=0,
                                        children='Submit'),
                        ]),
                    dcc.Tab(label='Annotate database',
                            value='annotatte-db',
                            className='control-tab',
                            children=[
                                html.Div('To be implemented'),
                            ]),
                ])
        ])