forked from zibraproject/zika-pipeline
-
Notifications
You must be signed in to change notification settings - Fork 67
/
test-runner.sh
executable file
·137 lines (120 loc) · 3.76 KB
/
test-runner.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
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#!/usr/bin/env bash
set -e
#
# test-runner.sh runs a the entire ARTIC field bioinformatics pipeline using a small set
# of data (the Mayinga barcode from an Ebola amplicon library sequenced on a flongle).
#
# full data available: http://artic.s3.climb.ac.uk/run-folders/EBOV_Amplicons_flongle.tar.gz
#
# usage:
# ./test-runner.sh [medaka|clair3]
#
# specify either medaka or nanopolish to run the respective workflow of the pipeline
#
###########################################################################################
# Setup the data, commands and the testing function.
# data
inputData="./20190830_1509_MN22126_AAQ411_9efc5448_barcoded"
primerSchemes="../test-data/primer-schemes"
primerScheme="IturiEBOV/V1"
prefix="ebov-mayinga"
bed="../test-data/primer-schemes/IturiEBOV/V1/IturiEBOV.scheme.bed"
ref="../test-data/primer-schemes/IturiEBOV/V1/IturiEBOV.reference.fasta"
barcode="03"
threads=2
downloadCmd="wget https://loman-labz-public-datasets.s3.climb.ac.uk/EBOV_Amplicons_flongle_barcoded.tar.gz"
extractCmd="tar -vxzf EBOV_Amplicons_flongle_barcoded.tar.gz"
guppyplexCmd="artic guppyplex \
--min-length 400 \
--max-length 800 \
--prefix ${prefix} \
--directory ./${inputData}/pass/barcode${barcode} \
--output ${prefix}_guppyplex_fastq_pass-NB${barcode}.fastq"
## medaka workflow specific
# minionCmd_m="artic minion \
# --normalise 200 \
# --threads ${threads} \
# --read-file ${prefix}_guppyplex_fastq_pass-NB${barcode}.fastq \
# --model r941_e81_hac_g514 \
# --bed ${bed} \
# --ref ${ref} \
# ${prefix}"
# clair3 workflow specific
minionCmd_c="artic minion \
--normalise 200 \
--threads ${threads} \
--read-file ${prefix}_guppyplex_fastq_pass-NB${barcode}.fastq \
--model r941_prom_hac_g360+g422 \
--bed ${bed} \
--ref ${ref} \
${prefix}"
# colours
NC='\033[0m'
RED='\033[0;31m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
# cmdTester is function to run a command and check for failure
function cmdTester {
echo "###########################################################################################"
echo -e "${BLUE}Running:${NC} $*"
echo
"$@"
echo
local status=$?
if [ $status -ne 0 ]
then
echo -e "${RED}FAIL${NC}" >&2
exit $status
else
echo -e "${GREEN}PASS${NC}" >&2
fi
echo
return
}
###########################################################################################
# Run the tests.
# check that clair3 or medaka is specified
# if [ "$1" == "clair3" ] || [ "$1" == "medaka" ]; then
# echo -e "${BLUE}Starting tests...${NC}"
# echo -e "${BLUE} - using the $1 workflow${NC}"
# echo
# else
# echo "please specify medaka or clair3"
# echo "./test-runner.sh [medaka|clair3]"
# exit 1
# fi
# setup a tmp directory to work in
mkdir tmp || true
cd tmp || exit
# download the data
echo "downloading the test data..."
cmdTester $downloadCmd
cmdTester $extractCmd
# run the correct workflow
echo "running the pipeline..."
# if [ "$1" == "medaka" ]
# then
# # collect the reads
# cmdTester $guppyplexCmd
# # run the core pipeline with medaka
# cmdTester $minionCmd_m
# else
# guppyplex the reads
cmdTester $guppyplexCmd
# run the core pipeline with clair3
cmdTester $minionCmd_c
# fi
###########################################################################################
# Check the output and clean up.
# check output created
echo -e "${BLUE}Checking output...${NC}"
if test -f "${prefix}.consensus.fasta"
then
echo -e "${GREEN} - consensus found${NC}"
else
echo -e "${RED} - no consensus found${NC}"
exit 1
fi
# cleanup
cd .. && rm -r tmp
echo -e "${BLUE}Done.${NC}"