-
Notifications
You must be signed in to change notification settings - Fork 14
/
run_pandora.sh
executable file
·85 lines (77 loc) · 4.22 KB
/
run_pandora.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
#!/usr/bin/env bash
set -eu
########################################################################################################################
# configs
pandora_version="0.12.0-alpha.0"
pandora_URL="https://github.com/rmcolq/pandora/releases/download/${pandora_version}/pandora-linux-precompiled-v${pandora_version}"
make_prg_version="0.5.0"
make_prg_URL="https://github.com/iqbal-lab-org/make_prg/releases/download/${make_prg_version}/make_prg_${make_prg_version}"
########################################################################################################################
########################################################################################################################
# argument parsing
if [[ "$#" -gt 1 || ( "$#" -eq 1 && "$1" != "conda" ) ]] ; then
echo "Illegal parameters."
echo "Usage: $0 or $0 conda"
exit 1
fi
########################################################################################################################
########################################################################################################################
# setup tools
function download_tool {
URL=$1
executable=$2
wget "${URL}" -O "${executable}"
chmod +x "${executable}"
}
if [ "$#" -eq 0 ] ; then
# not conda env
pandora_executable="./pandora-linux-precompiled-v${pandora_version}"
if [ ! -f ${pandora_executable} ]; then
echo "pandora executable not found, downloading it..."
download_tool "${pandora_URL}" "${pandora_executable}"
fi
make_prg_executable="./make_prg-v${make_prg_version}"
if [ ! -f ${make_prg_executable} ]; then
echo "make_prg executable not found, downloading it..."
download_tool "${make_prg_URL}" "${make_prg_executable}"
fi
else
# conda env
pandora_executable="pandora"
make_prg_executable="make_prg"
fi
########################################################################################################################
########################################################################################################################
# run sample example
echo "Running pandora without denovo..."
echo "Running ${make_prg_executable} from_msa"
${make_prg_executable} from_msa --threads 1 --input msas/ --output-prefix out/prgs/pangenome
echo "Running ${pandora_executable} index"
"${pandora_executable}" index --threads 1 out/prgs/pangenome.prg.fa
echo "Running ${pandora_executable} map"
"${pandora_executable}" map --threads 1 --genotype -o out/map_toy_sample_1 --no-gene-coverage-filtering out/prgs/pangenome.prg.fa.panidx.zip reads/toy_sample_1/toy_sample_1.100x.random.illumina.fastq
echo "Running ${pandora_executable} compare"
"${pandora_executable}" compare --threads 1 --genotype -o out/output_toy_example_no_denovo --no-gene-coverage-filtering out/prgs/pangenome.prg.fa.panidx.zip reads/read_index.tsv
echo "Running pandora without denovo - done!"
echo "Running pandora with denovo..."
echo "Running ${pandora_executable} discover"
"${pandora_executable}" discover --threads 1 --outdir out/pandora_discover_out --no-gene-coverage-filtering out/prgs/pangenome.prg.fa.panidx.zip reads/read_index.tsv
echo "Running ${make_prg_executable} update"
${make_prg_executable} update --threads 1 --update-DS out/prgs/pangenome.update_DS.zip --denovo-paths out/pandora_discover_out/denovo_paths.txt --output-prefix out/updated_prgs/pangenome_updated
echo "Running ${pandora_executable} index on updated PRGs"
"${pandora_executable}" index --threads 1 out/updated_prgs/pangenome_updated.prg.fa
echo "Running ${pandora_executable} compare"
"${pandora_executable}" compare --threads 1 --genotype -o out/output_toy_example_with_denovo --no-gene-coverage-filtering out/updated_prgs/pangenome_updated.prg.fa.panidx.zip reads/read_index.tsv
echo "Running pandora with denovo - done!"
# first compare non-zip files
if diff -rq -I '##fileDate.*' --exclude "*.zip" out out_truth ; then
# now compare zip files
if scripts/diff_zip_files.sh ; then
echo "Example run produced the expected result"
else
echo "ERROR: Example run DID NOT produce the expected result"
fi
else
echo "ERROR: Example run DID NOT produce the expected result"
fi
########################################################################################################################