forked from safisher/ngs
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathngs_POST.sh
executable file
·92 lines (76 loc) · 3.28 KB
/
ngs_POST.sh
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
#!/bin/bash
# Copyright (c) 2012-2014, Stephen Fisher and Junhyong Kim, University of
# Pennsylvania. All Rights Reserved.
#
# You may not use this file except in compliance with the Kim Lab License
# located at
#
# http://kim.bio.upenn.edu/software/LICENSE
#
# Unless required by applicable law or agreed to in writing, this
# software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, either express or implied. See the License
# for the specific language governing permissions and limitations
# under the License.
##########################################################################################
# SINGLE-END READS
# INPUT: $SAMPLE/trim/unaligned_1.fq
# OUTPUT: $SAMPLE/trim/unaligned_1.fq.gz
#
# PAIRED-END READS
# INPUT: $SAMPLE/trim/unaligned_1.fq and $SAMPLE/trim/unaligned_2.fq
# OUTPUT: $SAMPLE/trim/unaligned_1.fq.gz and $SAMPLE/trim/unaligned_2.fq.gz
##########################################################################################
##########################################################################################
# USAGE
##########################################################################################
NGS_USAGE+="Usage: `basename $0` post OPTIONS sampleID -- clean up RUM and trimmed data\n"
##########################################################################################
# HELP TEXT
##########################################################################################
ngsHelp_POST() {
echo -e "Usage:\n\t`basename $0` post [-i inputDir] sampleID"
echo -e "Input:\n\tsampleID/INPUTDIR/*.fq"
echo -e "Output:\n\tsampleID/INPUTDIR/*.fq.gz"
echo -e "OPTIONS:"
echo -e "\t-i - directory containing fastq files to be compressed with gzip (default: sampleID/trim).\n"
echo -e "Compresses all files that end with 'fq'. For example the unaligned_1.fq file in the trim directory will be compressed with gzip and renamed unaligned_1.fq.gz."
}
##########################################################################################
# LOCAL VARIABLES WITH DEFAULT VALUES. Using the naming convention to
# make sure these variables don't collide with the other modules.
##########################################################################################
ngsLocal_POST_INP_DIR="trim"
##########################################################################################
# PROCESSING COMMAND LINE ARGUMENTS
# POST args: sampleID
##########################################################################################
ngsArgs_POST() {
if [ $# -lt 1 ]; then printHelp "POST"; fi
# getopts doesn't allow for optional arguments so handle them manually
while true; do
case $1 in
-i) ngsLocal_POST_INP_DIR=$2
shift; shift;
;;
-*) printf "Illegal option: '%s'\n" "$1"
printHelp $COMMAND
exit 0
;;
*) break ;;
esac
done
SAMPLE=$1
}
##########################################################################################
# RUNNING COMMAND ACTION
# POST command. Compresses trimming data.
##########################################################################################
ngsCmd_POST() {
prnCmd "# BEGIN: POST PROCESSING"
prnCmd "gzip $SAMPLE/$ngsLocal_POST_INP_DIR/*fq"
if ! $DEBUG; then
gzip $SAMPLE/$ngsLocal_POST_INP_DIR/*fq
fi
prnCmd "# FINISHED: POST PROCESSING"
}