Open katenuss opened 5 years ago
@katenuss ,
Extraction: the first thing you need to do is make sure the BIDS classification tool (heudiconv
) doesn't use the old classification file to sort and name your runs. To do that, the safest thing is to delete the folder .heudiconv/<subID>
at the top level of the BIDS folder. You should also delete the sub-<subID>
folder with the data from the top level BIDS folder, and from the sourcedata
folder. Plus, the corresponding subject line from the participants.tsv
file.
fMRIPrep: you need to remove the respective sub-<subID>
folder and sub-<subID>.html
file from the derivatives/fmriprep
folders, and the sub-<subID>
folder from derivatives/freesurfer
.
mriqc: delete the sub-<subID>
folder and sub-<subID>*.html
files from the derivatives/mriqc_reports
. Also, remove the lines corresponding to that subject from all the group_*.tsv
files, so that the old data is no longer included in the group-level mriqc_reports
, as you say.
Here is a script to do all of the above. If there are not multiple sessions per subject (or if you want to remove all the sessions for a subject):
BIDSdir=my/top-level/bids/folder
subID=<enter-your-subject-ID>
# clean up extraction results:
rm -fr ${BIDSdir}/.heudiconv/${subID} \
${BIDSdir}/sub-${subID} \
${BIDSdir}/sourcedata/sub-${subID}
sed -i -e "/^sub-${subID}/d" ${BIDSdir}/participants.tsv
# clean up fMRIPrep:
rm -fr ${BIDSdir}/derivatives/fmriprep/sub-${subID} \
${BIDSdir}/derivatives/fmriprep/sub-${subID}.html \
${BIDSdir}/derivatives/freesurfer/sub-${subID}*
# clean up MRIQC:
rm -fr ${BIDSdir}/derivatives/mriqc_reports/sub-${subID} \
${BIDSdir}/derivatives/mriqc_reports/sub-${subID}*.html \
sed -i -e "/^sub-${subID}/d" ${BIDSdir}/derivatives/mriqc_reports/group_*.tsv
(Disclaimer: I haven't tested it, so if you don't mind testing it yourself and then do the re-extraction, please let me know if it worked. Thanks)
Hi @pvelasco , I just ran the script and everything seems to work except for the sed commands. I still see the participant (in this case, 167) listed in all the .tsv files, so I haven't yet re-extracted.
Thanks! Kate
Hi Kate @katenuss ,
Did you run the sed
commands with double quotes or single quotes. It will not work if you use single quotes.
If that was not the problem, what type of machine are you using? Mac? Linux?
Hi @pvelasco - Working now. Previously I was just copying and pasting your code without modification, but I realized I need to be in the directory where each .tsv file is located to edit with sed. Thanks! Re-extracting and will update with any issues.
Sorry, you are right. I have updated the code above to correct the path to the .tsv
files. Thanks for catching that up.
One more question - is the code supposed to replace the .tsv files with .tsv-e files?
No, it's not. Can you post the actual command you ran?
BIDSdir=memFreqMRI
subID=210
# clean up extraction results:
rm -fr ${BIDSdir}/.heudiconv/${subID} \
${BIDSdir}/sub-${subID} \
${BIDSdir}/sourcedata/sub-${subID}
sed -i -e "/^sub-${subID}/d" ${BIDSdir}/participants.tsv
# clean up fMRIPrep:
rm -fr ${BIDSdir}/derivatives/fmriprep/sub-${subID} \
${BIDSdir}/derivatives/fmriprep/sub-${subID}.html \
${BIDSdir}/derivatives/freesurfer/sub-${subID}*
# clean up MRIQC:
rm -fr ${BIDSdir}/derivatives/mriqc_reports/sub-${subID} \
${BIDSdir}/derivatives/mriqc_reports/sub-${subID}*.html \
sed -i -e "/^sub-${subID}/d" ${BIDSdir}/derivatives/mriqc_reports/group_*.tsv
It looks correct to me.
In what computer are you running the code above?
In any case, you could just edit by hand the .tsv
files and remove the line corresponding to sub-<subID>
...
If I have exported a subject's data into my BIDS directory and run mriqc and fMRIprep, but then want to re-export that subject's data (with different acquisitions selected), how should I ensure all old files related to that subject are removed? Should I just manually delete their subject folder and relevant mriqc and fMRIprep directories? How do I ensure that their old data is no longer included in the group-level mriqc reports Thank you!