Skip to content

Commit

Permalink
fixed checks of 04
Browse files Browse the repository at this point in the history
  • Loading branch information
explodecomputer committed Jan 16, 2025
1 parent f172a2e commit 292ddac
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
8 changes: 5 additions & 3 deletions 04-gwas.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -27,13 +29,13 @@ exec &> >(tee ${results_dir}/04/logfile_step1)
# Output:

# - GWAS summary stats per phen x age x ancestry
# - results/04/phen_<phencode>_<ancestry>_<age>.*
# - results/04/phen_<phencode>_<ancestry>_<age>.fastGWA.gz
# - results/04/phen_<phencode>_<ancestry>_<age>.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 ]
Expand Down
7 changes: 4 additions & 3 deletions utils/archive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 292ddac

Please sign in to comment.