-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwrapper_ehdn_outlier.sh
executable file
·111 lines (88 loc) · 2.81 KB
/
wrapper_ehdn_outlier.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
#! /bin/sh
### ASDP PIPELINE ###
## Version: 0.0.1
## Licence: AGPLv3
## Author: Anne-Sophie Denommé-Pichon
## Description: script to generate automatically a manifest and multisampleprofile in a tsv format, then do outlier analyses for a single patient
# Source the configuration file
. ./config.sh
# Log file path option
if [ -z "$LOGFILE" ]
then
LOGFILE=ehdn_outlier.$(date +"%F_%H-%M-%S").log
fi
# Logging
exec 1>> "$LOGFILE" 2>&1
echo "$(date +"%F_%H-%M-%S"): START"
# Check if case is specified
if [ -z "$CASE" ]
then
echo "Sample is not specified"
echo "$(date +"%F_%H-%M-%S"): END"
exit 1
fi
# Check if samples list file is specified
if [ -z "$SAMPLES" ]
then
echo "Sample list file is not specified"
echo "$(date +"%F_%H-%M-%S"): END"
exit 1
fi
# Generate manifest for one patient with all samples (to write lines in the file)
while read sample
do
# Check if str_profile.json exists
if [ -f "$OUTPUTDIR/$sample/str/ehdn/$sample.str_profile.json" ]
then
if [ "x$sample" = "x$CASE" ]
then
echo -e "$sample\tcase\t$OUTPUTDIR/$sample/str/ehdn/$sample.str_profile.json"
else
echo -e "$sample\tcontrol\t$OUTPUTDIR/$sample/str/ehdn/$sample.str_profile.json"
fi
fi
done < "$SAMPLES" > "$OUTPUTDIR/$CASE/str/ehdn/$CASE.manifest.tsv"
ehdn_outlier_exitcode=$?
echo "ehdn_outlier exit code : $ehdn_outlier_exitcode"
if [ $ehdn_outlier_exitcode != 0 ]
then
echo "$(date +"%F_%H-%M-%S"): END"
exit 1
fi
# Generate multisampleprofile for one patient with all samples
"$EHDN" merge \
--reference "$REFERENCE" \
--manifest "$OUTPUTDIR/$CASE/str/ehdn/$CASE.manifest.tsv" \
--output-prefix "$CASE/str/ehdn/$CASE"
ehdn_outlier_exitcode=$?
echo "ehdn_outlier exit code : $ehdn_outlier_exitcode"
if [ $ehdn_outlier_exitcode != 0 ]
then
echo "$(date +"%F_%H-%M-%S"): END"
exit 1
fi
# Run locus-based comparison analysis
"$PYTHON" "$EHDN_OUTLIER" locus \
--manifest "$OUTPUTDIR/$CASE/str/ehdn/$CASE.manifest.tsv" \
--multisample-profile "$OUTPUTDIR/$CASE/str/ehdn/$CASE.multisample_profile.json" \
--output "$OUTPUTDIR/$CASE/str/ehdn/$CASE.outlier_locus.tsv"
ehdn_outlier_exitcode=$?
echo "ehdn_outlier exit code : $ehdn_outlier_exitcode"
if [ $ehdn_outlier_exitcode != 0 ]
then
echo "$(date +"%F_%H-%M-%S"): END"
exit 1
fi
# Run motif_based comparison analysis
"$PYTHON" "$EHDN_OUTLIER" motif \
--manifest "$OUTPUTDIR/$CASE/str/ehdn/$CASE.manifest.tsv" \
--multisample-profile "$OUTPUTDIR/$CASE/str/ehdn/$CASE.multisample_profile.json" \
--output "$OUTPUTDIR/$CASE/str/ehdn/$CASE.outlier_motif.tsv"
ehdn_outlier_exitcode=$?
echo "ehdn_outlier exit code : $ehdn_outlier_exitcode"
if [ $ehdn_outlier_exitcode != 0 ]
then
echo "$(date +"%F_%H-%M-%S"): END"
exit 1
fi
echo "$(date +"%F_%H-%M-%S"): END"