User Tools

Site Tools


neuroimagen:fs_group_analysis

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
neuroimagen:fs_group_analysis [2020/06/11 13:27] – [GLM Analysis (mri_glmfit)] osotolongoneuroimagen:fs_group_analysis [2020/08/04 10:58] (current) – external edit 127.0.0.1
Line 184: Line 184:
  
 </code> </code>
 +
 +====== Full data ======
 +
 +<code>
 +osotolongo@detritus:facehbi$ head datacomb_freesurfer_neuro_v0_scdSUMCC.csv
 +Subject,SubjID,code_facehbi,N_Interno,Date,edat,Anyos_Escolaridad_FAC,Sex_1H_0M,SCDplus_Memorycomplaint,SCDplus_APOE4,SCDplus_concernsaboutcognition,SCDplus_feelingworsethancontemporarypeers,SCDplus_informantcorroboratessymptoms,SCDplus_onset60Y,SCDplus_onsetwithinlast5Y,SCDplus_SUVRgt1.35,SCDplus_SUVRgt1.45,SCDplus_Total7,Q_QSM_JPO,SUVR,Centilod,APOE,COMPOSITE_executive_fluency ,COMPOSITE_executive_processing speed ,COMPOSITE_executive_attention ,COMPOSITE_memory_FNAME professions,COMPOSITE_memory_FNAME names ,COMPOSITES_memory_WMS ,COMPOSITE_memory_RBANS ,COMPOSITE_gnosis,COMPOSITE_praxis,COMPOSITE_languge_naming 
 +1,/nas/data/subjects/facehbi_0001,F001,20090806,11.12.2014,71,8,0,0,1,1,0,1,1,1,0,0,5,39,0.973316491,-5.593250248,e3e4,-0.5748,-0.270392,-0.532514,-0.616904,0.876729,-0.453361,1.130826,0.168598,0.515105,-0.579091
 +2,/nas/data/subjects/facehbi_0002,F002,20131084,11.12.2014,70,12,1,0,0,0,0,1,1,1,0,0,3,18,1.088375542,12.05680811,e3e3,0.849066,-0.703145,0.071122,0.91243,0.399876,0.259093,1.048653,1.256325,0.515105,0.926364
 +3,/nas/data/subjects/facehbi_0003,F003,20130456,18.12.2014,70,8,0,0,0,0,0,0,1,1,0,0,2,19,0.961914381,-7.342333945,e3e3,-1.381163,1.677785,-1.150127,-1.024665,0.195343,-0.809587,1.426227,1.256325,-0.772658,-0.388182
 +4,/nas/data/subjects/facehbi_0004,F004,20080130,18.12.2014,76,16,0,0,0,1,0,0,1,1,0,0,3,21,1.075781955,10.12495194,e3e3,-0.630893,-0.4805,-1.13615,-0.512863,-0.622202,-0.152722,-0.907758,0.168598,-2.060421,0.164545
 +5,/nas/data/subjects/facehbi_0005,F005,20141272,22.01.2015,68,20,1,0,0,0,1,1,1,0,0,0,3,29,0.95654587,-8.16586361,e2e3,1.256741,-0.549082,1.320324,0.704347,1.321653,0.630976,0.512283,0.168598,-2.060421,0.396364
 +6,/nas/data/subjects/facehbi_0006,F006,20141107,15.01.2015,64,14,0,0,1,1,1,1,1,1,1,0,6,56,1.253344903,37.36310815,e3e4,1.002492,0.610598,0.688735,0.610631,-0.71047,0.116602,-0.507294,-0.91913,-2.060421,-0.039091
 +7,/nas/data/subjects/facehbi_0007,F007,20080716,15.01.2015,59,19,1,1,0,1,0,0,0,0,1,1,2,15,1.504516347,75.89280769,e3e3,1.040233,0.70185,-0.518537,-0.204993,0.311608,0.345995,-0.114041,-0.91913,-3.348184,0.090909
 +8,/nas/data/subjects/facehbi_0008,F008,20131483,15.01.2015,55,16,0,0,0,1,0,1,0,1,0,0,3,72,0.897682014,-17.19557899,e3e3,-1.363541,0.552768,-0.532514,-0.111277,0.980961,-0.781793,1.473992,-0.91913,0.515105,-0.439091
 +9,/nas/data/subjects/facehbi_0009,F009,20141277,29.01.2015,67,16,0,0,0,0,0,0,1,1,0,0,2,18,1.033333445,3.613350513,e3e3,0.674792,0.532426,0.688735,-0.920727,-0.826734,-1.110226,-1.451403,-0.91913,-0.772658,1.016462
 +
 +
 +osotolongo@detritus:facehbi$ head -n 1 datacomb_freesurfer_neuro_v0_scdSUMCC.csv | sed 's/,/\n/g' | cat -n
 +      Subject
 +      SubjID
 +      code_facehbi
 +      N_Interno
 +      Date
 +      edat
 +      Anyos_Escolaridad_FAC
 +      Sex_1H_0M
 +      SCDplus_Memorycomplaint
 +    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 
 +</code>
 +
 +Voy a tomar uno de los composites para probar,
 +
 +<code bash>
 +osotolongo@detritus:facehbi$ awk -F"," {'print $2","$6","$7","$8","$23'} datacomb_freesurfer_neuro_v0_scdSUMCC.csv | sed 's/.*\/facehbi_/facehbi_/;s/SubjID/Variables/;s/edat/age/;s/Anyos_Escolaridad_FAC/education/;s/Sex_1H_0M/gender/;s/COMPOSITE_//;s/facehbi_\([^,]*\),/Input facehbi_\1 Main /; s/,/ /g' > executive_fluency_body.tsv
 +osotolongo@detritus:facehbi$ cat executive_fluency_header.txt
 +GroupDescriptorFile 1                                                                                                  Title FACEHBI_executive_fluency
 +Class Main
 +osotolongo@detritus:facehbi$ cat executive_fluency_header.txt executive_fluency_body.tsv > executive_fluency.fsgd
 +osotolongo@detritus:facehbi$ head executive_fluency.fsgd
 +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:facehbi$ cat comps.mtx
 +0 0 0 0 1
 +
 +</code>
 +
 +ahora empezamos,
 +
 +<code bash>
 +osotolongo@detritus:facehbi$ mris_preproc --fsgd executive_fluency.fsgd --cache-in thickness.fwhm10.fsaverage --target fsaverage --hemi lh --out lh.executive_fluency.thickness.10.mgh
 +osotolongo@detritus:facehbi$ mri_glmfit --y lh.executive_fluency.thickness.10.mgh --fsgd executive_fluency.fsgd --C comps.mtx --surf fsaverage lh --cortex --glmdir lh.executive_fluency.glmdir
 +osotolongo@detritus:facehbi$ mri_glmfit-sim --glmdir lh.executive_fluency.glmdir --cache 4 neg --cwp 0.05 --2spaces
 +osotolongo@detritus:facehbi$ grep -v "#" lh.executive_fluency.glmdir/comps/cache.th40.neg.sig.cluster.summary
 +osotolongo@detritus:facehbi$ mri_glmfit-sim --glmdir lh.executive_fluency.glmdir --cache 4 pos --cwp 0.05 --2spaces
 +osotolongo@detritus:facehbi$ grep -v "#" lh.executive_fluency.glmdir/comps/cache.th40.pos.sig.cluster.summary
 +
 +</code>
 +
 +
 +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:facehbi$ grep -v "#" lh.executive_processing.glmdir/comps/cache.th40.neg.sig.cluster.summary
 +         -6.662  147537    122.63    -24.1  -78.1   17.4  0.00739  0.00579  0.00898    237    -1176.13  superiorparietal
 +</code>
 +
 +{{ :neuroimagen:sig.png|}}
 +
 +{{ :neuroimagen:clusters.png|}}
 +
 +===== 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 "#" lh.${avar}.glmdir/comps/cache.th40.neg.sig.cluster.summary
 +echo "rh, neg"
 +grep -v "#" rh.${avar}.glmdir/comps/cache.th40.neg.sig.cluster.summary
 +echo "lh, pos"
 +grep -v "#" lh.${avar}.glmdir/comps/cache.th40.pos.sig.cluster.summary
 +echo "rh, pos"
 +grep -v "#" rh.${avar}.glmdir/comps/cache.th40.pos.sig.cluster.summary
 +</code>
 +
 +
 +todavia hay que hacer el archivo fsgd a mano pero despues de eso,
 +
 +<code bash>
 +osotolongo@detritus:facehbi$ head wms.fsgd
 +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:facehbi$ ./fsgd.sh wms
 +</code>
 +
 +===== 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:facehbi$ head -n 1 datacomb_freesurfer_neuro_v0_scdSUMCC_icv.csv | sed 's/,/\n/g' | cat -n
 +      code_facehbi
 +      Subject
 +      SubjID
 +      N_Interno
 +      Date
 +      edat
 +      Anyos_Escolaridad_FAC
 +      Sex_1H_0M
 +      SCDplus_Memorycomplaint
 +    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
 +</code>
 +
 +Ahora ir escogiendo y pegando,
 +
 +<code bash>
 +osotolongo@detritus:facehbi$ awk -F"," {'print $3","$6","$7","$8","$9","$33'} datacomb_freesurfer_neuro_v0_scdSUMCC_icv.csv | sed 's/.*\/facehbi_/facehbi_/;s/SubjID/Variables/;s/edat/age/;s/Anyos_Escolaridad_FAC/education/;s/Sex_1H_0M/gender/;s/facehbi_\([^,]*\),/Input facehbi_\1 Main /; s/,/ /g' > scd9a.tsv
 +osotolongo@detritus:facehbi$ head scd9a.tsv
 +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:facehbi$ cat scd9a.header 
 +GroupDescriptorFile 1
 +Title FACEHBI_SCDplus_Memorycomplaint
 +Class Main
 +osotolongo@detritus:facehbi$ cat scd9a.header scd9a.tsv > scd9a.fsgd
 +osotolongo@detritus:facehbi$ head scd9a.fsgd
 +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:facehbi$ cat compsa.mtx 
 +0 0 0 0 1 0
 +
 +</code>
 +
 +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 "#" lh.${avar}.sa.glmdir/compsa/cache.th40.neg.sig.cluster.summary
 +echo "rh, neg"
 +grep -v "#" rh.${avar}.sa.glmdir/compsa/cache.th40.neg.sig.cluster.summary
 +echo "lh, pos"
 +grep -v "#" lh.${avar}.sa.glmdir/compsa/cache.th40.pos.sig.cluster.summary
 +echo "rh, pos"
 +grep -v "#" rh.${avar}.sa.glmdir/compsa/cache.th40.pos.sig.cluster.summary
 +</code>
 +
 +No hay demasiados resultados pero alguno si,
 +
 +<code bash>
 +osotolongo@detritus:facehbi$ ./fsgda.sh scd16a
 +...
 +...
 +...
 +lh, neg
 +rh, neg
 +lh, pos
 +          4.160   87102    125.74    -25.2  -79.5   13.8  0.03135  0.02820  0.03450    252      991.50  superiorparietal
 +rh, pos
 +</code>
 +
 +ahi ya sabemos donde buscar,
 +
 +<code bash>
 +osotolongo@detritus:facehbi$ cat scd16a.header 
 +GroupDescriptorFile 1
 +Title FACEHBI_SCDplus_SUVRgt1.35
 +Class Main
 +
 +osotolongo@detritus:facehbi$ cat lh.scd16a.sa.glmdir/compsa/cache.th40.pos.sig.cluster.summary
 +...
 +...
 +...
 +# ClusterNo  Max   VtxMax   Size(mm^2)  MNIX   MNIY   MNIZ    CWP    CWPLow    CWPHi   NVtxs    WghtVtx   Annot
 +          4.160   87102    125.74    -25.2  -79.5   13.8  0.03135  0.02820  0.03450    252      991.50  superiorparietal
 +</code>
 +
 +
 +Otros resultados, 
 +
 +<code>
 +scd17a
 +
 +lh, neg
 +rh, neg
 +lh, pos
 +          5.013  112180    428.88    -32.5  -81.3   14.8  0.00020  0.00000  0.00040    714     3121.90  inferiorparietal
 +rh, pos
 +
 +
 +</code>
 +
  
neuroimagen/fs_group_analysis.1591882060.txt.gz · Last modified: 2020/08/04 10:47 (external edit)