-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcuffdiff.sh
executable file
·96 lines (74 loc) · 3.7 KB
/
cuffdiff.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
#!/bin/bash
#--------------------------------------------------------------------------------------------------------------
# cuffdiff - find significant changes in transcript expression, splicing, and promoter use
#
# - Groups of replicates for each experiement (case) are defined in settings.sh
#
# - Calls singleCuffdiff.sh for each pair of cases you want to compare
#
# - Can send you emails when each job starts to execute and when each is finished so
# that you know when to submit the jobs for the next step
#
# - NOTE: The easiest, least-error-prone way to create the groups below is to use the "ls -l" of the tophat_results
# directory and then group the listed subdirectories accordingly
#
#--------------------------------------------------------------------------------------------------------------
#----SETTINGS---------------
if [ -z ${TAILOR_CONFIG+x} ]; then
echo -e "\nEnvironment variable TAILOR_CONFIG is not set!\n"
exit
elif [ ! -f "${TAILOR_CONFIG}" ]; then
echo -e "\nSettings file ${TAILOR_CONFIG} does not exist!\n"
exit
else
echo -e "\nUsing settings file ${TAILOR_CONFIG}.\n"
fi
source "${TAILOR_CONFIG}"
#---------------------------
#----PATHS-----------------------------------------------------------
OUTPUT="${CUFFDIFF_OUTPUT}"
#--------------------------------------------------------------------
#----OUTPUT-----------------
if [ ! -d ${OUTPUT} ]; then
mkdir ${OUTPUT}
fi
#---------------------------
# Save this version of the config file
configFileName=$(basename ${TAILOR_CONFIG})
cp "${TAILOR_CONFIG}" "${OUTPUT}/${configFileName}.$(date +%F_%R)"
#----------------------------------------------------------------------------------------------------------------------------------------
# Write the group arrays to file with entries separated by newlines
#----------------------------------------------------------------------------------------------------------------------------------------
for i in "${!experimentNames[@]}"; do
EXPER_FILE="${OUTPUT}/group${i}.list.txt"
experimentGroupString="experimentGroups${i}"
eval experimentGroup=\( \${${experimentGroupString}[@]} \)
printf '%s\n' "${experimentGroup[@]}" > $EXPER_FILE
done
#----------------------------------------------------------------------------------------------------------------------------------------
# Call singleCuffDiff on each requested comparison
#
# NOTE: singleCuffdiff.sh sample1Group sample1Name sample2Group sample2Name - generates expression fold changes of sample2 over sample1.
#
# So for Case vs Control the call should be: "singleCuffdiff.sh controlGroup controlName caseGroup caseName".
#
#----------------------------------------------------------------------------------------------------------------------------------------
for (( c=0; c<$NUM_COMPARISONS; c++ )); do
GROUP_1="cuffdiff${c}[0]"
GROUP_2="cuffdiff${c}[1]"
GROUP_1_VAR=${!GROUP_1}
GROUP_2_VAR=${!GROUP_2}
EXPER_1_NAME="${experimentNames[${GROUP_1_VAR}]}"
EXPER_2_NAME="${experimentNames[${GROUP_2_VAR}]}"
EXPER_1_FILE="${OUTPUT}/group${GROUP_1_VAR}.list.txt"
EXPER_2_FILE="${OUTPUT}/group${GROUP_2_VAR}.list.txt"
# EXPER_1_NAME="${experimentNames[{!GROUP_1}]}"
# EXPER_2_NAME="${experimentNames[{!GROUP_2}]}"
# EXPER_1_FILE="${OUTPUT}/group${!GROUP_1}.list.txt"
# EXPER_2_FILE="${OUTPUT}/group${!GROUP_2}.list.txt"
# echo -e "\n\nCuffdiff comparison $c"
# echo -e "\n GROUP_1_VAR=$GROUP_1_VAR, GROUP_2_VAR=$GROUP_2_VAR"
# echo -e "\n EXPER_1_NAME=$EXPER_1_NAME, EXPER_2_NAME=$EXPER_2_NAME"
# echo -e "\n EXPER_1_FILE=$EXPER_1_FILE, EXPER_2_FILE=$EXPER_2_FILE"
singleCuffdiff.sh $EXPER_1_FILE $EXPER_1_NAME $EXPER_2_FILE $EXPER_2_NAME
done