-
Notifications
You must be signed in to change notification settings - Fork 2
/
EChO_1.0.sh
58 lines (35 loc) · 1.9 KB
/
EChO_1.0.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
#!/usr/bin/env bash
set -ue
if [ $# -lt 4 ]
then
echo "
Enhanced Chromatin Occupancy (EChO): Find local minima in average fragment size profiles from CUT&RUN data
Requires bedtools, perl, and R to be in your path
Usage: EChO_1.0.sh <region bed file> <fragment bed file> ["foci" | "matrix"] <output prefix>
Foci mode generates average fragment size profiles from a set of regions and identifies local minima in those profiles (foci)
Matrix mode similarly generates average fragment size profiles and generates a matrix of average fragment size values surrounding every focus
NOTE: Matrix mode requires the fourth column of the region bed file to represent the region focus as defined by EChO Foci mode
"
exit 1
fi
#module load bedtools
path=`dirname $0`
mode=`echo $3`
columns=`awk '{print NF}' $1 | head -n 1`
if [[ $mode == "foci" ]]
then
bedtools intersect -wao -a $1 -b $2 | perl $path/EChO_1.0.pl - $4 line $path/EChO_1.0.R $columns | sed '/^\s*$/d' > $4.EChO.bed
elif [[ $mode == "matrix" ]]
then
bedtools intersect -wao -a $1 -b $2 | perl $path/EChO.matrix_1.0.pl - $4 line $path/EChO.matrix_1.0.R $columns | sed '/^\s*$/d' > $4.EChO.matrix
else
echo "**Third entry must be \"foci\" for foci mode or \"matrix\" for matrix mode**
Enhanced Chromatin Occupancy (EChO): Find local minima in average fragment size profiles from CUT&RUN data
Requires bedtools, perl, and R to be in your path
Usage: EChO_1.0.sh <region bed file> <fragment bed file> ["foci" | "matrix"] <output prefix>
Foci mode generates average fragment size profiles from a set of regions and identifies local minima in those profiles (foci)
Matrix mode similarly generates average fragment size profiles and generates a matrix of average fragment size values surrounding every focus
NOTE: Matrix mode requires the fourth column of the region bed file to represent the region focus as defined by EChO Foci mode
"
exit 1
fi