-
Notifications
You must be signed in to change notification settings - Fork 2
/
computeMatrixStranded.sh
executable file
·65 lines (50 loc) · 1.93 KB
/
computeMatrixStranded.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
#!/usr/bin/bash
#usage:
# bash ~/ms_tools/MS_Metagene_Tools/computeMatrixStranded.sh reference-point plus-bed minus-bed plus-bw minus-bw up down ref_point out_name other_args
#
# this requires the bed files to have strand information in field 6 !!
#other_args have to be provided like this "--averageTypeBins sum --minThreshold .1"
ref=$1
plus_bed=$2
minus_bed=$3
plus_bw=$4
minus_bw=$5
up=$6
dn=$7
ref_point=$8
out_name=$9
computeMatrix_args=${10}
script_dir="$(dirname -- "$0")/"
if [ ${ref} == "reference-point" ]
then
echo "computing matrix for plus strand bigwig: \n ${plus_bw} \n\n and plus strand bed file ${plus_bed}"
computeMatrix ${ref} -R ${plus_bed} \
-S ${plus_bw} --upstream=${up} --downstream=${dn} \
--referencePoint=${ref_point} \
--outFileName ${out_name}_plus.gz \
$computeMatrix_args
echo "computing matrix for minus strand bigwig: \n ${minus_bw} \n\n and minus strand bed file ${minus_bed}"
computeMatrix ${ref} -R ${minus_bed} \
-S ${minus_bw} --upstream=${up} --downstream=${dn} \
--referencePoint=${ref_point} \
--outFileName ${out_name}_minus.gz \
$computeMatrix_args
echo "joining strands"
python ${script_dir}join_matrix.py ${out_name}_plus.gz ${out_name}_minus.gz ${out_name}_joined.gz
elif [ ${ref} == "scale-regions" ]
then
echo "computing matrix for plus strand bigwig: \n ${plus_bw} \n\n and plus strand bed file ${plus_bed}"
computeMatrix ${ref} -R ${plus_bed} \
-S ${plus_bw} --upstream=${up} --downstream=${dn} \
--outFileName ${out_name}_plus.gz \
$computeMatrix_args
echo "computing matrix for minus strand bigwig: \n ${minus_bw} \n\n and minus strand bed file ${minus_bed}"
computeMatrix ${ref} -R ${minus_bed} \
-S ${minus_bw} --upstream=${up} --downstream=${dn} \
--outFileName ${out_name}_minus.gz \
$computeMatrix_args
echo "joining strands"
python ${script_dir}join_matrix.py ${out_name}_plus.gz ${out_name}_minus.gz ${out_name}_joined.gz
else
echo "need to define reference-point or scale-regions as first argument"
fi