Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 39 lines (25 sloc) 719 Bytes
#!/bin/bash
# create a nice input data structure for the workflow
set -e
TOOLS_DIR=$1
INPUT_FILE=$(readlink -f $2)
TARGET_DIR=$3
TEMPLATE_NAME=$4
if ! which pigz >/dev/null 2>&1; then
echo "Required tool, pigz, is misisng from this host!" >&2
exit 1
fi
#BASE_NAME=`basename $INPUT_FILE | sed -E 's/^(forward_|reverse_)//' | sed -E 's/(_[12])*(.fastq)*(.gz)*$//g'`
echo "Outputting to $TARGET_DIR"
mkdir -p $TARGET_DIR
CMD="cat $INPUT_FILE"
# is it a gzip file?
if (file $INPUT_FILE | grep gzip) >/dev/null 2>&1; then
CMD="$CMD | pigz -d -"
fi
# split
CMD="$CMD | $TOOLS_DIR/task-files/prepare-inputs/fastq-split-pipe $TEMPLATE_NAME"
cd $TARGET_DIR
echo "Executing: $CMD"
eval "$CMD"
exit 0