# HG changeset patch
# User devteam
# Date 1377009596 14400
# Node ID 6cbe88c680bb4ab3024565f0ad6755b4cc4c179d
Uploaded tool tarball.
diff -r 000000000000 -r 6cbe88c680bb fastx_barcode_splitter.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/fastx_barcode_splitter.xml Tue Aug 20 10:39:56 2013 -0400
@@ -0,0 +1,78 @@
+
+
+
+ fastx_toolkit
+
+ fastx_barcode_splitter_galaxy_wrapper.sh $BARCODE $input "$input.name" "$output.files_path" --mismatches $mismatches --partial $partial $EOL > $output
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+**What it does**
+
+This tool splits a Solexa library (FASTQ file) or a regular FASTA file into several files, using barcodes as the split criteria.
+
+--------
+
+**Barcode file Format**
+
+Barcode files are simple text files.
+Each line should contain an identifier (descriptive name for the barcode), and the barcode itself (A/C/G/T), separated by a TAB character.
+Example::
+
+ #This line is a comment (starts with a 'number' sign)
+ BC1 GATCT
+ BC2 ATCGT
+ BC3 GTGAT
+ BC4 TGTCT
+
+For each barcode, a new FASTQ file will be created (with the barcode's identifier as part of the file name).
+Sequences matching the barcode will be stored in the appropriate file.
+
+One additional FASTQ file will be created (the 'unmatched' file), where sequences not matching any barcode will be stored.
+
+The output of this tool is an HTML file, displaying the split counts and the file locations.
+
+**Output Example**
+
+.. image:: ${static_path}/fastx_icons/barcode_splitter_output_example.png
+
+
+------
+
+This tool is based on `FASTX-toolkit`__ by Assaf Gordon.
+
+ .. __: http://hannonlab.cshl.edu/fastx_toolkit/
+
+
+
+
diff -r 000000000000 -r 6cbe88c680bb fastx_barcode_splitter_galaxy_wrapper.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/fastx_barcode_splitter_galaxy_wrapper.sh Tue Aug 20 10:39:56 2013 -0400
@@ -0,0 +1,80 @@
+#!/bin/bash
+
+# FASTX-toolkit - FASTA/FASTQ preprocessing tools.
+# Copyright (C) 2009 A. Gordon (gordon@cshl.edu)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+
+#
+#This is a shell script wrapper for 'fastx_barcode_splitter.pl'
+#
+# 1. Output files are saved at the dataset's files_path directory.
+#
+# 2. 'fastx_barcode_splitter.pl' outputs a textual table.
+# This script turns it into pretty HTML with working URL
+# (so lazy users can just click on the URLs and get their files)
+
+BARCODE_FILE="$1"
+FASTQ_FILE="$2"
+LIBNAME="$3"
+OUTPUT_PATH="$4"
+shift 4
+# The rest of the parameters are passed to the split program
+
+if [ "$OUTPUT_PATH" == "" ]; then
+ echo "Usage: $0 [BARCODE FILE] [FASTQ FILE] [LIBRARY_NAME] [OUTPUT_PATH]" >&2
+ exit 1
+fi
+
+#Sanitize library name, make sure we can create a file with this name
+LIBNAME=${LIBNAME//\.gz/}
+LIBNAME=${LIBNAME//\.txt/}
+LIBNAME=${LIBNAME//[^[:alnum:]]/_}
+
+if [ ! -r "$FASTQ_FILE" ]; then
+ echo "Error: Input file ($FASTQ_FILE) not found!" >&2
+ exit 1
+fi
+if [ ! -r "$BARCODE_FILE" ]; then
+ echo "Error: barcode file ($BARCODE_FILE) not found!" >&2
+ exit 1
+fi
+mkdir -p "$OUTPUT_PATH"
+if [ ! -d "$OUTPUT_PATH" ]; then
+ echo "Error: failed to create output path '$OUTPUT_PATH'" >&2
+ exit 1
+fi
+
+PUBLICURL=""
+BASEPATH="$OUTPUT_PATH/"
+#PREFIX="$BASEPATH"`date "+%Y-%m-%d_%H%M__"`"${LIBNAME}__"
+PREFIX="$BASEPATH""${LIBNAME}__"
+SUFFIX=".txt"
+
+RESULTS=`zcat -f "$FASTQ_FILE" | 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
+echo "
"
+echo "$RESULTS" | sed -r "s|$BASEPATH(.*)|\\1|" | sed '
+i