User Tools

Site Tools


neuroimagen:fs_long_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_long_analysis [2020/07/15 08:49] – [añadiendo variables] osotolongoneuroimagen:fs_long_analysis [2020/08/16 10:25] (current) – [Paired Analysis] osotolongo
Line 2: Line 2:
  
 https://surfer.nmr.mgh.harvard.edu/fswiki/LongitudinalProcessing https://surfer.nmr.mgh.harvard.edu/fswiki/LongitudinalProcessing
 +
 +https://surfer.nmr.mgh.harvard.edu/fswiki/LongitudinalStatistics
  
 Tengo dos puntos del proyecto FACEHBI asi que puedo hacer un proyecto longitudinal (apenas). A tener en cuenta, Tengo dos puntos del proyecto FACEHBI asi que puedo hacer un proyecto longitudinal (apenas). A tener en cuenta,
Line 601: Line 603:
 ck.mgh --isec-labels lh.lfacehbi.fsaverage.cortex.label ck.mgh --isec-labels lh.lfacehbi.fsaverage.cortex.label
 ... ...
 +[osotolongo@detritus lfacehbi]$ mri_glmfit --osgm --glmdir lh.lfacehbi.thickness-pc1.fwhm15 --y lh.lfacehbi.thickness-pc1.stack.fwhm15.mgh --label lh.lfacehbi.fsaverage.cortex.label --surf fsaverage lh
 +[osotolongo@detritus lfacehbi]$ mri_glmfit-sim --glmdir lh.lfacehbi.thickness-pc1.fwhm15/ --cache 4 neg --cwp  0.05 --2spaces
 </code> </code>
 +
 +{{ :neuroimagen:osgm_clusters_morecov.png|}}
 +
 +{{ :neuroimagen:osgm_significance_morecov.png|}}
 +
 +
 +<code>
 +[osotolongo@detritus lfacehbi]$ cat lh.lfacehbi.thickness-pc1.fwhm15/osgm/cache.th40.neg.sig.cluster.summary
 +# Cluster Growing Summary (mri_surfcluster)
 +# $Id: mri_surfcluster.c,v 1.57.2.3 2016/11/17 18:19:42 zkaufman Exp $
 +# $Id: mrisurf.c,v 1.781.2.6 2016/12/27 16:47:14 zkaufman Exp $
 +# CreationTime 2020/07/16-07:40:57-GMT
 +# cmdline mri_surfcluster.bin --in lh.lfacehbi.thickness-pc1.fwhm15//osgm/sig.mgh --mask lh.lfacehbi.thickness-pc1.fwhm15//mask.mgh --cwsig lh.lfacehbi.thickness-pc1.fwhm15//osgm/cache.th40.neg.sig.cluster.mgh --sum lh.lfacehbi.thickness-pc1.fwhm15//osgm/cache.th40.neg.sig.cluster.summary --ocn lh.lfacehbi.thickness-pc1.fwhm15//osgm/cache.th40.neg.sig.ocn.mgh --annot aparc --cwpvalthresh 0.05 --o lh.lfacehbi.thickness-pc1.fwhm15//osgm/cache.th40.neg.sig.masked.mgh --no-fixmni --csd /usr/local/freesurfer/average/mult-comp-cor/fsaverage/lh/cortex/fwhm16/neg/th40/mc-z.csd --csdpdf lh.lfacehbi.thickness-pc1.fwhm15//osgm/cache.th40.neg.pdf.dat --vwsig lh.lfacehbi.thickness-pc1.fwhm15//osgm/cache.th40.neg.sig.voxel.mgh --vwsigmax lh.lfacehbi.thickness-pc1.fwhm15//osgm/cache.th40.neg.sig.voxel.max.dat --oannot lh.lfacehbi.thickness-pc1.fwhm15//osgm/cache.th40.neg.sig.ocn.annot --bonferroni 2 --surf white 
 +# cwd /nas/data/lfacehbi
 +# sysname  Linux
 +# hostname detritus.fundacioace.com
 +# machine  x86_64
 +# FixVertexAreaFlag 1
 +# FixSurfClusterArea 1
 +
 +# Input      lh.lfacehbi.thickness-pc1.fwhm15//osgm/sig.mgh
 +# Frame Number      0
 +# srcsubj fsaverage
 +# hemi lh
 +# surface white
 +# group_avg_surface_area 82220
 +# group_avg_vtxarea_loaded 1
 +# annot aparc
 +# SUBJECTS_DIR /nas/data/subjects
 +# SearchSpace_mm2 75466.5
 +# SearchSpace_vtx 147613
 +# Bonferroni 2
 +# Minimum Threshold 4
 +# Maximum Threshold infinity
 +# Threshold Sign    neg
 +# AdjustThreshWhenOneTail 1
 +# CW PValue Threshold: 0.05 
 +# Area Threshold    0 mm^2
 +# CSD thresh  4.000000
 +# CSD nreps    10000
 +# CSD simtype  null-z
 +# CSD contrast NA
 +# CSD confint  90.000000
 +# Overall max 3.29752 at vertex 122410
 +# Overall min -6.1539 at vertex 79545
 +# NClusters          5
 +# FixMNI = 0
 +
 +# ClusterNo  Max   VtxMax   Size(mm^2)  MNIX   MNIY   MNIZ    CWP    CWPLow    CWPHi   NVtxs    WghtVtx   Annot
 +         -4.666   69976    543.01    -46.8  -63.9   -5.4  0.00020  0.00000  0.00040    950    -3790.21  inferiortemporal
 +         -6.154   79545    343.66    -59.2  -33.7  -16.6  0.00020  0.00000  0.00040    554    -2475.20  middletemporal
 +         -5.453  122049    309.70    -43.5  -57.4   26.6  0.00020  0.00000  0.00040    664    -2881.33  inferiorparietal
 +         -5.080  120104    241.40    -42.6  -38.3   10.1  0.00040  0.00000  0.00080    683    -2914.49  superiortemporal
 +         -5.054   72121    120.14    -40.1  -31.3   35.2  0.01475  0.01256  0.01693    367    -1580.34  supramarginal
 +</code>
 +
 +----
  
 **Voy a intentar algo aqui** **Voy a intentar algo aqui**
