def pca_agg_task_cv(exp, block, train_es, test_es, gene_sets, base_filename, ): """ @type train_es, test_es: ExpressionSet @type gene_sets: GeneSets """ df_train = train_es.get_assay_data_frame() df_test = test_es.get_assay_data_frame() src_gs = gene_sets.get_gs() if settings.CELERY_DEBUG: import sys sys.path.append('/Migration/skola/phd/projects/miXGENE/mixgene_project/wrappers/pycharm-debug.egg') import pydevd pydevd.settrace('localhost', port=6901, stdoutToServer=True, stderrToServer=True) df_train, src_gs_train = preprocess_df_gs(df_train, src_gs) df_test, src_gs_test = preprocess_df_gs(df_test, src_gs) result_df_train, result_df_test = pca_agg_cv(df_train, df_test, src_gs_train.genes) result_train = train_es.clone(base_filename + "_train") result_train.store_assay_data_frame(result_df_train) result_train.store_pheno_data_frame(train_es.get_pheno_data_frame()) result_test = test_es.clone(base_filename + "_test") result_test.store_assay_data_frame(result_df_test) result_test.store_pheno_data_frame(test_es.get_pheno_data_frame()) return [result_train, result_test], {}
def gt_basic(es, gene_sets, pheno_class_column, model="logistic", permutations=100): """ @param es: Expression set with defined user class in pheno @type es: ExpressionSet @type gene_sets: environment.structures.GeneSets @param pheno_class_column: Column name of target classes in phenotype table @type pheno_class_column: string or None """ if settings.CELERY_DEBUG: import sys sys.path.append('/Migration/skola/phd/projects/miXGENE/mixgene_project/wrappers/pycharm-debug.egg') import pydevd pydevd.settrace('localhost', port=6901, stdoutToServer=True, stderrToServer=True) src_gs = gene_sets.get_gs() # GlobalTest.gt_init() df = es.get_assay_data_frame() df, gs_filtered = preprocess_df_gs(df, src_gs) dataset = com.convert_to_r_matrix(df.T) response = es.get_pheno_column_as_r_obj(pheno_class_column) ds_r = R.r['t'](dataset) gs_r = gs_filtered.to_r_obj() try: R.r['library']("globaltest") gt = R.r['gt'] gt_instance = gt( response, ds_r, subsets=gs_r, # model=model, # permutations=permutations ) except: import sys log.error("Unexpected error: %s" % sys.exc_info()[0]) raise result = gt_instance.do_slot('result') result_df = com.convert_robj(result) return result_df
def pca_agg_task(exp, block, es, gene_sets, base_filename, ): """ @type es: ExpressionSet @type gene_sets: GeneSets """ df = es.get_assay_data_frame() src_gs = gene_sets.get_gs() if settings.CELERY_DEBUG: import sys sys.path.append('/Migration/skola/phd/projects/miXGENE/mixgene_project/wrappers/pycharm-debug.egg') import pydevd pydevd.settrace('localhost', port=6901, stdoutToServer=True, stderrToServer=True) df, src_gs = preprocess_df_gs(df, src_gs) result_df = pca_agg(df, src_gs.genes) result = es.clone(base_filename) result.store_assay_data_frame(result_df) result.store_pheno_data_frame(es.get_pheno_data_frame()) return [result], {}