-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstep6-regionMatrix.sh
executable file
·64 lines (51 loc) · 1.67 KB
/
step6-regionMatrix.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
#!/bin/sh
## Usage
# sh step6-regionMatrix.sh snyder
# sh step6-regionMatrix.sh hippo
# Define variables
EXPERIMENT=$1
SHORT="regMat-${EXPERIMENT}"
ncore=5
cores="${ncore}cores"
# Directories
ROOTDIR=/dcl01/lieber/ajaffe/derRuns/derCountSupp
MAINDIR=${ROOTDIR}/${EXPERIMENT}
WDIR=${MAINDIR}/regionMatrix
if [[ "${EXPERIMENT}" == "snyder" ]]
then
CUTOFF=5
RLENGTH=101
elif [[ "${EXPERIMENT}" == "hippo" ]]
then
CUTOFF=3
RLENGTH=36
else
echo "Specify a valid experiment: snyder or hippo"
fi
# Construct shell files
sname="${SHORT}"
echo "Creating script ${sname}"
cat > ${ROOTDIR}/.${sname}.sh <<EOF
#!/bin/bash
#$ -cwd
#$ -m e
#$ -l mem_free=50G,h_vmem=100G,h_fsize=30G
#$ -N ${sname}
#$ -pe local ${ncore}
#$ -hold_jid fullCov-${EXPERIMENT}
echo "**** Job starts ****"
date
# Make logs directory
mkdir -p ${WDIR}/logs
# Load coverage & get region matrix
cd ${WDIR}
module load R/3.2.x
R -e "library(derfinder); message(Sys.time()); timeinfo <- NULL; timeinfo <- c(timeinfo, list(Sys.time())); load('${MAINDIR}/CoverageInfo/fullCov.Rdata'); timeinfo <- c(timeinfo, list(Sys.time())); proc.time(); message(Sys.time()); regionMat <- regionMatrix(fullCov, maxClusterGap = 3000L, L = ${RLENGTH}, mc.cores = ${ncore}, cutoff = ${CUTOFF}, returnBP = FALSE); timeinfo <- c(timeinfo, list(Sys.time())); save(regionMat, file='regionMat-cut${CUTOFF}.Rdata'); timeinfo <- c(timeinfo, list(Sys.time())); save(timeinfo, file='timeinfo-${cores}.Rdata'); proc.time(); message(Sys.time()); options(width = 120); devtools::session_info()"
## Move log files into the logs directory
mv ${ROOTDIR}/${sname}.* ${WDIR}/logs/
echo "**** Job ends ****"
date
EOF
call="qsub .${sname}.sh"
echo $call
$call