diff --git a/04-gwas.sh b/04-gwas.sh index 3c5d1e0..121e33d 100755 --- a/04-gwas.sh +++ b/04-gwas.sh @@ -9,8 +9,10 @@ source config.env # create results directory mkdir -p ${results_dir}/04 + +index=$1 # log everything from this script to a logfile in the results director -exec &> >(tee ${results_dir}/04/logfile_step1) +exec &> >(tee ${results_dir}/04/logfile_${index}) # Inputs: @@ -27,13 +29,13 @@ exec &> >(tee ${results_dir}/04/logfile_step1) # Output: # - GWAS summary stats per phen x age x ancestry -# - results/04/phen___.* +# - results/04/phen___.fastGWA.gz +# - results/04/phen___.fastGWA.summary.rds phenolist=( $(cat ${phenotype_processed_dir}/phenolist) ) # Allow specific analysis to be run # Can take any number between 1:ngwas where ngwas is the number of rows in ${phenotype_processed_dir}/phenolist -index=$1 nphen=`cat ${phenotype_processed_dir}/phenolist | wc -l` if [ -z $index ] diff --git a/utils/archive.sh b/utils/archive.sh index 367b711..0c1a03d 100755 --- a/utils/archive.sh +++ b/utils/archive.sh @@ -41,11 +41,12 @@ fi if [ $step -eq "04" ]; then nphen=`cat ${phenotype_processed_dir}/phenolist | wc -l` - nsuccess=`tail -n 1 ${results_dir}/04/logfile* | grep -i "Success" | wc -l` - if [ "${nphen}" = "${nsuccess}" ]; then + nsuccess1=`ls -1 ${results_dir}/04/*fastGWA.gz | wc -l` + nsuccess2=`ls -1 ${results_dir}/04/*fastGWA.summary.rds | wc -l` + if [ "${nphen}" = "${nsuccess1}" ] && [ "${nphen}" = "${nsuccess2}" ]; then echo "GWAS completed successfully for all ${nphen} phenotypes" else - echo "Problem: only ${nsuccess} of ${nphen} expected phenotypes completed. Please check logs in ${results_dir}/04" + echo "Problem: only ${nsuccess1} GWAS results and ${nsuccess2} summaries of ${nphen} expected phenotypes completed. Please check logs in ${results_dir}/04" exit 1 fi fi