Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Group Analysis Error: Incorrect Mesh Format #29

Open
smeisler opened this issue Jan 24, 2023 · 9 comments
Open

Group Analysis Error: Incorrect Mesh Format #29

smeisler opened this issue Jan 24, 2023 · 9 comments

Comments

@smeisler
Copy link
Contributor

smeisler commented Jan 24, 2023

Hello,

I am attempting to run a group GLM of subject level results. For each subject (M=68), I have the _left.rds, _right.rds and combined .rds file saved out from the subject-level run. Each subject has one task with two conditions, and two runs of each task that are combined in the session_average on the subject level. Subject-level outputs were completed without errors. Original data were preprocessed with fMRIPrep 22.1.1 with 91k resolution CIFTI outputs.

All code was run on the most recent CiftiTools 11.0 and BayesfMRI 0.2.0 branches (all other CRAN packages and INLA were also updated just prior to running).

subject level BayesGLM invocation

results <- BayesGLM_cifti(
    cifti_fname = fnames_ts,
    surfL_fname = fname_gifti_left,
    surfR_fname = fname_gifti_right,
    brainstructures = c("left", "right"),
    session_names = c('run-1','run-2'),
    TR = TR,
    onsets = events_all,
    nuisance = confounds_all,
    dHRF = 0, # might add a temporal derivative later
    DCT= 0, # fMRIPrep already returns cosine regressors
    resamp_res = 10000,
    Bayes = TRUE,
    EM = TRUE, # INLA execution throws an error
    num.threads =  8,
    verbose = TRUE,
    outfile = outfile
)

group level BayesGLM invocation

M <- 68 # number of subjects
K <- 2 # number of task conditions
num_sessions <- 1 # Only analyzing the session average
task <- "lang" # Analyzing language task 
task_subject_results <- Sys.glob(file.path(bayesfmri_dir,'*',paste0('BayesGLM_',task,'.rds'))) # Collect all combined .rds files

results <- BayesGLM_group(
    results = task_subject_results,
    contrasts = rep(rep(c(1/(M*num_sessions),-1/(M*num_sessions),rep(0, K-2)), num_sessions),M), # Find condition difference averaged across subjects
    no_cores = 24,
    verbose = TRUE)

group level BayesGLM error

cortexL  ~~~~~~~~~~~
Error in BayesGLM2(results = results, contrasts = contrasts, quantiles = quantiles, : Your results version does not have the correct mesh format please re-run subject-level models using the current package version.
Traceback:

1. BayesGLM_group(results = task_subject_results, contrasts = rep(rep(c(1/(M * 
 .     num_sessions), -1/(M * num_sessions), rep(0, K - 2)), num_sessions), 
 .     M), no_cores = 24, verbose = TRUE)
2. BayesGLM2(results = results, contrasts = contrasts, quantiles = quantiles, 
 .     excursion_type = excursion_type, gamma = gamma, alpha = alpha, 
 .     nsamp_theta = nsamp_theta, nsamp_beta = nsamp_beta, no_cores = no_cores, 
 .     verbose = verbose)
3. stop("Your results version does not have the correct mesh format please re-run subject-level models using the current package version.")

What would be the best way to proceed here?

Best,
Steven

@mandymejia
Copy link
Owner

mandymejia commented Jan 24, 2023 via email

@damondpham
Copy link
Collaborator

@smeisler could you send me, say, three of your subjects' results?

@smeisler
Copy link
Contributor Author

smeisler commented Jan 24, 2023

Sure, the files will be finished uploading here in about 20 minutes https://drive.google.com/drive/folders/17xR_z-Dj7kaIqGdKTsExZxOlRP9u7tUK?usp=share_link

edit to add that the files are finished uploading

@damondpham
Copy link
Collaborator

Thanks Steven! It looks like the solution is not a simple fix, and I'm in the middle of a revision right now, so this might take me a couple weeks. Is this analysis time sensitive?

@smeisler
Copy link
Contributor Author

All good! It is not time sensitive.

@damondpham
Copy link
Collaborator

Hi Steven!

Well, I beat the half year mark :) BayesfMRI is now on CRAN and it should be in a lot better shape! You should re-run your analysis with the new version when you get a chance. But you'll have to re-run the subject-level analysis too, and then use that for the group-level analysis.

@smeisler
Copy link
Contributor Author

Perfect, thanks! Will give it a shot.

@smeisler
Copy link
Contributor Author

I presume I should be using branch 3.0?

@damondpham
Copy link
Collaborator

I just merged 3.0 to master so now either is the same as what's on CRAN. But with your latest change, let's use 4.0. And further changes will also be made to 4.0 for the time being :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants