diff weeder2_wrapper.sh @ 4:89315bdc1a8c draft default tip

Uploaded tool version 2.0.3.
author pjbriggs
date Wed, 26 Sep 2018 10:12:56 -0400
parents 3c5f10f7dd40
children
line wrap: on
line diff
--- a/weeder2_wrapper.sh	Mon Mar 05 10:19:50 2018 -0500
+++ b/weeder2_wrapper.sh	Wed Sep 26 10:12:56 2018 -0400
@@ -25,8 +25,9 @@
 #
 # Locate the FreqFiles directory
 if [ $FREQFILES_DIR == "." ] ; then
-    # Use the files in the Weeder2 distribution
-    freqfiles_dir=$WEEDER_FREQFILES_DIR
+    # Don't explicitly set the location - Weeder2 from
+    # bioconda handles this automatically
+    freqfiles_dir=
 else
     # Alternative location
     freqfiles_dir=$FREQFILES_DIR
@@ -34,18 +35,22 @@
 #
 # Link to the FreqFiles directory as weeder2 executable
 # expects it to be the same directory
-if [ -d $freqfiles_dir ] ; then
-    echo "Linking to FreqFiles directory: $freqfiles_dir"
-    ln -s $freqfiles_dir FreqFiles
+if [ ! -z "$freqfiles_dir" ] ; then
+    if [ -d $freqfiles_dir ] ; then
+	echo "Linking to FreqFiles directory: $freqfiles_dir"
+	ln -s $freqfiles_dir FreqFiles
+    else
+	echo "ERROR FreqFiles directory not found" >&2
+	exit 1
+    fi
 else
-    echo "ERROR FreqFiles directory not found" >&2
-    exit 1
+    echo "WARNING FreqFiles directory not set" >&2
 fi
 #
 # Construct names of input and output files
-fasta=`basename $FASTA_IN`
-motifs_out=$fasta.w2
-matrix_out=$fasta.matrix.w2
+fasta=$(basename $FASTA_IN)
+motifs_out=${fasta}.w2
+matrix_out=${fasta}.matrix.w2
 #
 # Construct and run weeder command
 # NB weeder logs output to stderr so redirect to stdout
@@ -63,9 +68,16 @@
 # Move outputs to final destinations
 if [ -e $motifs_out ] ; then
     /bin/mv $motifs_out $MOTIFS_OUT
+else
+    echo ERROR missing output file: $motifs_out >&2
+    status=1
 fi
 if [ -e $matrix_out ] ; then
     /bin/mv $matrix_out $MATRIX_OUT
+else
+    echo ERROR missing output file: $matrix_out >&2
+    status=1
 fi
 #
 # Done
+exit $status