-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiwes_pipeline.sh
executable file
·156 lines (144 loc) · 4.53 KB
/
iwes_pipeline.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#!/usr/bin/env bash
usage () { echo "Usage : $0 "; }
echo $1
echo $@
create_reference_files=T
threads=1
ram=8000
script_dir=NONE
read_length=151
for arg in "$@"; do
shift
case "$arg" in
"--ref_dir") set -- "$@" "-c" ;;
"--cp_dir") set -- "$@" "-p" ;;
"--fastq_dir") set -- "$@" "-f" ;;
"--threads") set -- "$@" "-t" ;;
"--ram") set -- "$@" "-r" ;;
"--out_dir") set -- "$@" "-o" ;;
"--project_name") set -- "$@" "-n" ;;
"--animal_lookup_path") set -- "$@" "-a" ;;
"--create_reference_files") set -- "$@" "-i" ;;
"--db_path") set -- "$@" "-d" ;;
"--db_ext") set -- "$@" "-e" ;;
"--haplo_fasta") set -- "$@" "-m" ;;
"--haplotype_json_path") set -- "$@" "-h" ;;
"--script_dir") set -- "$@" "-z" ;;
"--species") set -- "$@" "-s" ;;
"--use_mask") set -- "$@" "-u" ;;
"--output_depth_all") set -- "$@" "-b" ;;
"--confidence_coeff_json") set -- "$@" "-g" ;;
"--read_length") set -- "$@" "-l" ;;
"--minimap2_path") set -- "$@" "-y" ;;
*) set -- "$@" "$arg"
esac
done
while getopts c:p:f:t:r:o:n:a:i:d:e:m:h:z:s:u:b:g:l:y: opt ; do
case $opt in
c) ref_dir=$OPTARG ;;
p) cp_dir=$OPTARG ;;
f) fastq_dir=$OPTARG ;;
t) threads=$OPTARG ;;
r) ram=$OPTARG ;;
o) out_dir=$OPTARG ;;
n) project_name=$OPTARG ;;
a) animal_lookup_path=$OPTARG ;;
i) create_reference_files=$OPTARG ;;
d) db_path=$OPTARG ;;
e) db_ext=$OPTARG ;;
m) haplo_fasta=$OPTARG ;;
h) haplotype_json_path=$OPTARG ;;
z) script_dir=$OPTARG ;;
s) species=$OPTARG ;;
u) use_mask=$OPTARG ;;
b) output_depth_all=$OPTARG ;;
g) confidence_coeff_json=$OPTARG ;;
l) read_length=$OPTARG ;;
y) minimap2_path=$OPTARG ;;
*) usage; exit 1;;
esac
done
if [ "$script_dir" == "NONE" ]; then
script_dir=$( dirname -- "$0"; );
fi
echo "Script dir: ${script_dir}"
# Launch the ipd ref matrix creator
create_reference_files=`echo $create_reference_files | cut -c1-1`
case "${create_reference_files}" in ([Tt])
echo "python3 ${script_dir}/modules/create_ref_files.py \
--ref_dir=${ref_dir} \
--db_path ${db_path} \
--db_ext ${db_ext} \
--haplo_fasta=${haplo_fasta} \
--haplotype_json_path=${haplotype_json_path} \
--cp_path=${cp_dir} \
--threads=${threads} \
--ram=${ram} \
--species=${species} \
--minimap2_path=${minimap2_path}"
python3 ${script_dir}/modules/create_ref_files.py \
--ref_dir="${ref_dir}" \
--db_path ${db_path} \
--db_ext ${db_ext} \
--haplo_fasta="${haplo_fasta}" \
--haplotype_json_path="${haplotype_json_path}" \
--cp_path="${cp_dir}" \
--threads=${threads} \
--ram=${ram} \
--species=${species} \
--minimap2_path=${minimap2_path};
echo "python3 ${script_dir}/modules/create_hash.py --ref_dir=${ref_dir}";
python3 ${script_dir}/modules/create_hash.py --ref_dir="${ref_dir}" --read_length=${read_length};
# exit
esac
## Align files
echo "python3 ${script_dir}/modules/semiperfect_align.py \
--cp_dir=${cp_dir} \
--fastq_dir=${fastq_dir} \
--bam_dir=${out_dir}/bam \
--ref_dir=${ref_dir} \
--threads=${threads} \
--ram=${ram}"
python3 ${script_dir}/modules/semiperfect_align.py \
--cp_dir="${cp_dir}" \
--fastq_dir="${fastq_dir}" \
--bam_dir="${out_dir}/bam" \
--ref_dir="${ref_dir}" \
--threads=${threads} \
--ram=${ram}
# Expand the alignment and create depth of coverage plots
echo "python3 ${script_dir}/modules/filter_alignments.py \
--project_name=${project_name} \
--out_dir=${out_dir} \
--bait_fasta=${ref_dir}/bait.fasta \
--ipd_ref_hash=${ref_dir}/ipd_hash.csv.gz \
--bam_dir=${out_dir}/bam \
--mask_path=${ref_dir}/mask_range.csv \
--db_ext ${db_ext} \
--output_depth_all ${output_depth_all} \
--use_mask ${use_mask}"
python3 ${script_dir}/modules/filter_alignments.py \
--project_name=${project_name} \
--out_dir=${out_dir} \
--bait_fasta=${ref_dir}/bait.fasta \
--ipd_ref_hash=${ref_dir}/ipd_hash.csv.gz \
--bam_dir=${out_dir}/bam \
--mask_path=${ref_dir}/mask_range.csv \
--db_ext ${db_ext} \
--output_depth_all ${output_depth_all} \
--use_mask ${use_mask}
# create a pivot table
echo "python3 ${script_dir}/modules/create_pivot.py \
--project_name=${project_name} \
--out_dir=${out_dir} \
--ref_dir=${ref_dir} \
--confidence_coeff_json=${confidence_coeff_json} \
--animal_lookup_path=${animal_lookup_path} \
--db_ext ${db_ext}"
python3 ${script_dir}/modules/create_pivot.py \
--project_name="${project_name}" \
--out_dir="${out_dir}" \
--ref_dir="${ref_dir}" \
--confidence_coeff_json=${confidence_coeff_json} \
--animal_lookup_path="${animal_lookup_path}" \
--db_ext ${db_ext}