comparison fastx_barcode_splitter_galaxy_wrapper.sh @ 1:b7b3d008e2d3 draft

planemo upload for repository https://github.com/lparsons/galaxy_tools/tree/master/tools/fastx_barcode_splitter_enhanced commit e6a486662201362134119c0ddc7151b8dd181ebd
author lparsons
date Tue, 27 Oct 2015 11:47:52 -0400
parents 84bbf4fd24c3
children 32304398ef67
comparison
equal deleted inserted replaced
0:84bbf4fd24c3 1:b7b3d008e2d3
16 # You should have received a copy of the GNU Affero General Public License 16 # You should have received a copy of the GNU Affero General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. 17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 18
19 # Modified by Lance Parsons (lparsons@princeton.edu) 19 # Modified by Lance Parsons (lparsons@princeton.edu)
20 # 2011-03-15 Adapted to allow galaxy to determine filetype 20 # 2011-03-15 Adapted to allow galaxy to determine filetype
21 # 2015-10-21 Updated to make compatible with OSX (BSD sed)
21 # 22 #
22 #This is a shell script wrapper for 'fastx_barcode_splitter.pl' 23 #This is a shell script wrapper for 'fastx_barcode_splitter.pl'
23 # 24 #
24 # 1. Output files are saved at the dataset's files_path directory. 25 # 1. Output files are saved at the dataset's files_path directory.
25 # 26 #
26 # 2. 'fastx_barcode_splitter.pl' outputs a textual table. 27 # 2. 'fastx_barcode_splitter.pl' outputs a textual table.
27 # This script turns it into pretty HTML with working URL 28 # This script turns it into pretty HTML with working URL
28 # (so lazy users can just click on the URLs and get their files) 29 # (so lazy users can just click on the URLs and get their files)
29 30
30 if [ "$1x" = "x" ]; then 31 if [ "$1x" = "x" ]; then
66 67
67 PUBLICURL="" 68 PUBLICURL=""
68 BASEPATH="$OUTPUT_PATH/" 69 BASEPATH="$OUTPUT_PATH/"
69 #PREFIX="$BASEPATH"`date "+%Y-%m-%d_%H%M__"`"${LIBNAME}__" 70 #PREFIX="$BASEPATH"`date "+%Y-%m-%d_%H%M__"`"${LIBNAME}__"
70 PREFIX="$BASEPATH""${LIBNAME}_" 71 PREFIX="$BASEPATH""${LIBNAME}_"
71 SUFFIX="_visible_$FILETYPE" 72 SUFFIX="_visible.$FILETYPE"
72 DIRECTORY=$(cd `dirname $0` && pwd) 73 DIRECTORY=$(cd `dirname $0` && pwd)
73 74
74 RESULTS=`gzip -cdf "$FASTQ_FILE" | $DIRECTORY/fastx_barcode_splitter.pl --bcfile "$BARCODE_FILE" --prefix "$PREFIX" --suffix "$SUFFIX" "$@"` 75 RESULTS=`gzip -cdf "$FASTQ_FILE" | $DIRECTORY/fastx_barcode_splitter.pl --bcfile "$BARCODE_FILE" --prefix "$PREFIX" --suffix "$SUFFIX" "$@"`
75 if [ $? != 0 ]; then 76 if [ $? != 0 ]; then
76 echo "error" 77 echo "error"
78 79
79 # 80 #
80 # Convert the textual tab-separated table into simple HTML table, 81 # Convert the textual tab-separated table into simple HTML table,
81 # with the local path replaces with a valid URL 82 # with the local path replaces with a valid URL
82 #HTMLSUMMARY=${PREFIX}stats_visible_html 83 #HTMLSUMMARY=${PREFIX}stats_visible_html
83 echo "<html><body><table border=1>" 84 echo "<html><body><table border=1>"
84 echo "$RESULTS" | sed -r "s|$BASEPATH(.*)|\\1|" | sed ' 85 echo "$RESULTS" | sed "s|$BASEPATH\\(.*\\)|<a href=\"\\1\">\\1</a>|" | \
85 i<tr><td> 86 perl -n -e '$_ =~ s|\t|</td><td>|g; print "<tr><td>\n$_</td></tr>\n"'
86 s|\t|</td><td>|g
87 a<\/td><\/tr>
88 '
89 echo "<p>" 87 echo "<p>"
90 echo "</table></body></html>" 88 echo "</table></body></html>"