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

add BIDS conversion script #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

loj
Copy link

@loj loj commented May 14, 2020

No description provided.

Copy link

@yarikoptic yarikoptic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I now stronger believe that some of those .txt could and should be renamed to .tsv. I would also check on naming of output files for motion correction etc produced by fmriprep which I believe is pretty much the guide for BIDS derivatives layout support.

git mv -fk ${subdir}/MNINonLinear/Results/rfMRI_REST1_LR/rfMRI_REST1_LR_Atlas_NoiseMGT.txt ${newsub}/ses-3T/func/${newsub}_ses-3T_task-rest_dir-LR_run-1_desc-NoiseMGT_atlas.txt || true
git mv -fk ${subdir}/MNINonLinear/Results/rfMRI_REST1_LR/rfMRI_REST1_LR_Atlas_OrigMGT.txt ${newsub}/ses-3T/func/${newsub}_ses-3T_task-rest_dir-LR_run-1_desc-OrigMGT_atlas.txt || true
git mv -fk ${subdir}/MNINonLinear/Results/rfMRI_REST1_LR/rfMRI_REST1_LR_Atlas_PostMotionMGT.txt ${newsub}/ses-3T/func/${newsub}_ses-3T_task-rest_dir-LR_run-1_desc-PostMotionMGT_atlas.txt || true
git mv -fk ${subdir}/MNINonLinear/Results/rfMRI_REST1_LR/rfMRI_REST1_LR_Atlas_UnstructNoiseMGT.txt ${newsub}/ses-3T/func/${newsub}_ses-3T_task-rest_dir-LR_run-1_desc-UnstructNoiseMGT_atlas.txt || true

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit controversial, feel free to ignore I guess:
FWIW, since renaming anyways (it is sad that they couldn't be modified), might be worth looking into changing extension at least for some of them? I see there .csv and may be some .tsv (although without headers) files:

$> head -n 2 Results/rfMRI_REST1_LR/*.txt             
... stripped since might be sensitive data ;)

==> Results/rfMRI_REST1_LR/ReclassifyAsNoise.txt <==

==> Results/rfMRI_REST1_LR/ReclassifyAsSignal.txt <==

==> Results/rfMRI_REST1_LR/rfMRI_REST1_LR_Atlas_stats.txt <==
TCSName,NumSignal,NumNoise,NumTotal,MEAN,STD,COV,TSNR,OrigVar,HighPassVar,MotionVar,StructNoiseVar,BOLDVar,UnstructNoiseVar,TotalSharedVar,CNR,OrigMGTVar,HighPassMGTVar,PostMotionMGTVar,CleanedMGTVar,OrigMGTbeta,HighPassMGTbeta,PostMotionMGTbeta,CleanedMGTbeta,HighPassVarRatio,MotionVarRatio,StructNoiseVarRatio,BOLDVarRatio,UnstructNoiseVarRatio,OrigMGTVarRatio,HighPassMGTVarRatio,PostMotionMGTVarRatio,CleanedMGTVarRatio,CleanedMGTVarVsBOLDVarRatio,OrigMGTrsq,HighPassMGTrsq,PostMotionMGTrsq,CleanedMGTrsq,UnstructNoiseMGTbeta,UnstructNoiseMGTVar,UnstructNoiseMGTVarRatio,UnstructNoiseMGTrsq,NoiseMGTbeta,NoiseMGTVar,NoiseMGTVarRatio,NoiseMGTrsq,WMbeta,WMVar,WMVarVsBOLDVarRatio,WMCleanedBOLDVar,WMCleanedMGTbeta,WMCleanedMGTVar,WMCleanedMGTVarVsWMCleanedBOLDVarRatio,CSFbeta,CSFVar,CSFVarVsBOLDVarRatio,CSFCleanedBOLDVar,CSFCleanedMGTbeta,CSFCleanedMGTVar,CSFCleanedMGTVarVsCSFCleanedBOLDVarRatio,WMCSFbetaWM,WMCSFbetaCSF,WMCSFVar,WMCSFVarVsBOLDVarRatio,WMCSFCleanedBOLDVar,WMCSFCleanedMGTbeta,WMCSFCleanedMGTVar,WMCSFCleanedMGTVarVsWMCSFCleanedBOLDVarRatio
... and there is more

I am not sure if there is a convention for an extension to indicate that file is just a single entry (thus could be .tsv .csv etc but without header).

Why asking, is because in general indication of format or structure in the file is recommended. and that is why BIDS atm has all .tsv's. (there are some .txt "leaked in" for MEG but that is about it... I put some flame into the fire where it is due).

git mv -fk ${subdir}/MNINonLinear/Results/rfMRI_REST1_LR/Movement_RelativeRMS_mean.txt ${newsub}/ses-3T/func/${newsub}_ses-3T_task-rest_dir-LR_run-1_desc-MovementRelativeRMSmean.txt || true
git mv -fk ${subdir}/MNINonLinear/Results/rfMRI_REST1_LR/Movement_RelativeRMS.txt ${newsub}/ses-3T/func/${newsub}_ses-3T_task-rest_dir-LR_run-1_desc-MovementRelativeRMS.txt || true
git mv -fk ${subdir}/MNINonLinear/Results/rfMRI_REST1_LR/ReclassifyAsNoise.txt ${newsub}/ses-3T/func/${newsub}_ses-3T_task-rest_dir-LR_run-1_desc-ReclassifyAsNoise.txt || true
git mv -fk ${subdir}/MNINonLinear/Results/rfMRI_REST1_LR/ReclassifyAsSignal.txt ${newsub}/ses-3T/func/${newsub}_ses-3T_task-rest_dir_LR_run-1_desc-ReclassifyAsSignal.txt || true

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be worth checking how current version fmriprep stores any such related derivatives, and follow along.

git mv -fk ${subdir}/MNINonLinear/Results/rfMRI_REST1_LR/rfMRI_REST1_LR_Atlas_stats.txt ${newsub}/ses-3T/func/${newsub}_ses-3T_task-rest_dir-LR_run-1_desc-Atlasstats.txt || true
git mv -fk ${subdir}/MNINonLinear/Results/rfMRI_REST1_LR/rfMRI_REST1_LR_CSF.txt ${newsub}/ses-3T/func/${newsub}_ses-3T_task-rest_dir-LR_run-1_desc-CSF.txt || true
git mv -fk ${subdir}/MNINonLinear/Results/rfMRI_REST1_LR/rfMRI_REST1_LR_hp2000_clean.nii.gz ${newsub}/ses-3T/func/${newsub}_ses-3T_task-rest_dir-LR_run-1_desc-hp2000clean.nii.gz || true
git mv -fk ${subdir}/MNINonLinear/Results/rfMRI_REST1_LR/rfMRI_REST1_LR_Physio_log.txt ${newsub}/ses-3T/func/${newsub}_ses-3T_task-rest_dir-LR_run-1_physio.txt || true

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checked -- this one is a .tsv (no header). BIDS likes .tsv.
Interestingly, BIDS seems to demands them to be .gz'ed! https://bids-specification.readthedocs.io/en/stable/04-modality-specific-files/06-physiological-and-other-continuous-recordings.html

But I think this should be sensible to ask to rectify: bids-standard/bids-specification#472

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

anyone (@loj @adswa) would be interested to become a BIDS contributor and propose a PR which would make .gz optional for these files? There seems to be no negative votes so far in the BIDS issue ;)

#
# 3T rest1 LR
#
git mv -fk ${subdir}/MNINonLinear/Results/rfMRI_REST1_LR/Movement_AbsoluteRMS_mean.txt ${newsub}/ses-3T/func/${newsub}_ses-3T_task-rest_dir-LR_run-1_desc-MovementAbsoluteRMSmean.txt || true

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not to

    for lr in LR RL; do
....

and avoid duplication -- would simplify adjusting it as well.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here is a "fuller" paradigm which IMHO would also make review easier

# nice concise specific differences on what ot rename into what
echo "\
Movement_RelativeRMS.txt _desc-MovementRelativeRMS.txt
other another" \
| while read fr_ to_; do
    for lr in LR RL; do
        # one command to rule them all
        git mv git mv -fk ${subdir}/MNINonLinear/Results/rfMRI_REST1_${lr}/${fr_} ${newsub}/ses-3T/func/${newsub}_ses-3T_task-rest_dir-${lr}_run-1_${to_}
    done
done

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

Successfully merging this pull request may close these issues.

2 participants