-
Notifications
You must be signed in to change notification settings - Fork 0
/
process_data.sh
executable file
·79 lines (69 loc) · 2.29 KB
/
process_data.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
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_FOLDER=$(dirname $(readlink -f $0))
CHIPS_SOURCE_FOLDER=./data/RawData
NUM_THREADS=20
NORMALIZATION_OPTS='--log10'
INTERMEDIATE_FOLDER='results_databox_intermediate'
RESULTS_FOLDER='results_databox'
NAME_MAPPING='no' # 'tf_name_mapping.txt' # use `--name_mapping no` to skip mapping
while true; do
case "${1-}" in
--source)
CHIPS_SOURCE_FOLDER="$(readlink -m "$2")"
shift
;;
--destination)
RESULTS_FOLDER="$(readlink -m "$2")"
shift
;;
--tmp)
INTERMEDIATE_FOLDER="$(readlink -m "$2")"
shift
;;
--num-threads)
NUM_THREADS="$2"
shift
;;
--name-mapping)
if [[ "$2" == "no" ]]; then
NAME_MAPPING="no"
else
NAME_MAPPING="$(readlink -m "$2")"
fi
shift
;;
-?*)
echo -e "WARN: Unknown option (ignored): $1\n" >&2
;;
*)
break
esac
shift
done
if [[ "$NAME_MAPPING" != "no" ]]; then
ruby ${SCRIPT_FOLDER}/rename_chips.rb \
--source ${CHIPS_SOURCE_FOLDER} \
--destination ${INTERMEDIATE_FOLDER}/raw_intensities/ \
--tf-mapping "${NAME_MAPPING}";
CHIPS_SOURCE_FOLDER="${INTERMEDIATE_FOLDER}/raw_intensities/"
fi
## SD_intensities
# window-size=5 means window 11x11
${SCRIPT_FOLDER}/spatial_detrending.sh --source ${CHIPS_SOURCE_FOLDER} \
--destination ${RESULTS_FOLDER}/SD_intensities/ \
--window-size 5 \
--num-threads ${NUM_THREADS}
# SDQN_intensities
ruby ${SCRIPT_FOLDER}/quantile_normalize_chips.rb \
${NORMALIZATION_OPTS} \
--source ${RESULTS_FOLDER}/SD_intensities/ \
--destination ${RESULTS_FOLDER}/SDQN_intensities
## QNZS_intensities
ruby ${SCRIPT_FOLDER}/quantile_normalize_chips.rb \
${NORMALIZATION_OPTS} \
--source ${CHIPS_SOURCE_FOLDER} \
--destination ${INTERMEDIATE_FOLDER}/quantile_normalized_intensities
ruby ${SCRIPT_FOLDER}/zscore_transform_chips.rb \
--source ${INTERMEDIATE_FOLDER}/quantile_normalized_intensities \
--destination ${RESULTS_FOLDER}/QNZS_intensities