-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathpindel
executable file
·31 lines (27 loc) · 1.13 KB
/
pindel
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
#!/bin/bash
bam="$1"
[[ -z "$1" ]] && { echo "Parameter 1 is empty" 1>&2; exit 1; }
peaks="$2"
[[ -z "$2" ]] && { echo "Parameter 2 is empty" 1>&2; exit 1; }
genome="$3"
[[ -z "$3" ]] && { echo "Parameter 3 is empty" 1>&2; exit 1; }
output_dir="$4"
[[ -z "$4" ]] && { echo "Parameter 4 is empty" 1>&2; exit 1; }
samp="$5"
[[ -z "$5" ]] && { echo "Parameter 5 is empty" 1>&2; exit 1; }
# we sleep between each command to avoid potential problems with filesystem latency
pindel -f "$genome" -i <(echo "$bam" 300 "$samp") -j "$peaks" -o "$output_dir/" -L "$output_dir/log" && \
sleep 10 && \
for file in _D _INV _SI _TD; do
pindel2vcf -p "$output_dir/$file" -r "$genome" -R x -d 00000000 -v "$output_dir/$file.raw.vcf" && \
sleep 10 && \
bgzip -f "$output_dir/$file.raw.vcf" && \
sleep 10 && \
tabix -p vcf -f "$output_dir/$file.raw.vcf.gz" && \
sleep 10 && \
bcftools norm -d all "$output_dir/$file.raw.vcf.gz" > "$output_dir/$file.vcf" && \
sleep 10 && \
bgzip -f "$output_dir/$file.vcf" && tabix -p vcf -f "$output_dir/$file.vcf.gz"
done && \
sleep 10 && \
bcftools concat -a -d all "$output_dir/"{_D,_INV,_SI,_TD}.vcf.gz > "$output_dir/pindel.vcf"