Пример #1
0
#####################################
# Set output of FNC toolbox as infile
infile = os.path.join(datadir, fnctb_info)
# Get correlation and lag matrices
fnc_corr, fnc_corr_z, fnc_lag = go.get_fnctb_stats(infile)
# Save out text files of correlation and lags
fnc_corr_outfile = os.path.join(datadir, fnc_corr_out)
np.savetxt(fnc_corr_outfile, fnc_corr, fmt='%1.5f', delimiter='\t')
fnc_corr_z_outfile = os.path.join(datadir, fnc_corr_z_out)
np.savetxt(fnc_corr_z_outfile, fnc_corr_z, fmt='%1.5f', delimiter='\t')
fnc_lag_outfile = os.path.join(datadir, fnc_lag_out)
np.savetxt(fnc_lag_outfile, fnc_lag, fmt='%1.2f', delimiter='\t')

## Run group analysis
#######################
exists, resultsdir = gu.make_dir(datadir,'randomise') 
resultsglob = os.path.join(datadir, 'FNCtb_*.csv')
result_files = glob(resultsglob)
for fnc_data_file in result_files:
    fnc_data = np.genfromtxt(fnc_data_file, names=None, dtype=float, delimiter=None)
    pth, fname, ext = gu.split_filename(fnc_data_file)
    fnc_img_fname = os.path.join(resultsdir, fname + '.nii.gz')
    fnc_saveimg = gu.save_img(fnc_data, fnc_img_fname)
    rand_basename = os.path.join(resultsdir, fname)
    p_uncorr_list, p_corr_list = ga.randomise(fnc_saveimg, 
                                                rand_basename, 
                                                des_file, 
                                                con_file)     
    uncorr_results = ga.get_results(p_uncorr_list)
    corr_results = ga.get_results(p_corr_list)
           
Пример #2
0

    ####################### Set parameters################
    basedir = '/home/jagust/rsfmri_ica/GIFT/GICA_d75/roi_connectivity/'
    datadir = '/home/jagust/rsfmri_ica/GIFT/GICA_d75/roi_connectivity/matrices'
    nnodes = 23
    modeldir = '/home/jagust/rsfmri_ica/GIFT/models/Old'
    des_file = os.path.join(modeldir, 'Covariate_Old_log_demeaned.mat')
    con_file = os.path.join(modeldir, 'Covariate_Old_log_demeaned.con')
    resultsglob = '*mancovan_preproc.csv'
    ##############################################################


    ## Run group analysis with randomise
    ####################################
    exists, resultsdir = gu.make_dir(basedir,'randomise') 
    result_files = glob(os.path.join(datadir,resultsglob))
    for data_file in result_files:
        data = np.genfromtxt(data_file, names=None, dtype=float, delimiter=',')
        pth, fname, ext = gu.split_filename(data_file)
        img_fname = os.path.join(resultsdir, fname + '.nii.gz')
        saveimg = gu.save_img(data, img_fname)
        rand_basename = os.path.join(resultsdir, fname)
        p_uncorr_list, p_corr_list = ga.randomise(saveimg, 
                                                    rand_basename, 
                                                    des_file, 
                                                    con_file)     
        uncorr_results = ga.get_results(p_uncorr_list)
        corr_results = ga.get_results(p_corr_list)
               
        fdr_results = {}