This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
neuroimagen:fs_group_analysis [2020/06/10 10:12] osotolongo [FSDG] |
neuroimagen:fs_group_analysis [2020/08/04 10:58] (current) |
||
---|---|---|---|
Line 8: | Line 8: | ||
https:// | https:// | ||
+ | |||
+ | |||
+ | Primero hay que construir el archivo de diseño del experimento, | ||
+ | |||
+ | <code bash> | ||
+ | [osotolongo@detritus fsdg]$ head codes.csv | ||
+ | Subject, | ||
+ | 0001,F001 | ||
+ | 0002,F002 | ||
+ | 0003,F003 | ||
+ | 0004,F004 | ||
+ | 0005,F005 | ||
+ | 0006,F006 | ||
+ | 0007,F007 | ||
+ | 0008,F008 | ||
+ | 0009,F009 | ||
+ | [osotolongo@detritus fsdg]$ head demographics.csv | ||
+ | PSubject, | ||
+ | F001,71,8,0 | ||
+ | F002, | ||
+ | F003,70,8,0 | ||
+ | F004, | ||
+ | F005, | ||
+ | F006, | ||
+ | F007, | ||
+ | F008, | ||
+ | F009, | ||
+ | [osotolongo@detritus fsdg]$ join -t"," | ||
+ | [osotolongo@detritus fsdg]$ head body.csv | ||
+ | Variables Age Education Gender | ||
+ | Input facehbi_0001 Main 71 8 0 | ||
+ | Input facehbi_0002 Main 70 12 1 | ||
+ | Input facehbi_0003 Main 70 8 0 | ||
+ | Input facehbi_0004 Main 76 16 0 | ||
+ | Input facehbi_0005 Main 68 20 1 | ||
+ | Input facehbi_0006 Main 64 14 0 | ||
+ | Input facehbi_0007 Main 59 19 1 | ||
+ | Input facehbi_0008 Main 55 16 0 | ||
+ | Input facehbi_0009 Main 67 16 0 | ||
+ | [osotolongo@detritus fsdg]$ cat headers.txt | ||
+ | GroupDescriptorFile 1 | ||
+ | Title FACEHBI_all | ||
+ | Class Main | ||
+ | [osotolongo@detritus fsdg]$ cat headers.txt body.csv > facehbi.fsdg | ||
+ | [osotolongo@detritus fsdg]$ head facehbi.fsdg | ||
+ | GroupDescriptorFile 1 | ||
+ | Title FACEHBI_all | ||
+ | Class Main | ||
+ | Variables Age Education Gender | ||
+ | Input facehbi_0001 Main 71 8 0 | ||
+ | Input facehbi_0002 Main 70 12 1 | ||
+ | Input facehbi_0003 Main 70 8 0 | ||
+ | Input facehbi_0004 Main 76 16 0 | ||
+ | Input facehbi_0005 Main 68 20 1 | ||
+ | Input facehbi_0006 Main 64 14 0 | ||
+ | |||
+ | </ | ||
+ | |||
+ | ===== GLM Analysis (mri_glmfit) ===== | ||
+ | Primero construimos los contrastes, diciendole a FS cual es la variable que nos interesa, en este caso la edad, | ||
+ | |||
+ | https:// | ||
+ | |||
+ | <code bash> | ||
+ | [osotolongo@detritus fsdg]$ cat facehbi.mtx | ||
+ | 0 1 0 0 | ||
+ | </ | ||
+ | Ahora vamos a correr el modelo con este contraste, | ||
+ | <code bash> | ||
+ | [osotolongo@detritus fsdg]$ mris_preproc --fsgd facehbi.fsdg --cache-in thickness.fwhm10.fsaverage --target fsaverage --hemi lh --out lh.facehbi.age.thickness.10.mgh | ||
+ | [osotolongo@detritus fsdg]$ mri_glmfit --y lh.facehbi.age.thickness.10.mgh --fsgd facehbi.fsdg --C facehbi.mtx --surf fsaverage lh --cortex --glmdir lh.facehbi.age.glmdir | ||
+ | </ | ||
+ | |||
+ | Para usar freeview me he tenido que ir a la [[neuroimagen: | ||
+ | <code bash> | ||
+ | [fsluser@FSLVm7_64 fsdg]$ freeview -f $SUBJECTS_DIR/ | ||
+ | </ | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Cambiando el //overlay threshold// para que muestre toda la significancia, | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Ejemplo, fijando // | ||
+ | |||
+ | | {{ : | ||
+ | |||
+ | ===== Clusterwise Correction for Multiple Comparisons ===== | ||
+ | |||
+ | Ahora voy a buscar los clusters con una // | ||
+ | <code bash> | ||
+ | [osotolongo@detritus fsdg]$ mri_glmfit-sim --glmdir lh.facehbi.age.glmdir --cache 4 neg --cwp 0.05 --2spaces | ||
+ | </ | ||
+ | |||
+ | A ver, | ||
+ | <code bash> | ||
+ | freeview -f $SUBJECTS_DIR/ | ||
+ | </ | ||
+ | |||
+ | | {{ : | ||
+ | |||
+ | También hay un resumen de los clusters que se han encontrado a esta significancia, | ||
+ | |||
+ | <code bash> | ||
+ | [osotolongo@detritus fsdg]$ cat lh.facehbi.age.glmdir/ | ||
+ | # Cluster Growing Summary (mri_surfcluster) | ||
+ | # $Id: mri_surfcluster.c, | ||
+ | # $Id: mrisurf.c,v 1.781.2.6 2016/12/27 16:47:14 zkaufman Exp $ | ||
+ | # CreationTime 2020/ | ||
+ | # cmdline mri_surfcluster.bin --in lh.facehbi.age.glmdir/ | ||
+ | # cwd / | ||
+ | # sysname | ||
+ | # hostname detritus.fundacioace.com | ||
+ | # machine | ||
+ | # FixVertexAreaFlag 1 | ||
+ | # FixSurfClusterArea 1 | ||
+ | # | ||
+ | # Input lh.facehbi.age.glmdir/ | ||
+ | # Frame Number | ||
+ | # srcsubj fsaverage | ||
+ | # hemi lh | ||
+ | # surface white | ||
+ | # group_avg_surface_area 82220 | ||
+ | # group_avg_vtxarea_loaded 1 | ||
+ | # annot aparc | ||
+ | # SUBJECTS_DIR / | ||
+ | # SearchSpace_mm2 75610.7 | ||
+ | # SearchSpace_vtx 147840 | ||
+ | # Bonferroni 2 | ||
+ | # Minimum Threshold 4 | ||
+ | # Maximum Threshold infinity | ||
+ | # Threshold Sign neg | ||
+ | # AdjustThreshWhenOneTail 1 | ||
+ | # CW PValue Threshold: 0.05 | ||
+ | # Area Threshold | ||
+ | # CSD thresh | ||
+ | # CSD nreps 10000 | ||
+ | # CSD simtype | ||
+ | # CSD contrast NA | ||
+ | # CSD confint | ||
+ | # Overall max 2.34317 at vertex 124430 | ||
+ | # Overall min -11.9208 at vertex 75951 | ||
+ | # NClusters | ||
+ | # FixMNI = 0 | ||
+ | # | ||
+ | # ClusterNo | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | 10 | ||
+ | 11 | ||
+ | 12 | ||
+ | 13 | ||
+ | 14 | ||
+ | 15 | ||
+ | 16 | ||
+ | 17 | ||
+ | 18 | ||
+ | 19 | ||
+ | 20 | ||
+ | 21 | ||
+ | 22 | ||
+ | 23 | ||
+ | 24 | ||
+ | 25 | ||
+ | 26 | ||
+ | 27 | ||
+ | |||
+ | </ | ||
+ | |||
+ | ====== Full data ====== | ||
+ | |||
+ | < | ||
+ | osotolongo@detritus: | ||
+ | Subject, | ||
+ | 1,/ | ||
+ | 2,/ | ||
+ | 3,/ | ||
+ | 4,/ | ||
+ | 5,/ | ||
+ | 6,/ | ||
+ | 7,/ | ||
+ | 8,/ | ||
+ | 9,/ | ||
+ | |||
+ | |||
+ | osotolongo@detritus: | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | 10 SCDplus_APOE4 | ||
+ | 11 SCDplus_concernsaboutcognition | ||
+ | 12 SCDplus_feelingworsethancontemporarypeers | ||
+ | 13 SCDplus_informantcorroboratessymptoms | ||
+ | 14 SCDplus_onset60Y | ||
+ | 15 SCDplus_onsetwithinlast5Y | ||
+ | 16 SCDplus_SUVRgt1.35 | ||
+ | 17 SCDplus_SUVRgt1.45 | ||
+ | 18 SCDplus_Total7 | ||
+ | 19 Q_QSM_JPO | ||
+ | 20 SUVR | ||
+ | 21 Centilod | ||
+ | 22 APOE | ||
+ | 23 COMPOSITE_executive_fluency | ||
+ | 24 COMPOSITE_executive_processing speed | ||
+ | 25 COMPOSITE_executive_attention | ||
+ | 26 COMPOSITE_memory_FNAME professions | ||
+ | 27 COMPOSITE_memory_FNAME names | ||
+ | 28 COMPOSITES_memory_WMS | ||
+ | 29 COMPOSITE_memory_RBANS | ||
+ | 30 COMPOSITE_gnosis | ||
+ | 31 COMPOSITE_praxis | ||
+ | 32 COMPOSITE_languge_naming | ||
+ | </ | ||
+ | |||
+ | Voy a tomar uno de los composites para probar, | ||
+ | |||
+ | <code bash> | ||
+ | osotolongo@detritus: | ||
+ | osotolongo@detritus: | ||
+ | GroupDescriptorFile 1 Title FACEHBI_executive_fluency | ||
+ | Class Main | ||
+ | osotolongo@detritus: | ||
+ | osotolongo@detritus: | ||
+ | GroupDescriptorFile 1 | ||
+ | Title FACEHBI_executive_fluency | ||
+ | Class Main | ||
+ | Variables age education gender executive_fluency | ||
+ | Input facehbi_0001 Main 71 8 0 -0.5748 | ||
+ | Input facehbi_0002 Main 70 12 1 0.849066 | ||
+ | Input facehbi_0003 Main 70 8 0 -1.381163 | ||
+ | Input facehbi_0004 Main 76 16 0 -0.630893 | ||
+ | Input facehbi_0005 Main 68 20 1 1.256741 | ||
+ | Input facehbi_0006 Main 64 14 0 1.002492 | ||
+ | osotolongo@detritus: | ||
+ | 0 0 0 0 1 | ||
+ | |||
+ | </ | ||
+ | |||
+ | ahora empezamos, | ||
+ | |||
+ | <code bash> | ||
+ | osotolongo@detritus: | ||
+ | osotolongo@detritus: | ||
+ | osotolongo@detritus: | ||
+ | osotolongo@detritus: | ||
+ | osotolongo@detritus: | ||
+ | osotolongo@detritus: | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | Y esto lo hacemos para el otro hemisferio igualmente. Aqui no hay nada asi que podemos seguir hacia la siguiente variable, ;-) | ||
+ | |||
+ | **ejemplo de resultados** | ||
+ | |||
+ | <code bash> | ||
+ | osotolongo@detritus: | ||
+ | | ||
+ | </ | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | ===== bulk processing ===== | ||
+ | |||
+ | Esto es muy aburrido, asi que vamos a hacerlo todo junto, | ||
+ | |||
+ | <code bash fsgd.sh> | ||
+ | avar=$1 | ||
+ | shift | ||
+ | mris_preproc --fsgd ${avar}.fsgd --cache-in thickness.fwhm10.fsaverage --target fsaverage --hemi lh --out lh.${avar}.thickness.10.mgh | ||
+ | mris_preproc --fsgd ${avar}.fsgd --cache-in thickness.fwhm10.fsaverage --target fsaverage --hemi rh --out rh.${avar}.thickness.10.mgh | ||
+ | mri_glmfit --y lh.${avar}.thickness.10.mgh --fsgd ${avar}.fsgd --C comps.mtx --surf fsaverage lh --cortex --glmdir lh.${avar}.glmdir | ||
+ | mri_glmfit --y rh.${avar}.thickness.10.mgh --fsgd ${avar}.fsgd --C comps.mtx --surf fsaverage rh --cortex --glmdir rh.${avar}.glmdir | ||
+ | mri_glmfit-sim --glmdir lh.${avar}.glmdir --cache 4 neg --cwp 0.05 --2spaces | ||
+ | mri_glmfit-sim --glmdir rh.${avar}.glmdir --cache 4 neg --cwp 0.05 --2spaces | ||
+ | mri_glmfit-sim --glmdir lh.${avar}.glmdir --cache 4 pos --cwp 0.05 --2spaces | ||
+ | mri_glmfit-sim --glmdir rh.${avar}.glmdir --cache 4 pos --cwp 0.05 --2spaces | ||
+ | echo "lh, neg" | ||
+ | grep -v "#" | ||
+ | echo "rh, neg" | ||
+ | grep -v "#" | ||
+ | echo "lh, pos" | ||
+ | grep -v "#" | ||
+ | echo "rh, pos" | ||
+ | grep -v "#" | ||
+ | </ | ||
+ | |||
+ | |||
+ | todavia hay que hacer el archivo fsgd a mano pero despues de eso, | ||
+ | |||
+ | <code bash> | ||
+ | osotolongo@detritus: | ||
+ | GroupDescriptorFile 1 | ||
+ | Title FACEHBI_memory_wms | ||
+ | Class Main | ||
+ | Variables age education gender memory_WMS | ||
+ | Input facehbi_0001 Main 71 8 0 -0.453361 | ||
+ | Input facehbi_0002 Main 70 12 1 0.259093 | ||
+ | Input facehbi_0003 Main 70 8 0 -0.809587 | ||
+ | Input facehbi_0004 Main 76 16 0 -0.152722 | ||
+ | Input facehbi_0005 Main 68 20 1 0.630976 | ||
+ | Input facehbi_0006 Main 64 14 0 0.116602 | ||
+ | osotolongo@detritus: | ||
+ | </ | ||
+ | |||
+ | ===== Surface Area ===== | ||
+ | |||
+ | Tengo que añadir el ICV a los datos, (un poco de awk, sed, join, etc) y deberia quedar, | ||
+ | |||
+ | <code bash> | ||
+ | osotolongo@detritus: | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | 10 SCDplus_APOE4 | ||
+ | 11 SCDplus_concernsaboutcognition | ||
+ | 12 SCDplus_feelingworsethancontemporarypeers | ||
+ | 13 SCDplus_informantcorroboratessymptoms | ||
+ | 14 SCDplus_onset60Y | ||
+ | 15 SCDplus_onsetwithinlast5Y | ||
+ | 16 SCDplus_SUVRgt1.35 | ||
+ | 17 SCDplus_SUVRgt1.45 | ||
+ | 18 SCDplus_Total7 | ||
+ | 19 Q_QSM_JPO | ||
+ | 20 SUVR | ||
+ | 21 Centilod | ||
+ | 22 APOE | ||
+ | 23 COMPOSITE_executive_fluency | ||
+ | 24 COMPOSITE_executive_processing speed | ||
+ | 25 COMPOSITE_executive_attention | ||
+ | 26 COMPOSITE_memory_FNAME professions | ||
+ | 27 COMPOSITE_memory_FNAME names | ||
+ | 28 COMPOSITES_memory_WMS | ||
+ | 29 COMPOSITE_memory_RBANS | ||
+ | 30 COMPOSITE_gnosis | ||
+ | 31 COMPOSITE_praxis | ||
+ | 32 COMPOSITE_languge_naming | ||
+ | 33 EstimatedTotalIntraCranialVol | ||
+ | </ | ||
+ | |||
+ | Ahora ir escogiendo y pegando, | ||
+ | |||
+ | <code bash> | ||
+ | osotolongo@detritus: | ||
+ | osotolongo@detritus: | ||
+ | Variables age education gender SCDplus_Memorycomplaint EstimatedTotalIntraCranialVol | ||
+ | Input facehbi_0001 Main 71 8 0 0 1756453.4998 | ||
+ | Input facehbi_0002 Main 70 12 1 0 1529412.17649 | ||
+ | Input facehbi_0003 Main 70 8 0 0 1326413.64353 | ||
+ | Input facehbi_0004 Main 76 16 0 0 1368330.41095 | ||
+ | Input facehbi_0005 Main 68 20 1 0 1467058.62476 | ||
+ | Input facehbi_0006 Main 64 14 0 0 1300087.33412 | ||
+ | Input facehbi_0007 Main 59 19 1 1 1672996.58646 | ||
+ | Input facehbi_0008 Main 55 16 0 0 1230515.65242 | ||
+ | Input facehbi_0009 Main 67 16 0 0 1526642.95225 | ||
+ | osotolongo@detritus: | ||
+ | GroupDescriptorFile 1 | ||
+ | Title FACEHBI_SCDplus_Memorycomplaint | ||
+ | Class Main | ||
+ | osotolongo@detritus: | ||
+ | osotolongo@detritus: | ||
+ | GroupDescriptorFile 1 | ||
+ | Title FACEHBI_SCDplus_Memorycomplaint | ||
+ | Class Main | ||
+ | Variables age education gender SCDplus_Memorycomplaint EstimatedTotalIntraCranialVol | ||
+ | Input facehbi_0001 Main 71 8 0 0 1756453.4998 | ||
+ | Input facehbi_0002 Main 70 12 1 0 1529412.17649 | ||
+ | Input facehbi_0003 Main 70 8 0 0 1326413.64353 | ||
+ | Input facehbi_0004 Main 76 16 0 0 1368330.41095 | ||
+ | Input facehbi_0005 Main 68 20 1 0 1467058.62476 | ||
+ | Input facehbi_0006 Main 64 14 0 0 1300087.33412 | ||
+ | |||
+ | osotolongo@detritus: | ||
+ | 0 0 0 0 1 0 | ||
+ | |||
+ | </ | ||
+ | |||
+ | El codigo debe cambiar algo, | ||
+ | |||
+ | <code bash fsgda.sh> | ||
+ | avar=$1 | ||
+ | shift | ||
+ | mris_preproc --fsgd ${avar}.fsgd --cache-in area.fwhm10.fsaverage --target fsaverage --hemi lh --out lh.${avar}.area.10.mgh | ||
+ | mris_preproc --fsgd ${avar}.fsgd --cache-in area.fwhm10.fsaverage --target fsaverage --hemi rh --out rh.${avar}.area.10.mgh | ||
+ | mri_glmfit --y lh.${avar}.area.10.mgh --fsgd ${avar}.fsgd --C compsa.mtx --surf fsaverage lh --cortex --glmdir lh.${avar}.sa.glmdir | ||
+ | mri_glmfit --y rh.${avar}.area.10.mgh --fsgd ${avar}.fsgd --C compsa.mtx --surf fsaverage rh --cortex --glmdir rh.${avar}.sa.glmdir | ||
+ | mri_glmfit-sim --glmdir lh.${avar}.sa.glmdir --cache 4 neg --cwp 0.05 --2spaces | ||
+ | mri_glmfit-sim --glmdir rh.${avar}.sa.glmdir --cache 4 neg --cwp 0.05 --2spaces | ||
+ | mri_glmfit-sim --glmdir lh.${avar}.sa.glmdir --cache 4 pos --cwp 0.05 --2spaces | ||
+ | mri_glmfit-sim --glmdir rh.${avar}.sa.glmdir --cache 4 pos --cwp 0.05 --2spaces | ||
+ | echo "lh, neg" | ||
+ | grep -v "#" | ||
+ | echo "rh, neg" | ||
+ | grep -v "#" | ||
+ | echo "lh, pos" | ||
+ | grep -v "#" | ||
+ | echo "rh, pos" | ||
+ | grep -v "#" | ||
+ | </ | ||
+ | |||
+ | No hay demasiados resultados pero alguno si, | ||
+ | |||
+ | <code bash> | ||
+ | osotolongo@detritus: | ||
+ | ... | ||
+ | ... | ||
+ | ... | ||
+ | lh, neg | ||
+ | rh, neg | ||
+ | lh, pos | ||
+ | | ||
+ | rh, pos | ||
+ | </ | ||
+ | |||
+ | ahi ya sabemos donde buscar, | ||
+ | |||
+ | <code bash> | ||
+ | osotolongo@detritus: | ||
+ | GroupDescriptorFile 1 | ||
+ | Title FACEHBI_SCDplus_SUVRgt1.35 | ||
+ | Class Main | ||
+ | |||
+ | osotolongo@detritus: | ||
+ | ... | ||
+ | ... | ||
+ | ... | ||
+ | # ClusterNo | ||
+ | | ||
+ | </ | ||
+ | |||
+ | |||
+ | Otros resultados, | ||
+ | |||
+ | < | ||
+ | scd17a | ||
+ | |||
+ | lh, neg | ||
+ | rh, neg | ||
+ | lh, pos | ||
+ | | ||
+ | rh, pos | ||
+ | |||
+ | |||
+ | </ | ||
+ | |||