-
Notifications
You must be signed in to change notification settings - Fork 0
/
binding
executable file
·151 lines (135 loc) · 5.89 KB
/
binding
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
#!/bin/bash
# ======================================================== #
# | *** Usage *** | #
# ======================================================== #
usage(){
cat << EOF
evaluate-network v1.0
binding command for evaluating network with binding data
binding [options]
GENERAL arguments
--p_in_net : path of file for input network, three-columns tab separated file for regulators, targets and edge scores. No header for this file (mandatory).
--nbr_top_edges : number of top (TF, target) edges that will be evaluated (optional, default 50)
--nbr_edges_per_threshold : number of (TF, target) edges evaluated in the first threshold (optional, default 5)
--p_binding_event : path of binding file, two-columns tab separated file for regulators and targets. These are the edges that have evidence of direct binding by experiments of binding such as ChIP-Chip (mandatory)
--conda_env : conda environment that will be used (neteval) (mandatory, if flag_singularity is OFF)
--p_out_eval : path of output file for evaluation (mandatory)
--flag_debug : ON or OFF, if ON the bash command is printed
SINGULARITY arguments
--flag_singularity : ON or OFF, for singularity run (optional, default ON)
--p_singularity_bindpath : path of mounted directory to singularity container (optional)
--p_singularity_img : path of directory for singularity containerr image provided in github page (mandatory, if flag_singularity is ON)
SLURM arguments
--flag_slurm : ON or OFF, for SLURM run (optional, default OFF)
--p_out_logs : path of directory for SLURM log files (mandatory, only if flag_slurm is ON)
EOF
}
# ======================================================== #
# | *** Define Default Arguments *** | #
# ======================================================== #
nbr_top_edges=50
nbr_edges_per_threshold=5
p_src_code="$(cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)/"
conda_env=neteval
p_binding_event=NONE
flag_slurm=OFF
flag_singularity=ON
p_singularity_bindpath=/home/
p_singularity_img=NONE
flag_debug=OFF
data=""
# ======================================================== #
# | *** Parse Arguments *** | #
# ======================================================== #
while getopts ":h-:" OPTION
do
case "${OPTION}" in
h)
usage
exit 2
;;
-)
case "${OPTARG}" in
# input
p_in_net)
p_in_net="${!OPTIND}"; OPTIND=$(( ${OPTIND} + 1 ))
;;
nbr_top_edges)
nbr_top_edges="${!OPTIND}"; OPTIND=$(( ${OPTIND} + 1 ))
;;
nbr_edges_per_threshold)
nbr_edges_per_threshold="${!OPTIND}"; OPTIND=$(( ${OPTIND} + 1 ))
;;
conda_env)
conda_env="${!OPTIND}"; OPTIND=$(( ${OPTIND} + 1 ))
;;
p_binding_event)
p_binding_event="${!OPTIND}"; OPTIND=$(( ${OPTIND} + 1 ))
;;
flag_debug)
flag_debug="${!OPTIND}"; OPTIND=$(( ${OPTIND} + 1 ))
;;
data)
data="${!OPTIND}"; OPTIND=$(( ${OPTIND} + 1 ))
;;
# output
p_out_eval)
p_out_eval="${!OPTIND}"; OPTIND=$(( ${OPTIND} + 1 ))
;;
# SLURM arguments
flag_slurm)
flag_slurm="${!OPTIND}"; OPTIND=$(( ${OPTIND} + 1 ))
;;
p_out_logs)
p_out_logs="${!OPTIND}"; OPTIND=$(( ${OPTIND} + 1 ))
;;
# SINGULARITY arguments
flag_singularity)
flag_singularity="${!OPTIND}"; OPTIND=$(( ${OPTIND} + 1 ))
;;
p_singularity_bindpath)
p_singularity_bindpath="${!OPTIND}"; OPTIND=$(( ${OPTIND} + 1 ))
;;
p_singularity_img)
p_singularity_img="${!OPTIND}"; OPTIND=$(( ${OPTIND} + 1 ))
;;
esac;;
esac
done
# ======================================================== #
# | *** Define Command *** | #
# ======================================================== #
command=""
if [ ${flag_slurm} == "ON" ]
then
mkdir -p ${p_out_logs}
command+="sbatch
-o ${p_out_logs}eval_binding_%J.out \
-e ${p_out_logs}eval_binding_%J.err \
-J eval_with_binding_${data} "
fi
if [ ${p_binding_event} == "NONE" ]
then
p_binding_event=${p_src_code}metadata/yeast/reg_target_cc_exo_chip_exclusive.txt
fi
command+="${p_src_code}wrapper/binding.sh \
--p_in_net ${p_in_net} \
--p_out_eval ${p_out_eval} \
--nbr_top_edges ${nbr_top_edges} \
--nbr_edges_per_threshold ${nbr_edges_per_threshold} \
--p_src_code ${p_src_code} \
--flag_slurm ${flag_slurm} \
--conda_env ${conda_env} \
--p_binding_event ${p_binding_event} \
--flag_singularity ${flag_singularity} \
--p_singularity_bindpath ${p_singularity_bindpath} \
--p_singularity_img ${p_singularity_img} \
--flag_debug ${flag_debug}"
# ======================================================== #
# | *** Run Command *** | #
# ======================================================== #
if [ ${flag_debug} == "ON" ]
then
echo "${command}"
fi
eval ${command}