コード例 #1
0
 def _augmented_score_func(
         a: Agglomerate3D) -> Tuple[str, str, int, float, List[float]]:
     return a.linkage_cell,   \
            a.linkage_region,  \
            a.max_region_diff,  \
            a.region_dist_scale, \
            [a.compute_tree_score(m) for m in TREE_SCORE_OPTIONS]
コード例 #2
0
 def _agglomerate_func(lc, lr, cta, ra, mrd, rds, ic, data):
     agglomerate = Agglomerate3D(linkage_cell=lc,
                                 linkage_region=lr,
                                 cell_type_affinity=cta,
                                 region_affinity=ra,
                                 max_region_diff=mrd,
                                 region_dist_scale=rds,
                                 verbose=False,
                                 pbar=False,
                                 integrity_check=ic)
     agglomerate.agglomerate(data)
     return agglomerate
コード例 #3
0
if __name__ == '__main__':
    ct_data_loader = CTDataLoader(
        'mouse',
        reprocess=True,
        remove_correlated='ct',
        normalize=True,
        gene_selection_method='elastic-net',
        model_cache_dir='models',
        alpha=3e-1,  # np.logspace(-4, 2, num=6),
        dim_reduction=None,
        n_components=50)

    agglomerate = Agglomerate3D(cell_type_affinity=spearmanr_connectivity,
                                linkage_cell='complete',
                                linkage_region='homolog_mnn',
                                max_region_diff=1,
                                region_dist_scale=.7,
                                verbose=False,
                                pbar=True,
                                integrity_check=True)

    start = time.process_time()
    agglomerate.agglomerate(ct_data_loader)
    end = time.perf_counter()
    pd.options.display.width = 0
    pd.set_option('display.expand_frame_repr', False)
    pd.set_option('display.max_columns', None)
    print(agglomerate.linkage_mat_readable)
    print(agglomerate.compute_tree_score('BME'))
    agglomerate.view_tree3d()
    print(f'Total time elapsed: {(end - start) / 10}s')
コード例 #4
0
 def _basic_score_func(a: Agglomerate3D) -> List[float]:
     return [a.compute_tree_score(m) for m in TREE_SCORE_OPTIONS]