PennLINC / xcpEngine

Official public repository for the XCP Engine. This tool is deprecated in favor of XCP-D and ASLPrep.
MIT License
66 stars 42 forks source link

discarding timepoints with prestats_dvols is stripping header from fmriprep confounds file #434

Open cmpetty opened 3 years ago

cmpetty commented 3 years ago

A local user wanted to discard volumes during prestats stage with:

prestats_dvols[1]=4. 

The number of volumes of the fmri are properly discarded, however removetaskpnts.R is not restoring the column headers because it read the data without them ( ie: header=FALSE )

>> ${XCPEDIR}/utils/removetaskpnts.R -n 4 -t /mnt/munin2/Madden/VisAtten.03/Analysis/Resting/RestingPipeline/xcp_36p/output_discard4/sub-9013/ses-1/prestats/sub-9013_ses-1_fmriconf.tsv -p /mnt/munin2/Madden/VisAtten.03/Analysis/Resting/RestingPipeline/xcp_36p/output_discard4/sub-9013/ses-1/prestats/sub-9013_ses-1_fmriconf.tsv
· @1.5 

Therefore all the subsequent confounds that are attempted to be pulled from the TSV with generate_confmat.R end up empty because there are no column headers to match against.

>> ${XCPEDIR}/utils/generate_confmat.R -i /mnt/munin2/Madden/VisAtten.03/Analysis/Resting/RestingPipeline/xcp_36p/output_discard4/sub-9013/ses-1/prestats/sub-9013_ses-1_fmriconf.tsv -j rps -o /mnt/munin2/Madden/VisAtten.03/Analysis/Resting/RestingPipeline/xcp_36p/output_discard4/sub-9013/ses-1/confound2/mc/sub-9013_ses-1_realignment.1D
Warning message:
In is.na(outmat) : is.na() applied to non-(list or vector) of type 'NULL'

Runtime Information Singularity. XCP v1.2.3

Additional context This would fix it in our case:

rr=read.table(tab1, sep='\t',header=TRUE)
mat1 = rr[-c(1:nvd),] 
write.table(mat1,file=out2, sep='\t',col.names = colnames(rr), row.names=F,quote=F)
a3sha2 commented 3 years ago

did you add DVO to design file?

cmpetty commented 3 years ago

yes, their prestats section below:

###################################################################
# 1 PRESTATS
###################################################################

prestats_rerun[1]=0
prestats_dvols[1]=4 #remove 4 volumes at beginning (disdaqs)
prestats_cleanup[1]=0
prestats_process[1]=FMP-DVO
mwvoss commented 3 years ago

We have had the same problem when using the prestats_dvols[1] setting. Are there updates on this issue?

cmpetty commented 3 years ago

We have had the same problem when using the prestats_dvols[1] setting. Are there updates on this issue?

I edited our version of ${XCPEDIR}/utils/removetaskpnts.R with the code i posted above, which fixes the issue. removetaskpnts.R.gz

a3sha2 commented 3 years ago

we are working on it @cmpetty and @mwvoss pls @cmpetty , pls can submit a pull request of your update pls?