-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtacseq
More file actions
executable file
·119 lines (110 loc) · 2.69 KB
/
Copy pathtacseq
File metadata and controls
executable file
·119 lines (110 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!/bin/bash
# set default values to arguments
MISMATCHES=5 # default mismatches
UMI=2 # default UMI threshold
# tacseq command usage function
tacseq_usage() {
echo "usage: $0 [options] <command>"
echo "TAC-seq data analysis"
echo ""
echo "options:"
echo " -h display this help and exit"
echo ""
echo "commands:"
echo " prep prepare samples (FASTQ files) for counting"
echo " count count reads and molecules per sample and target"
echo ""
}
# prep sub-command usage function
prep_usage() {
echo "usage: $0 $subcommand [options]"
echo "Prepare samples (FASTQ files) for counting."
echo ""
echo "mandatory:"
echo " -i input file: gzip compressed/uncompressed FASTQ file or '-' as standard input (stdin)"
echo " -t target file: target file format is based on FASTX Barcode Splitter barcode file format (http://hannonlab.cshl.edu/fastx_toolkit/commandline.html#fastx_barcode_splitter_usage)"
echo " -o output directory"
echo ""
echo "optional:"
echo " -h display this help and exit"
echo " -m mismatches: number of allowed mismatches per target sequence (default: 5)"
echo ""
}
# count sub-command usage function
count_usage() {
echo "usage: $0 $subcommand [options]"
echo "Count reads and molecules per sample and target."
echo ""
echo "mandatory:"
echo " -i input directory: 'tacseq prep' output directory"
echo ""
echo "optional:"
echo " -h display this help and exit"
echo " -u UMI threshold (default: 2)"
echo ""
}
# parse options to sub-commands
subcommand="$1"
OPTIND=2
case "$subcommand" in
# parse options to 'prep' sub-command
prep )
while getopts ":i:t:o:m:" opt; do
case ${opt} in
i )
INPUT=$OPTARG
;;
t )
TARGET=$OPTARG
;;
o )
OUTPUT=$OPTARG
;;
m ) # optional
MISMATCHES=$OPTARG
;;
* )
prep_usage 1>&2
exit 1
;;
esac
done
shift $((OPTIND-1))
# check for mandatory options
if [ ! "$INPUT" ] || [ ! "$TARGET" ] || [ ! "$OUTPUT" ]; then
prep_usage 1>&2
exit 1
fi
# run 'prep' sub-command
source prep.sh "$INPUT" "$TARGET" "$OUTPUT" $MISMATCHES
;;
# parse options to 'count' sub-command
count )
while getopts ":i:u:" opt; do
case ${opt} in
i )
INPUT=$OPTARG
;;
u ) # optional
UMI=$OPTARG
;;
* )
count_usage 1>&2
exit 1
;;
esac
done
shift $((OPTIND-1))
# check for mandatory options
if [ ! "$INPUT" ]; then
count_usage 1>&2
exit 1
fi
# run 'count' sub-command
source count.sh "$INPUT" $UMI
;;
* )
tacseq_usage 1>&2
exit 1
;;
esac