from paper.routines.infrastructure.save.table import save_table_dict_xlsx
import pandas as pd

save_path = 'E:/YandexDisk/Work/pydnameth/unn_epic'

data = pdm.Data(path='', base='unn_epic')
annotations = pdm.Annotations(name='annotations',
                              type='850k',
                              exclude='bad_cpgs_from_ChAMP',
                              select_dict={'CHR': ['-X', '-Y']})
target = 'Age'
observables_unn_epic = pdm.Observables(name='observables_part(final)',
                                       types={})
cells = pdm.Cells(name='cell_counts', types='any')
attributes = pdm.Attributes(target=target,
                            observables=observables_unn_epic,
                            cells=cells)
data_params_unn_epic = {
    'norm': 'BMIQ',
    'part': 'final',
    'cells': ['Bcell', 'CD4T', 'CD8T', 'Neu', 'NK']
}

config = pdm.load_residuals_config(data,
                                   annotations,
                                   attributes,
                                   data_params=data_params_unn_epic)

keys = ['X' + elem for elem in config.observables_dict['Sample_Name']]
res_dict = {}
for x_id, x in enumerate(keys):
예제 #2
0
target = get_target(data.base)
data_params = get_data_params(data.base)
data_params['cells'] = ['CD8T', 'CD4T', 'NK', 'Bcell', 'Gran']

if data.base == 'GSE55763':
    observables_list = [
        {
            'gender': 'any',
            'is_duplicate': '0',
            'age': (35, 100)
        },
    ]
else:
    observables_list = [
        {
            'gender': 'any'
        },
    ]

for obs in observables_list:

    observables = pdm.Observables(name='observables', types=obs)

    attributes = pdm.Attributes(target=target,
                                observables=observables,
                                cells=cells)

    pdm.residuals_table_linreg(data=data,
                               annotations=annotations,
                               attributes=attributes,
                               data_params=data_params)
    select_dict={
        'CHR': ['-X', '-Y']
    }
)
target_unn_epic = 'Age'
observables_unn_epic = pdm.Observables(
    name='observables',
    types={}
)
cells_unn_epic = pdm.Cells(
    name='cell_counts_horvath_filtered_normalized',
    types='any'
)
attributes_unn_epic = pdm.Attributes(
    target=target_unn_epic,
    observables=observables_unn_epic,
    cells=cells_unn_epic
)
data_params_unn_epic = get_data_params(data_unn_epic.base)
# data_params_unn_epic = {
#     'norm': 'BMIQ',
#     'part': 'raw',
# }
config_unn = pdm.load_beta_config(
    data_unn_epic,
    annotations_unn_epic,
    attributes_unn_epic,
    data_params=data_params_unn_epic
)