def main(): print('Reading subjects') ctrl_files = read_gord_data(data_dir=CTRL_DIR, num_sub=NUM_CTRL) t0 = time.time() print('performing stats based on random pairwise distances') pval_fdr, pval = compare_sub2ctrl(bfp_path=BFPPATH, sub_file=SUB_DATA, ctrl_files=ctrl_files, num_pairs=2000, nperm=1000, len_time=LEN_TIME, num_proc=4, fdr_test=True) t1 = time.time() print(t1 - t0) sp.savez('pval_out200.npz', pval=pval, pval_fdr=pval_fdr) vis_grayord_sigpval(bfp_path=BFPPATH, pval=pval, surf_name='subdiff', out_dir='/big_disk/ajoshi/coding_ground/bfp/src/stats', smooth_iter=1000) print('Results saved')
def main(): print('Reading subjects') _, reg_var, sub_files = read_oasis3_data( csv_fname=CSV_FILE, data_dir=DATA_DIR, reg_var_name='UDSB9', #'Verbal IQ', # # num_sub=NUM_SUB, len_time=LEN_TIME, data_field='SCT_GO') # Shuffle reg_var and subjects for testing #reg_var = sp.random.permutation(reg_var) #ran_perm = sp.random.permutation(len(reg_var)) #reg_var = reg_var #sub_files = [sub_files[i] for i in range(len(reg_var))] sub_files = sub_files #[50:100] reg_var = reg_var #[50:100] t0 = time.time() print('performing stats based on random pairwise distances') corr_pval_max, corr_pval_fdr = randpairs_regression( bfp_path=BFPPATH, sub_files=sub_files, reg_var=reg_var, num_pairs=20000, # 19900, nperm=2000, len_time=LEN_TIME, num_proc=6, pearson_fdr_test=False, data_field='SCT_GO') t1 = time.time() print(t1 - t0) sp.savez('pval_num_pairs20000_nsub350_nperm2000_SCT.npz', corr_pval_max=corr_pval_max, corr_pval_fdr=corr_pval_fdr) # corr_pval_max=a['corr_pval_max'] # corr_pval_fdr=a['corr_pval_fdr'] vis_grayord_sigpval(corr_pval_max, surf_name='rand_dist_corr_perm_pairs20000_max_SCT', out_dir='.', smooth_iter=1000, bfp_path=BFPPATH, fsl_path=FSL_PATH, sig_alpha=0.05) vis_grayord_sigpval(corr_pval_fdr, surf_name='rand_dist_corr_perm_pairs20000_fdr_SCT', out_dir='.', smooth_iter=1000, bfp_path=BFPPATH, fsl_path=FSL_PATH, sig_alpha=0.05) print('Results saved')
def main(): print('Reading subjects') _, reg_var, sub_files = read_fcon1000_data( csv_fname=CSV_FILE, data_dir=DATA_DIR, reg_var_name='ADHD Index', # 'Verbal IQ', # # num_sub=NUM_SUB) # Shuffle reg_var and subjects for testing reg_var = np.random.permutation(reg_var) #ran_perm = sp.random.permutation(len(reg_var)) #reg_var = reg_var #sub_files = [sub_files[i] for i in range(len(reg_var))] #sub_files=sub_files[30:30+15] #reg_var = reg_var[30:30+15] t0 = time.time() print('performing stats based on kernel regression') pval_kr_ftest, pval_kr_ftest_fdr = kernel_regression_ftest( bfp_path=BFPPATH, sub_files=sub_files, reg_var=reg_var, nperm=2000, len_time=LEN_TIME, num_proc=4, fdr_test=False, simulation=False) t1 = time.time() print(t1 - t0) np.savez('pval_KR_ftest.npz', pval=pval_kr_ftest, pval_fdr=pval_kr_ftest_fdr) # corr_pval_max=a['corr_pval_max'] # corr_pval_fdr=a['corr_pval_fdr'] #a=np.load('pval_KR_ftest5null.npz') #pval_kr_ftest = a['pval'] vis_grayord_sigpval(pval_kr_ftest, surf_name='KR_pval_ftest', out_dir='.', smooth_iter=1000, bfp_path=BFPPATH, fsl_path=FSL_PATH, sig_alpha=0.5) vis_grayord_sigpval(pval_kr_ftest_fdr, surf_name='KR_pval_ftest_fdr', out_dir='.', smooth_iter=1000, bfp_path=BFPPATH, fsl_path=FSL_PATH, sig_alpha=0.05) print('Results saved')
bfp_path=cf.bfp_path, sub_files=subTest_fname, reg_var=subTest_varmain2, num_pairs=2000, # 19900, nperm=2000, len_time=int(cf.lentime), num_proc=1, pearson_fdr_test=True) #%% spio.savemat(os.path.join(cf.out_dir + '/' + cf.outname + '_corr_pval_pearson.mat'), {'corr_pval_fdr':corr_pval_fdr, 'corr_pval':corr_pval}) #%% Visualization of the results vis_grayord_sigpval(corr_pval_fdr, float(cf.sig_alpha), surf_name=cf.outname + '_fdr', out_dir=cf.out_dir, smooth_iter=int(cf.smooth_iter), bfp_path=cf.bfp_path, fsl_path=cf.fsl_path) vis_grayord_sigpval(corr_pval, float(cf.sig_alpha), surf_name=cf.outname + 'uncorr', out_dir=cf.out_dir, smooth_iter=int(cf.smooth_iter), bfp_path=cf.bfp_path, fsl_path=cf.fsl_path) write_text_timestamp(log_fname, 'BFP regression analysis complete')
bfp_path=cf.bfp_path, sub_files=subTest_fname, reg_var=subTest_varmain, num_pairs=int(cf.pw_pairs), # 19900, nperm=int(cf.pw_perm), len_time=int(cf.lentime), num_proc=1, pearson_fdr_test=bool(cf.pw_fdr)) # saves out results spio.savemat(os.path.join(cf.out_dir + '/' + cf.outname + '_corr_pval_max.mat'), {'corr_pval_max': corr_pval_max}) spio.savemat(os.path.join(cf.out_dir + '/' + cf.outname + '_corr_pval_fdr.mat'), {'corr_pval_fdr': corr_pval_fdr}) #Visualization of the results vis_grayord_sigpval(corr_pval_max, float(cf.sig_alpha), surf_name=cf.outname + '_max', out_dir=cf.out_dir, smooth_iter=int(cf.smooth_iter), bfp_path=cf.bfp_path, fsl_path=cf.fsl_path, save_png=bool(cf.save_figures)) vis_grayord_sigpval(corr_pval_fdr, float(cf.sig_alpha), surf_name=cf.outname + 'fdr', out_dir=cf.out_dir, smooth_iter=int(cf.smooth_iter), bfp_path=cf.bfp_path, fsl_path=cf.fsl_path, save_png=bool(cf.save_figures)) write_text_timestamp(log_fname, 'BFP regression analysis complete! '+ '\n pvalue labeled surfaces have colorbar limits 0 to ' + str(cf.sig_alpha) + '; colorbar class is jet reverse.'+ '\n significance indicates that brain connectivty is associated with '+ cf.colvar_main +