Codebase list fastx-toolkit / 2aba8a3
Barcode-Splitter: uses Galaxy's output.files_path to store multiple output files. No need for a web public folder and URL tweaking anymore. A. Gordon 14 years ago
5 changed file(s) with 82 addition(s) and 80 deletion(s). Raw diff Collapse all Expand all
1515 fastx_clipper.xml \
1616 fastx_reverse_complement.xml \
1717 fastx_trimmer.xml \
18 fastx_barcode_splitter.xml \
18 fastx_barcode_splitter.xml fastx_barcode_splitter_galaxy_wrapper.sh \
1919 fastx_nucleotides_distribution.xml \
2020 fastq_quality_boxplot.xml \
2121 fasta_clipping_histogram.xml \
00 <tool id="cshl_fastx_barcode_splitter" name="Barcode Splitter">
11 <description></description>
2 <command>fastx_barcode_splitter_galaxy_wrapper.sh $BARCODE $input "$input.name" --mismatches $mismatches --partial $partial $EOL > $output </command>
2 <command interpreter="sh">fastx_barcode_splitter_galaxy_wrapper.sh $BARCODE $input "$input.name" "$output.files_path" --mismatches $mismatches --partial $partial $EOL > $output </command>
33
44 <inputs>
55 <param format="txt" name="BARCODE" type="data" label="Barcodes to use" />
0 #!/bin/sh
1
2 # FASTX-toolkit - FASTA/FASTQ preprocessing tools.
3 # Copyright (C) 2009 A. Gordon (gordon@cshl.edu)
4 #
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Affero General Public License as
7 # published by the Free Software Foundation, either version 3 of the
8 # License, or (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU Affero General Public License for more details.
14 #
15 # You should have received a copy of the GNU Affero General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 #
19 #This is a shell script wrapper for 'fastx_barcode_splitter.pl'
20 #
21 # 1. Output files are saved at the dataset's files_path directory.
22 #
23 # 2. 'fastx_barcode_splitter.pl' outputs a textual table.
24 # This script turns it into pretty HTML with working URL
25 # (so lazy users can just click on the URLs and get their files)
26
27 BARCODE_FILE="$1"
28 FASTQ_FILE="$2"
29 LIBNAME="$3"
30 OUTPUT_PATH="$4"
31 shift 4
32 # The rest of the parameters are passed to the split program
33
34 if [ "$OUTPUT_PATH" == "" ]; then
35 echo "Usage: $0 [BARCODE FILE] [FASTQ FILE] [LIBRARY_NAME] [OUTPUT_PATH]" >&2
36 exit 1
37 fi
38
39 #Sanitize library name, make sure we can create a file with this name
40 LIBNAME=${LIBNAME//\.gz/}
41 LIBNAME=${LIBNAME//\.txt/}
42 LIBNAME=${LIBNAME//[^[:alnum:]]/_}
43
44 if [ ! -r "$FASTQ_FILE" ]; then
45 echo "Error: Input file ($FASTQ_FILE) not found!" >&2
46 exit 1
47 fi
48 if [ ! -r "$BARCODE_FILE" ]; then
49 echo "Error: barcode file ($BARCODE_FILE) not found!" >&2
50 exit 1
51 fi
52 mkdir -p "$OUTPUT_PATH"
53 if [ ! -d "$OUTPUT_PATH" ]; then
54 echo "Error: failed to create output path '$OUTPUT_PATH'" >&2
55 exit 1
56 fi
57
58 PUBLICURL=""
59 BASEPATH="$OUTPUT_PATH/"
60 #PREFIX="$BASEPATH"`date "+%Y-%m-%d_%H%M__"`"${LIBNAME}__"
61 PREFIX="$BASEPATH""${LIBNAME}__"
62 SUFFIX=".txt"
63
64 RESULTS=`zcat -f "$FASTQ_FILE" | fastx_barcode_splitter.pl --bcfile "$BARCODE_FILE" --prefix "$PREFIX" --suffix "$SUFFIX" "$@"`
65 if [ $? != 0 ]; then
66 echo "error"
67 fi
68
69 #
70 # Convert the textual tab-separated table into simple HTML table,
71 # with the local path replaces with a valid URL
72 echo "<html><body><table border=1>"
73 echo "$RESULTS" | sed -r "s|$BASEPATH(.*)|<a href=\"\\1\">\\1</a>|" | sed '
74 i<tr><td>
75 s|\t|</td><td>|g
76 a<\/td><\/tr>
77 '
78 echo "<p>"
79 echo "</table></body></html>"
88 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
99
1010 bin_SCRIPTS = fastx_barcode_splitter.pl \
11 fastx_barcode_splitter_galaxy_wrapper.sh \
1211 fastx_nucleotide_distribution_graph.sh \
1312 fastq_quality_boxplot_graph.sh \
1413 fasta_clipping_histogram.pl
1514
1615 EXTRA_DIST = fastx_barcode_splitter.pl \
17 fastx_barcode_splitter_galaxy_wrapper.sh \
1816 fastx_nucleotide_distribution_graph.sh \
1917 fastq_quality_boxplot_graph.sh \
2018 fasta_clipping_histogram.pl
+0
-76
scripts/fastx_barcode_splitter_galaxy_wrapper.sh less more
0 #!/bin/sh
1
2 # FASTX-toolkit - FASTA/FASTQ preprocessing tools.
3 # Copyright (C) 2009 A. Gordon (gordon@cshl.edu)
4 #
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Affero General Public License as
7 # published by the Free Software Foundation, either version 3 of the
8 # License, or (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU Affero General Public License for more details.
14 #
15 # You should have received a copy of the GNU Affero General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 #
19 #This is a shell script wrapper for 'fastx_barcode_splitter.pl'
20 #
21 # 1. Output files are saved at a predefined location
22 # (Which was made publicly accessible using apache)
23 #
24 # 2. 'fastx_barcode_splitter.pl' outputs a textual table.
25 # This script turns it into pretty HTML with working URL
26 # (so lazy users can just click on the URLs and get thier files)
27
28 BASEPATH="/media/sdb1/galaxy/barcode_splits/"
29 PUBLICURL="http://tango.cshl.edu/barcode_splits/"
30
31 BARCODE_FILE="$1"
32 FASTQ_FILE="$2"
33 LIBNAME="$3"
34 shift 3
35 # The rest of the parameters are passed to the split program
36
37 if [ "$LIBNAME" == "" ]; then
38 echo "Usage: $0 [BARCODE FILE] [FASTQ FILE] [LIBRARY_NAME]" >&2
39 exit 1
40 fi
41
42 #Sanitize library name, make sure we can create a file with this name
43 LIBNAME=${LIBNAME//\.gz/}
44 LIBNAME=${LIBNAME//\.txt/}
45 LIBNAME=${LIBNAME//[^[:alnum:]]/_}
46
47 if [ ! -r "$FASTQ_FILE" ]; then
48 echo "Error: Input file ($FASTQ_FILE) not found!" >&2
49 exit 1
50 fi
51 if [ ! -r "$BARCODE_FILE" ]; then
52 echo "Error: barcode file ($BARCODE_FILE) not found!" >&2
53 exit 1
54 fi
55
56 PREFIX="$BASEPATH"`date "+%Y-%m-%d_%H%M__"`"${LIBNAME}__"
57 SUFFIX=".txt"
58
59 RESULTS=`zcat -f "$FASTQ_FILE" | fastx_barcode_splitter.pl --bcfile "$BARCODE_FILE" --prefix "$PREFIX" --suffix "$SUFFIX" "$@"`
60 if [ $? != 0 ]; then
61 echo "error"
62 fi
63
64 #
65 # Convert the textual tab-separated table into simple HTML table,
66 # with the local path replaces with a valid URL
67 echo "<html><body><table border=1>"
68 echo "$RESULTS" | sed "s|$BASEPATH|$PUBLICURL|" | sed '
69 i<tr><td>
70 s|\t|</td><td>|g
71 s|http.*|<a href="&">&<\/a>|
72 a<\/td><\/tr>
73 '
74 echo "<p><b>Copy these files to your local computer, as they will be soon deleted.</b>"
75 echo "</table></body></html>"