diff fastx_barcode_splitter_galaxy_wrapper.sh @ 2:32304398ef67 draft

planemo upload for repository https://github.com/lparsons/galaxy_tools/tree/master/tools/fastx_barcode_splitter_enhanced commit c3b0be52079831f6ae58ff64e42d8ff54ce501e4
author lparsons
date Fri, 13 Nov 2015 12:43:14 -0500
parents b7b3d008e2d3
children 0fb7e9130a70
line wrap: on
line diff
--- a/fastx_barcode_splitter_galaxy_wrapper.sh	Tue Oct 27 11:47:52 2015 -0400
+++ b/fastx_barcode_splitter_galaxy_wrapper.sh	Fri Nov 13 12:43:14 2015 -0500
@@ -19,7 +19,8 @@
 #  Modified by Lance Parsons (lparsons@princeton.edu)
 #	2011-03-15	Adapted to allow galaxy to determine filetype
 #	2015-10-21	Updated to make compatible with OSX (BSD sed)
-#
+#   2015-11-13  Removed LIBRARY_NAME, no longer needed
+
 #This is a shell script wrapper for 'fastx_barcode_splitter.pl'
 #
 # 1. Output files are saved at the dataset's files_path directory.
@@ -29,28 +30,22 @@
 #    (so lazy users can just click on the URLs and get their files)
 
 if [ "$1x" = "x" ]; then
-	echo "Usage: $0 [BARCODE FILE] [FASTQ FILE] [LIBRARY_NAME] [OUTPUT_PATH] [FILETYPE]" >&2
+	echo "Usage: $0 [BARCODE FILE] [FASTQ FILE] [OUTPUT_PATH] [FILETYPE]" >&2
 	exit 1
 fi
 
 BARCODE_FILE="$1"
 FASTQ_FILE="$2"
-LIBNAME="$3"
-OUTPUT_PATH="$4"
-FILETYPE="$5"
-shift 5
+OUTPUT_PATH="$3"
+FILETYPE="$4"
+shift 4
 # The rest of the parameters are passed to the split program
 
 if [ "${OUTPUT_PATH}x" = "x" ]; then
-	echo "Usage: $0 [BARCODE FILE] [FASTQ FILE] [LIBRARY_NAME] [OUTPUT_PATH] [FILETYPE]" >&2
+	echo "Usage: $0 [BARCODE FILE] [FASTQ FILE] [OUTPUT_PATH] [FILETYPE]" >&2
 	exit 1
 fi
 
-#Sanitize library name, make sure we can create a file with this name
-LIBNAME=${LIBNAME%.gz}
-LIBNAME=${LIBNAME%.txt}
-LIBNAME=$(echo "$LIBNAME" | tr -cd '[:alnum:]_')
-
 if [ ! -r "$FASTQ_FILE" ]; then
 	echo "Error: Input file ($FASTQ_FILE) not found!" >&2
 	exit 1
@@ -65,24 +60,20 @@
 	exit 1
 fi
 
-PUBLICURL=""
 BASEPATH="$OUTPUT_PATH/"
-#PREFIX="$BASEPATH"`date "+%Y-%m-%d_%H%M__"`"${LIBNAME}__"
-PREFIX="$BASEPATH""${LIBNAME}_"
-SUFFIX="_visible.$FILETYPE"
-DIRECTORY=$(cd `dirname $0` && pwd)
+PREFIX="$BASEPATH"
+SUFFIX=".$FILETYPE"
+DIRECTORY="$(cd "$(dirname "$0")" && pwd)"
 
-RESULTS=`gzip -cdf "$FASTQ_FILE" | $DIRECTORY/fastx_barcode_splitter.pl --bcfile "$BARCODE_FILE" --prefix "$PREFIX" --suffix "$SUFFIX" "$@"`
+RESULTS=$(gzip -cdf "$FASTQ_FILE" | "$DIRECTORY/fastx_barcode_splitter.pl" --bcfile "$BARCODE_FILE" --prefix "$PREFIX" --suffix "$SUFFIX" "$@")
 if [ $? != 0 ]; then
 	echo "error"
 fi
 
 #
-# Convert the textual tab-separated table into simple HTML table,
-# with the local path replaces with a valid URL
-#HTMLSUMMARY=${PREFIX}stats_visible_html
+# Convert the textual tab-separated table into simple HTML table
 echo "<html><body><table border=1>"
-echo "$RESULTS" | sed "s|$BASEPATH\\(.*\\)|<a href=\"\\1\">\\1</a>|" | \
+echo "$RESULTS" | sed "s|$BASEPATH\\(.*\\)|\\1|" | \
 perl -n -e '$_ =~ s|\t|</td><td>|g; print "<tr><td>\n$_</td></tr>\n"'
 echo "<p>"
 echo "</table></body></html>"