extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/grid/scripts/get_run_parameters.sh

Code
Comments
Other
Rev Date Author Line
6663 01 Apr 22 nicklas 1 #!/bin/bash
6663 01 Apr 22 nicklas 2 ##
6663 01 Apr 22 nicklas 3 ## Pipeline script for checking find the runParameters.xml file for a sequencing
6663 01 Apr 22 nicklas 4 ## run. 
6663 01 Apr 22 nicklas 5 ## 
6663 01 Apr 22 nicklas 6 ## Environment variables that should be defined before calling this script
6663 01 Apr 22 nicklas 7 ##  -AllRunArchives: White-space separated list of locations to search for sequencing data
6663 01 Apr 22 nicklas 8 ##  -BARCODE: Barcode of the flow cell that we want to find information for
6663 01 Apr 22 nicklas 9 ##
6663 01 Apr 22 nicklas 10 ## The output is the full name of the folder, a date and the contents of the XML file.
6663 01 Apr 22 nicklas 11
6663 01 Apr 22 nicklas 12 # Try to find a folder inside run-archive that has the barcode in the name
6663 01 Apr 22 nicklas 13 # The folder may not yet exist so a missing folder is not an error
6663 01 Apr 22 nicklas 14 DATA_FOLDER=`find ${AllRunArchives} -maxdepth 2 -iname "*${BARCODE}*" -type d -print 2> /dev/null || true`
6663 01 Apr 22 nicklas 15
6663 01 Apr 22 nicklas 16 # Fail if more than one folder is found
6663 01 Apr 22 nicklas 17 readarray -t lines <<<"${DATA_FOLDER}"
6663 01 Apr 22 nicklas 18 if [ ! "${#lines[@]}" -eq 1 ]; then
6663 01 Apr 22 nicklas 19   echo "Found ${#lines[@]} data folders for flow cell ${BARCODE} in [${AllRunArchives}]" 1>&2
6663 01 Apr 22 nicklas 20   echo ${DATA_FOLDER} 1>&2
6663 01 Apr 22 nicklas 21   exit 1
6663 01 Apr 22 nicklas 22 fi
6663 01 Apr 22 nicklas 23
6663 01 Apr 22 nicklas 24 if [ -z "${DATA_FOLDER}" ]; then
6665 05 Apr 22 nicklas 25    echo "Can't find data folder for flow cell ${BARCODE} in [${AllRunArchives}]" 1>&2
6663 01 Apr 22 nicklas 26    exit 1
6663 01 Apr 22 nicklas 27 fi
6663 01 Apr 22 nicklas 28 if [ -f "${DATA_FOLDER}/RunParameters.xml" ]; then
6663 01 Apr 22 nicklas 29      RUN_PARAMETERS=RunParameters.xml
6663 01 Apr 22 nicklas 30 elif [ -f "${DATA_FOLDER}/runParameters.xml" ]; then
6663 01 Apr 22 nicklas 31      RUN_PARAMETERS=runParameters.xml
6663 01 Apr 22 nicklas 32 else
6663 01 Apr 22 nicklas 33    echo "Can't find RunParameters.xml or runParameters.xml in folder ${DATA_FOLDER}" 1>&2
6663 01 Apr 22 nicklas 34    exit 1
6663 01 Apr 22 nicklas 35 fi
6663 01 Apr 22 nicklas 36 if [ -f "${DATA_FOLDER}/RunCompletionStatus.xml" ]; then
6663 01 Apr 22 nicklas 37      RUN_COMPLETE=RunCompletionStatus.xml
6663 01 Apr 22 nicklas 38 elif [ -f "${DATA_FOLDER}/RTAComplete.txt" ]; then
6663 01 Apr 22 nicklas 39      RUN_COMPLETE=RTAComplete.txt
6663 01 Apr 22 nicklas 40 fi
6663 01 Apr 22 nicklas 41 echo "${DATA_FOLDER}"
6663 01 Apr 22 nicklas 42 if [ -f "${DATA_FOLDER}/${RUN_COMPLETE}" ]; then
6663 01 Apr 22 nicklas 43    date +'%Y%m%d %H%M' -r "${DATA_FOLDER}/${RUN_COMPLETE}"
6663 01 Apr 22 nicklas 44 else
6663 01 Apr 22 nicklas 45    echo 
6663 01 Apr 22 nicklas 46 fi
6663 01 Apr 22 nicklas 47 cat "${DATA_FOLDER}/${RUN_PARAMETERS}"