Skip to content

Commit

Permalink
Merge pull request #206 from RoanKanninga/master
Browse files Browse the repository at this point in the history
checkSamplesheet is now working via ngs-utils
  • Loading branch information
Gerbenvandervries authored Oct 1, 2018
2 parents 5d94fa6 + 849f0f3 commit 6759465
Showing 1 changed file with 54 additions and 5 deletions.
59 changes: 54 additions & 5 deletions checkSamplesheet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,58 @@ set -eu

SCRIPT_NAME="$(basename ${0})"
SCRIPT_NAME="${SCRIPT_NAME%.*sh}"
INSTALLATION_DIR="$(cd -P "$(dirname "${0}")/.." && pwd)/"
declare sampleSheetsDir="${INSTALLATION_DIR}"'Samplesheets/'

function showHelp() {
#
# Display commandline help on STDOUT.
#
cat <<EOH
======================================================================================================================
Script to check whether the samplesheet is good
Usage:
$(basename $0) OPTIONS
Options:
-h Show this help.
-s Scratch directory.
======================================================================================================================
EOH
trap - EXIT
exit 0
}


#
# Get commandline arguments.
#
log4Bash 'DEBUG' "${LINENO}" "${FUNCNAME:-main}" '0' "Parsing commandline arguments..."
declare group=''
while getopts "s:h" opt
do
case $opt in
h)
showHelp
;;
s)
SCR_DIR="${OPTARG}"
;;
\?)
log4Bash "${LINENO}" "${FUNCNAME:-main}" '1' "Invalid option -${OPTARG}. Try $(basename $0) -h for help."
;;
:)
log4Bash "${LINENO}" "${FUNCNAME:-main}" '1' "Option -${OPTARG} requires an argument. Try $(basename $0) -h for help."
;;
esac
done

#
# Check commandline options.
#
if [[ -z "${SCR_DIR:-}" ]]
then
log4Bash 'FATAL' "${LINENO}" "${FUNCNAME:-main}" '1' 'Must specify a SCR_DIR (e.g. /groups/umcg-gd/scr01/).'
fi

sampleSheetsDir="${SCR_DIR}/Samplesheets"
echo "INFO: Processing samplesheets from ${sampleSheetsDir}/new/..."

declare -a sampleSheets=($(find "${sampleSheetsDir}/new/" -name '*.csv'))
Expand Down Expand Up @@ -61,11 +110,11 @@ do
# Get email addresses for list of users that should always receive mail.
#
declare mailAddress=''
if [[ -e "${INSTALLATION_DIR}/logs/${SCRIPT_NAME}.mailinglist" ]]
if [[ -e "${SCR_DIR}/logs/${SCRIPT_NAME}.mailinglist" ]]
then
mailAddress="$(cat "${INSTALLATION_DIR}/logs/${SCRIPT_NAME}.mailinglist" | tr '\n' ' ')"
mailAddress="$(cat "${SCR_DIR}/logs/${SCRIPT_NAME}.mailinglist" | tr '\n' ' ')"
else
printf '%s\n' "ERROR: ${INSTALLATION_DIR}/logs/${SCRIPT_NAME}.mailinglist is missing on $(hostname -s)." \
printf '%s\n' "ERROR: ${SCR_DIR}/logs/${SCRIPT_NAME}.mailinglist is missing on $(hostname -s)." \
| mail -s "Samplesheet is wrong, but we cannot send email to the relevant users." '[email protected]'
fi
#
Expand Down

0 comments on commit 6759465

Please sign in to comment.