Line 634: Line 695:
  
 <code bash> <code bash>
 +[osotolongo@detritus lfacehbi]$ mris_preproc --fsgd qdec.fsgd --target fsaverage --hemi lh --meas thickness --out lh.long.thickness.00.mgh
 +[osotolongo@detritus lfacehbi]$ mri_surf2surf --hemi lh --s fsaverage --sval lh.long.thickness.00.mgh --fwhm 10 --cortex --tval lh.long.thickness.10.mgh
 +</code>
  
 +y lanzo el analisis ahora,
 +
 +<code bash>
 +[osotolongo@detritus lfacehbi]$ mri_glmfit --fsgd qdec.fsgd --glmdir lh.long.thickness.fwhm10 --y lh.long.thickness.10.mgh --C centiloid.mtx --C apoe.mtx --C years.mtx --C age.mtx --surf fsaverage lh
 </code> </code>
  
 +Voy a ver,
 +
 +Edad:
 +
 +<code bash>
 +$ freeview -f  /nas/data/subjects/fsaverage/surf/lh.inflated:annot=aparc.annot:annot_outline=1:overlay=lh.long.thickness.fwhm10/age/sig.mgh:overlay_threshold=4,5 -viewport 3d
 +</code>
 +
 +{{ :neuroimagen:screenshot2020-07-1511_29_19.png|}}
 +
 +
 +
 +APOEe4:
 +
 +<code bash>
 +$ freeview -f  /nas/data/subjects/fsaverage/surf/lh.inflated:annot=aparc.annot:annot_outline=1:overlay=lh.long.thickness.fwhm10/apoe/sig.mgh:overlay_threshold=4,5 -viewport 3d
 +</code>
 +
 +{{ :neuroimagen:screenshot2020-07-1511_42_58.png|}}
 +
 +
 +
 +===== Paired Analysis =====
 +
 +Esto es una especie de ANOVA simplificada para dos puntos.
 +
 +https://surfer.nmr.mgh.harvard.edu/fswiki/PairedAnalysis
 +
 +Variables:
 +
 +<code bash>
 +[osotolongo@detritus lfacehbi]$ join -t";" -1 1 -2 2 flong_2concat.csv data_2concat_wvars.csv | head -n 1 | sed 's/;/\n/g' | cat -n
 +     1 Subject
 +     2 flong_subject
 +     3 SubjID_v0
 +     4 SubjID_v2
 +     5 PSubject
 +     6 years
 +     7 age
 +     8 Education
 +     9 Gender
 +    10 CLv0
 +    11 CLv2
 +    12 ApoeE4
 +</code>
 +
 +Los pares son asi entonces,
 +
 +<code bash>
 +[osotolongo@detritus lfacehbi]$ join -t";" -1 1 -2 2 flong_2concat.csv data_2concat_wvars.csv | tail -n +2 |awk -F";" '{print "Input "$3" Main "$7" "$8" "$9" "$10" "$12"\nInput "$4" Main "$7+$6" "$8" "$9" "$11" "$12}' > pairs.fsgd
 +[osotolongo@detritus lfacehbi]$ sed -i '1iGroupDescriptorFile 1\nClass Main' pairs.fsgd
 +[osotolongo@detritus lfacehbi]$ head pairs.fsgd
 +GroupDescriptorFile 1
 +Class Main
 +Input facehbi_0001 Main 71 8 0 -5.5932502480232 1
 +Input f2cehbi_0001 Main 73.14 8 0 -3.01177159588474 1
 +Input facehbi_0002 Main 70 12 1 12.0568081099059 0
 +Input f2cehbi_0002 Main 72.3 12 1 9.07793600565404 0
 +Input facehbi_0003 Main 70 8 0 -7.34233394547346 0
 +Input f2cehbi_0003 Main 72.12 8 0 -7.74822070800795 0
 +Input facehbi_0005 Main 68 20 1 -8.16586361015402 0
 +Input f2cehbi_0004 Main 70.05 20 1 39.4041710834628 0
 +</code>
 +
 +y empezamos,
 +
 +<code bash>
 +[osotolongo@detritus lfacehbi]$ mris_preproc --target fsaverage --hemi lh --meas thickness --out lh.paired-diff.thickness.mgh --fsgd pairs.fsgd --paired-diff
 +nsubjects = 318
 +tmpdir is ./tmp.mris_preproc.89542
 +/nas/data/lfacehbi
 +Log file is lh.paired-diff.thickness.mris_preproc.log
 +...
 +...
 +...
 +[osotolongo@detritus lfacehbi]$ mri_surf2surf --s fsaverage --hemi lh --fwhm 5 --sval lh.paired-diff.thickness.mgh --tval lh.paired-diff.thickness.sm05.mgh
 +...
 +...
 +...
 +
 +</code>
 +
 +hacemos los //.mtx//,
 +
 +<code bash>
 +[osotolongo@detritus lfacehbi]$ echo "0 1 0 0 0 0" > age.mtx
 +</code>
 +
 +cada variable a analizar debe tener uno,
 +<code bash>
 +[osotolongo@detritus lfacehbi]$ cat mean.mtx
 +1 0 0 0 0 0
 +[osotolongo@detritus lfacehbi]$ cat age.mtx
 +0 1 0 0 0 0
 +[osotolongo@detritus lfacehbi]$ cat apoe.mtx
 +0 0 0 0 0 1
 +[osotolongo@detritus lfacehbi]$ cat centiloid.mtx
 +0 0 0 0 1 0
 +</code>
 +
 +y hay que hacer el segundo archivo //.fsgd//. Primero voy a eliminar lso caracteres raros que de alguan manera han venido del archivo windows original.
 +
 +<code bash>
 +[osotolongo@detritus lfacehbi]$ sed 's/^M//' pairs.fsgd > pairs_unix.fsgd
 +[osotolongo@detritus lfacehbi]$ tr -d '\r' < pairs_unix.fsgd > pairs_ok.fsgd
 +</code>
 +
 +y ahora elimino las referencias al segundo punto y cambio el nombre del primer punto, para tener nombres que no existan aun,
 +<code bash>
 +[osotolongo@detritus lfacehbi]$ grep -v  f2cehbi pairs_ok.fsgd | sed 's/facehbi/facehbi_pair/' > pair_diff.fsgd
 +[osotolongo@detritus lfacehbi]$ sed -i '3iVariables Age Education Gender CL APOE' pair_diff.fsgd
 +</code>
 +
 +y ahora el //glmfit//,
 +
 +<code bash>
 +[osotolongo@detritus lfacehbi]$ mri_glmfit --glmdir lh.paired-diff --y lh.paired-diff.thickness.sm05.mgh --fsgd pair_diff.fsgd --C mean.mtx --C age.mtx --C apoe.mtx --C centiloid.mtx --surf fsaverage lh
 +</code>
 +
 +y obtenemos un analisis para cada variable,
 +
 +<code bash>
 +[osotolongo@detritus lfacehbi]$ tree -d lh.paired-diff/
 +lh.paired-diff/
 +├── age
 +├── apoe
 +├── centiloid
 +└── mean
 +
 +4 directories
 +[osotolongo@detritus lfacehbi]$ tree lh.paired-diff/mean/
 +lh.paired-diff/mean/
 +├── C.dat
 +├── cnr.mgh
 +├── efficiency.dat
 +├── F.mgh
 +├── gamma.mgh
 +├── gammavar.mgh
 +├── maxvox.dat
 +├── pcc.mgh
 +├── sig.mgh
 +└── z.mgh
 +
 +0 directories, 10 files
 +
 +</code>
  
 +**Desgraciadamente sin resultados** m(
neuroimagen/fs_long_analysis.1594802967.txt.gz · Last modified: 2020/08/04 10:45 (external edit)