root/galaxy-central/tools/unix_tools/awk_wrapper.sh

リビジョン 3, 0.8 KB (コミッタ: kohda, 14 年 前)

Install Unix tools  http://hannonlab.cshl.edu/galaxy_unix_tools/galaxy.html

行番号 
1#!/bin/sh
2
3##
4## Galaxy wrapper for AWK command
5##
6
7##
8## command line arguments:
9##   input_file
10##   output_file
11##   awk-program
12##   input-field-separator
13##   output-field-separator
14
15INPUT="$1"
16OUTPUT="$2"
17PROG="$3"
18FS="$4"
19OFS="$5"
20
21shift 5
22
23if [ -z "$OFS" ]; then
24        echo usage: $0 INPUTFILE OUTPUTFILE AWK-PROGRAM FS OFS>&2
25        exit 1
26fi
27
28if [ ! -r "$INPUT" ]; then
29        echo "error: input file ($INPUT) not found!" >&2
30        exit 1
31fi
32
33if [ "$FS" == "tab" ]; then
34        FS="\t"
35fi
36if [ "$OFS" == "tab" ]; then
37        OFS="\t"
38fi
39
40# Messages printed to STDOUT will be displayed in the "INFO" field in the galaxy dataset.
41# This way the user can tell what was the command
42echo "awk" "$PROG"
43
44awk --sandbox -v OFS="$OFS" -v FS="$FS" --re-interval "$PROG" "$INPUT" > "$OUTPUT"
45if (( $? ));  then exit; fi
46
47exit 0
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。