logo

1 Apply smoothing and coarses mesh

This can be integrated in the MRI images processing script (RR_2), it relies on FreeSurfer scripts and files created as part of the FreeSurfer processing (FSresults folder)

2 Create the tables of vertex-wise data

Similar to code in RR_2, except that we initialise the vertex names using file the first individual of each batch. I have included a check that processing completed for this subject, if not the job fails immediately and you will have to provide manually an ID.
This is better than the previous version (RR_2 that required a manual input) but still not ideal

2.1 Different levels of smoothing


for batch in {1..5}
do
for hemi in lh rh
do
for moda in thickness area
do
for fwhm in 5 10 15 20 25
do
echo ${hemi}.${moda}
${bind}/qsubshcom " firstID=\$(ls "${wd}"/FS/FSresults/batch"${batch}"/ | sort -n | tail -1) |;
echo \${firstID} |;
ls "${wd}"/FS/FSresults/batch"${batch}"/\${firstID}/*"${hemi}"."${moda}".fwhm"${fwhm}".fsaverage*.asc |;
if [ -f "${wd}"/FS/FSresults/batch"${batch}"/\${firstID}/"${hemi}"."${moda}".fwhm"${fwhm}".fsaverage.asc ] |; 
then |;
echo \"vertexnum\" > "${wd}"/FS/"${hemi}"."${moda}".batch"${batch}".fwhm"${fwhm}".UKB.txt |; 
awk '{print \$1}' "${wd}"/FS/FSresults/batch"${batch}"/\${firstID}/"${hemi}"."${moda}".fwhm"${fwhm}".fsaverage.asc >> "${wd}"/FS/"${hemi}"."${moda}".batch"${batch}".fwhm"${fwhm}".UKB.txt |;
for ID in \$(awk -F\",\" \"NR>0 {print \$1}\" "${medici}"/T1/raw/batch"${batch}"/T1_fetch_batch"${batch}".lis) |;
do |;
ID=\${ID:0:7} |;
echo \${ID} |;
if [ -f "${wd}"/FS/FSresults/batch"${batch}"/\${ID}/"${hemi}"."${moda}".fwhm"${fwhm}".fsaverage.asc ] |;
then |;
echo \${ID} > "${wd}"/FS/"${hemi}"."${moda}"."${batch}".fwhm"${fwhm}".temp.lta |;
awk '{print \$5}' "${wd}"/FS/FSresults/batch"${batch}"/\${ID}/"${hemi}"."${moda}".fwhm"${fwhm}".fsaverage.asc >> "${wd}"/FS/"${hemi}"."${moda}"."${batch}".fwhm"${fwhm}".temp.lta |;
paste "${wd}"/FS/"${hemi}"."${moda}".batch"${batch}".fwhm"${fwhm}".UKB.txt "${wd}"/FS/"${hemi}"."${moda}"."${batch}".fwhm"${fwhm}".temp.lta > "${wd}"/FS/"${hemi}"."${moda}"."${batch}".fwhm"${fwhm}".temp2.lta |;
cp "${wd}"/FS/"${hemi}"."${moda}"."${batch}".fwhm"${fwhm}".temp2.lta "${wd}"/FS/"${hemi}"."${moda}".batch"${batch}".fwhm"${fwhm}".UKB.txt |;
fi |; done |; fi " 1 8G CortDat_${batch}_${hemi}_${moda}_${fwhm} 10:00:00 " -acct=UQ-IMB-CNSG"
done
done
done
done

2.2 Different meshes complexity


for batch in {1..5}  
do
for hemi in lh rh
do
for moda in area thickness
do
for fsav in fsaverage3 fsaverage4 fsaverage5 fsaverage6
do
echo ${batch}.${hemi}.${moda}.${fsav}
${bind}/qsubshcom " firstID=\$(ls "${wd}"/FS/FSresults/batch"${batch}"/ | sort -n | tail -1) |;
echo \${firstID} |;
ls "${wd}"/FS/FSresults/batch"${batch}"/\${firstID}/*"${hemi}"."${moda}".fwhm0."${fsav}"*.asc |;
if [ -f "${wd}"/FS/FSresults/batch"${batch}"/\${firstID}/"${hemi}"."${moda}".fwhm0."${fsav}".asc ] |; 
then |;
echo \"vertexnum\" > "${wd}"/FS/"${hemi}"."${moda}".batch"${batch}".fwhm0."${fsav}".UKB.txt |; 
awk '{print \$1}' "${wd}"/FS/FSresults/batch"${batch}"/\${firstID}/"${hemi}"."${moda}".fwhm0."${fsav}".asc >> "${wd}"/FS/"${hemi}"."${moda}".batch"${batch}".fwhm0."${fsav}".UKB.txt |;
for ID in \$(awk -F\",\" \"NR>0 {print \$1}\" "${medici}"/T1/raw/batch"${batch}"/T1_fetch_batch"${batch}".lis) |;
do |;
ID=\${ID:0:7} |;
echo \${ID} |;
if [ -f "${wd}"/FS/FSresults/batch"${batch}"/\${ID}/"${hemi}"."${moda}".fwhm0."${fsav}".asc ] |;
then |;
echo \${ID} > "${wd}"/FS/"${hemi}"."${moda}"."${batch}".fwhm0."${fsav}".temp.lta |;
awk '{print \$5}' "${wd}"/FS/FSresults/batch"${batch}"/\${ID}/"${hemi}"."${moda}".fwhm0."${fsav}".asc >> "${wd}"/FS/"${hemi}"."${moda}"."${batch}".fwhm0."${fsav}".temp.lta |;
paste "${wd}"/FS/"${hemi}"."${moda}".batch"${batch}".fwhm0."${fsav}".UKB.txt "${wd}"/FS/"${hemi}"."${moda}"."${batch}".fwhm0."${fsav}".temp.lta > "${wd}"/FS/"${hemi}"."${moda}"."${batch}".fwhm0."${fsav}".temp2.lta |;
cp "${wd}"/FS/"${hemi}"."${moda}"."${batch}".fwhm0."${fsav}".temp2.lta "${wd}"/FS/"${hemi}"."${moda}".batch"${batch}".fwhm0."${fsav}".UKB.txt |;
fi |; done |; fi |;
rm -r "${wd}"/FS/*.lta " 1 8G CortDat_${batch}_${hemi}_${moda}_${fsav} 48:00:00 " -acct=UQ-IMB-CNSG"
done
done
done
done

4 Give unique names to vertices and create tab files combining all batches

10 Run QC on BRM

10.2 Enforce BRM cut-offs

Here are out values, for comparison

${bind}/qsubshcom " 
"${bind}"/osca --reml --orm "${wd}"/BodFiles/allVerticesBRM.fwhm5 --orm-cutoff 0.62 --orm-cutoff-2sides --make-orm --out "${wd}"/BodFiles/allVerticesBRM.fwhm5.QC |;
"${bind}"/osca --reml --orm "${wd}"/BodFiles/allVerticesBRM.fwhm10 --orm-cutoff 0.85 --orm-cutoff-2sides --make-orm --out "${wd}"/BodFiles/allVerticesBRM.fwhm10.QC |;
"${bind}"/osca --reml --orm "${wd}"/BodFiles/allVerticesBRM.fwhm15 --orm-cutoff 1.05 --orm-cutoff-2sides --make-orm --out "${wd}"/BodFiles/allVerticesBRM.fwhm15.QC |;
"${bind}"/osca --reml --orm "${wd}"/BodFiles/allVerticesBRM.fwhm20 --orm-cutoff 1.24 --orm-cutoff-2sides --make-orm --out "${wd}"/BodFiles/allVerticesBRM.fwhm20.QC |;
"${bind}"/osca --reml --orm "${wd}"/BodFiles/allVerticesBRM.fwhm25 --orm-cutoff 1.41 --orm-cutoff-2sides --make-orm --out "${wd}"/BodFiles/allVerticesBRM.fwhm25.QC |;
" 1 4G BRM.QC.fwhm 4:00:00 "-acct=UQ-IMB-CNSG" 


${bind}/qsubshcom " 
"${bind}"/osca --reml --orm "${wd}"/BodFiles/allVerticesBRM.fsaverage3 --orm-cutoff 1.06 --orm-cutoff-2sides --make-orm --out "${wd}"/BodFiles/allVerticesBRM.fsaverage3.QC |;
"${bind}"/osca --reml --orm "${wd}"/BodFiles/allVerticesBRM.fsaverage4 --orm-cutoff 0.97 --orm-cutoff-2sides --make-orm --out "${wd}"/BodFiles/allVerticesBRM.fsaverage4.QC |;
"${bind}"/osca --reml --orm "${wd}"/BodFiles/allVerticesBRM.fsaverage5 --orm-cutoff 0.74 --orm-cutoff-2sides --make-orm --out "${wd}"/BodFiles/allVerticesBRM.fsaverage5.QC |;
"${bind}"/osca --reml --orm "${wd}"/BodFiles/allVerticesBRM.fsaverage6 --orm-cutoff 0.42 --orm-cutoff-2sides --make-orm --out "${wd}"/BodFiles/allVerticesBRM.fsaverage6.QC |;
" 1 4G BRM.QC.fsavg 4:00:00 "-acct=UQ-IMB-CNSG" 
 




A work by by [Baptiste Couvy-Duchesne] - 23 April 2020