From ba83b38c591ee5b12d64ba324a8bb09cac1b0536 Mon Sep 17 00:00:00 2001 From: Christopher Tomkins-Tinch Date: Fri, 27 Jul 2018 22:19:22 -0400 Subject: [PATCH] WIP --- pipes/WDL/workflows/tasks/tasks_demux.wdl | 31 +++++++++++++++++------ 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/pipes/WDL/workflows/tasks/tasks_demux.wdl b/pipes/WDL/workflows/tasks/tasks_demux.wdl index 8f791c82a..a295be258 100644 --- a/pipes/WDL/workflows/tasks/tasks_demux.wdl +++ b/pipes/WDL/workflows/tasks/tasks_demux.wdl @@ -68,16 +68,31 @@ task illumina_demux { ${flowcell_tgz} $FLOWCELL_DIR \ --loglevel=DEBUG - echo "FLOWCELL_DIR: $FLOWCELL_DIR" - ls "$FLOWCELL_DIR" - # full RunInfo.xml path RUNINFO_FILE="$(find $FLOWCELL_DIR -type f -maxdepth 3 -name RunInfo.xml | head -n 1)" - echo "RunInfo.xml: $RUNINFO_FILE" - cat "$RUNINFO_FILE" - cat "$RUNINFO_FILE" - cat "/opt/viral-ngs/source/docker/run_tile_count.sh" - total_tile_count=$("/opt/viral-ngs/source/docker/run_tile_count.sh $RUNINFO_FILE") + # Parse the lane count & run ID from RunInfo.xml file + lane_count=$(xmllint --xpath "string(//Run/FlowcellLayout/@LaneCount)" $RUNINFO_FILE) + if [ -z "$lane_count" ]; then + echo "Could not parse LaneCount from RunInfo.xml. Please check RunInfo.xml is properly formatted" + fi + + surface_count=$(xmllint --xpath "string(//Run/FlowcellLayout/@SurfaceCount)" $RUNINFO_FILE) + if [ -z "$surface_count" ]; then + echo "Could not parse SurfaceCount from RunInfo.xml. Please check RunInfo.xml is properly formatted" + fi + + swath_count=$(xmllint --xpath "string(//Run/FlowcellLayout/@SwathCount)" $RUNINFO_FILE) + if [ -z "$swath_count" ]; then + echo "Could not parse SwathCount from RunInfo.xml. Please check RunInfo.xml is properly formatted" + fi + + tile_count=$(xmllint --xpath "string(//Run/FlowcellLayout/@TileCount)" $RUNINFO_FILE) + if [ -z "$tile_count" ]; then + echo "Could not parse TileCount from RunInfo.xml. Please check RunInfo.xml is properly formatted" + fi + + # total data size more roughly tracks total tile count + total_tile_count=$((lane_count*surface_count*swath_count*tile_count)) if [ "$total_tile_count" -le 50 ]; then echo "Detected $total_tile_count tiles, interpreting as MiSeq run."