1 | #!/bin/sh |
---|
2 | |
---|
3 | # |
---|
4 | # NOTE: |
---|
5 | # This is a wrapper for GNU's join under galaxy |
---|
6 | # not ment to be used from command line (if you're using the command line, simply run 'join' directly...) |
---|
7 | # |
---|
8 | # All parameters must be supplied. |
---|
9 | # the join_tool.xml file takes care of that. |
---|
10 | |
---|
11 | JOINTYPE="$1" |
---|
12 | OUTPUT_FORMAT="$2" |
---|
13 | EMPTY_STRING="$3" |
---|
14 | DELIMITER="$4" |
---|
15 | IGNORE_CASE="$5" |
---|
16 | |
---|
17 | INPUT1="$6" |
---|
18 | COLUMN1="$7" |
---|
19 | INPUT2="$8" |
---|
20 | COLUMN2="$9" |
---|
21 | OUTPUT="${10}" |
---|
22 | |
---|
23 | if [ "$OUTPUT" == "" ]; then |
---|
24 | echo "This script is part of galaxy. Don't run it manually.\n" >&2 |
---|
25 | exit 1; |
---|
26 | fi |
---|
27 | |
---|
28 | #This a TAB hack for galaxy (which can't transfer a "\t" as a parameter) |
---|
29 | [ "$DELIMITER" == "tab" ] && DELIMITER=" " |
---|
30 | |
---|
31 | #Remove spaces from the output format (if the user entered any) |
---|
32 | OUTPUT_FORMAT=${OUTPUT_FORMAT// /} |
---|
33 | [ "$OUTPUT_FORMAT" != "" ] && OUTPUT_FORMAT="-o $OUTPUT_FORMAT" |
---|
34 | |
---|
35 | echo join $OUTPUT_FORMAT -t "$DELIMITER" -e "$EMPTY_STRING" $IGNORE_CASE $JOINTYPE -1 "$COLUMN1" -2 "$COLUMN2" |
---|
36 | #echo join $OUTPUT_FORMAT -t "$DELIMITER" -e "$EMPTY_STRING" $IGNORE_CASE $JOINTYPE -1 "$COLUMN1" -2 "$COLUMN2" "$INPUT1" "$INPUT2" \> "$OUTPUT" |
---|
37 | join $OUTPUT_FORMAT -t "$DELIMITER" -e "$EMPTY_STRING" $JOINTYPE -1 "$COLUMN1" -2 "$COLUMN2" "$INPUT1" "$INPUT2" > "$OUTPUT" || exit 1 |
---|