
#######################################################################
How to run mMARCH.AC?
#######################################################################
(0) Install the package

Install GGIR with its dependencies from CRAN

install.packages("GGIR", dependencies = TRUE)


Alternatively, to install the latest development version with the latest bug fixes use instead:

install.packages("remotes")
remotes::install_github("WeiGuoNIMH/mMARCH.AC")

 

(1) create the template file in R 
 
library(mMARCH.AC) 
create.shell() 


(2) cat STUDYNAME_part0.maincall.R > Example_part0.maincall.R

(3) fill in the paramters in Example_part0.maincall.R 
 
currentdir =  
studyname =
bindir = NULL
binfile.list = NULL
outputdir =  
QCdays.alpha = 0
QChours.alpha = 0
part5FN = 
   ......


(4)  Call Example_part0.maincall.R to create all template files 

R>  call.afterggir(mode=0)
or
R --no-save --no-restore --args  < Example_part0.maincall.R  0

The following files are created, 
   part5_Example_mMARCH.AC.report.Rmd
   part6_Example_mMARCH.AC.nonwear.report.Rmd
   part7a_Example_mMARCH.AC_JIVE_1_somefeatures.Rmd
   part7b_Example_mMARCH.AC_JIVE_2_allfeatures.Rmd
   part7c_Example_mMARCH.AC_JIVE_3_excelReport.Rmd
   part7d_Example_mMARCH.AC_JIVE_4_outputReport.Rmd
   part7e_Example_mMARCH.AC_JIVE_5_somefeatures_weekday.Rmd
   part9_swarm.sh

(5) Within R,
    call.afterggir(mode=1)
    call.afterggir(mode=2)
    call.afterggir(mode=3)
    call.afterggir(mode=4)
    run part5_Example_mMARCH.AC.report.Rmd
    run part6_Example_mMARCH.AC.nonwear.report.Rmd
    run part7a_Example_mMARCH.AC_JIVE_1_somefeatures.Rmd
    run part7b_Example_mMARCH.AC_JIVE_2_allfeatures.Rmd 
    run part7c_Example_mMARCH.AC_JIVE_3_runJIVE.Rmd
    run part7d_Example_mMARCH.AC_JIVE_4_somefeatures_weekday.Rmd

(6) Or Submit all jobs to a cluster  

sbatch --time=100:00:00 --mem=120g    part9_swarm.sh   


Note. Due to small sample size in the example data, some features such as functional PCA may not able to run successfully.
