#!/bin/tcsh -f ################################################# ## 04/2022 Justin Rajendra ## launch shiny plot of RBA outputs ## get the current program name set prog = `basename $0` ## find the shiny folder set afni_bin = `which ${prog}` set afni_dir = `dirname ${afni_bin}` set ShinyFolder = "${afni_dir}/shiny/bayes_view" set InFolder = "" ## show help if ( $#argv < 1 ) then goto SHOW_HELP endif ## parse args set narg = 1 @ amax = $#argv - 0 while ( $narg <= $amax ) if ( "$argv[$narg]" == "-help" || "$argv[$narg]" == "-h" ) then goto SHOW_HELP else if ( "$argv[$narg]" == "-ShinyFolder" ) then @ narg ++ set ShinyFolder = `echo $argv[$narg]` else set InFolder = `echo $argv[$narg]` endif @ narg ++ end ## check the inputs if ( "$InFolder" == "" ) then goto SHOW_HELP endif if ( ! -d $InFolder ) then echo ; echo "Error: ${InFolder} does not exist." ; echo ; exit 1 endif ## get full path for the input folder cd $InFolder set data_dir = `pwd` cd - ## launch shiny R --slave --no-restore \ -e "shiny::runApp('${ShinyFolder}', launch.browser=TRUE)" --args $data_dir & exit 0 ########################################################################## SHOW_HELP: cat << EOF ---------------------------------------------------------------------------- $prog Launch a shiny app to visualize RBA output files. The files must have the .RData extension. Takes one argument, a path to a folder with said files. That path MUST be the last argument! May need "@afni_R_package_install -custom ..." for R libraries. ----------------------------------------------------------------------------- options: -help : Show this help. -ShinyFolder : Use a custom shiny folder (for testing purposes). ----------------------------------------------------------------------------- examples: $prog ~/disco_RBA_folder ----------------------------------------------------------------------------- Justin Rajendra 04/2022 EOF exit 0