Skip to content

Commit

Permalink
Bug fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
pneerincx committed Sep 21, 2018
1 parent a118316 commit 1dc7cd2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion checkSamplesheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
if columnName not in row.keys():
sanityCheckOk=False
if not alreadyErrored:
listOfErrors.extend('ERROR: Required column is missing (or has a trailing space): ' + columnName)
listOfErrors.append('ERROR: Required column is missing (or has a trailing space): ' + columnName + '.')
alreadyErrored=True
else:
if row[columnName] == "":
Expand Down
24 changes: 16 additions & 8 deletions checkSamplesheet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,23 @@

set -eu

declare baseDir='/groups/umcg-gd/scr01/'
declare sampleSheetsDir="${baseDir}"'Samplesheets/'

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

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

echo "INFO: processing samplesheets from ${sampleSheetsDir}/new/..."
declare -a sampleSheets=($(find "${sampleSheetsDir}/new/" -name '*.csv'))
if [[ "${#sampleSheets[@]:-0}" -eq '0' ]]
then
echo "WARN: No samplesheets found in ${sampleSheetsDir}/new/."
exit 0
else
echo "DEBUG: samplesheets found: ${sampleSheets[@]}."
fi

for sampleSheet in $(ls -1 "${sampleSheetsDir}/new/"*'.csv')
for sampleSheet in "${sampleSheets[@]}"
do
#
# Create a copy of the original, so we preserve the original owner
Expand Down Expand Up @@ -53,11 +61,11 @@ do
# Get email addresses for list of users that should always receive mail.
#
declare mailAddress=''
if [[ -e "${baseDir}/logs/${SCRIPT_NAME}.mailinglist" ]]
if [[ -e "${INSTALLATION_DIR}/logs/${SCRIPT_NAME}.mailinglist" ]]
then
mailAddress="$(cat "${baseDir}/logs/${SCRIPT_NAME}.mailinglist" | tr '\n' ' ')"
mailAddress="$(cat "${INSTALLATION_DIR}/logs/${SCRIPT_NAME}.mailinglist" | tr '\n' ' ')"
else
printf '%s\n' "ERROR: ${baseDir}/logs/${SCRIPT_NAME}.mailinglist is missing on $(hostname -s)." \
printf '%s\n' "ERROR: ${INSTALLATION_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 1dc7cd2

Please sign in to comment.