#!/bin/sh
#$ -cwd

## Wrapper script to submit UGE job array with varying number of task IDs.


## Feed sample/library list from stdin (=$1).
INLIST="$1"
if [ -z "$INLIST" ]; then
	echo "error: provide input sample list on command line"
	exit 1
fi

## Determine/feed task ID count:
TMAX=$(cat $INLIST | wc -l)

## Specify script to submit (=$2)
SCRIPT="$2"
if [ -z "$SCRIPT" ]; then
        echo "error: provide UGE job script on command line"
        exit 1
fi

qsub -t 1-"$TMAX" "$SCRIPT"

