-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcount_dhl.pl
executable file
·110 lines (95 loc) · 1.82 KB
/
count_dhl.pl
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
97
98
99
100
101
102
103
104
105
106
107
108
109
##################################
# count_dhl.pl
# It is a Perl script by Ivan_Woo
# It count each kind of meth level of segment duplication
# 2019-05-12
##################################
use strict;
use warnings;
open AT_CR,"<",$ARGV[0];
open CR_BR,"<",$ARGV[1];
open BR_TC,"<",$ARGV[2];
open BTC,"<",$ARGV[3];
my $h = $ARGV[4];
my $d = $ARGV[5];
my $atcr = 0;
my $atcr_h = 0;
my $atcr_d = 0;
my $atcr_l = 0;
my $crbr = 0;
my $crbr_h = 0;
my $crbr_d = 0;
my $crbr_l = 0;
my $brtc = 0;
my $brtc_h = 0;
my $brtc_d = 0;
my $brtc_l = 0;
my $btc = 0;
my $btc_h = 0;
my $btc_d = 0;
my $btc_l = 0;
while(<AT_CR>){
$atcr++;
chomp;
my @tmp = split("\t",$_);
my $o = abs($tmp[4]-$tmp[5]);
if($o >= $d){
$atcr_d++;
}elsif(($o >= $d-0.1)and(($tmp[4]<$h)or($tmp[5]<$h))){
$atcr_d++;
}elsif(($tmp[4]>=$h)and($tmp[5]>=$h)){
$atcr_h++;
}else{
$atcr_l++;
}
}
close AT_CR;
while(<CR_BR>){
$crbr++;
chomp;
my @tmp = split("\t",$_);
my $o = abs($tmp[4]-$tmp[5]);
if($o >= $d){
$crbr_d++;
}elsif(($o >= $d-0.1)and(($tmp[4]<$h)or($tmp[5]<$h))){
$crbr_d++;
}elsif(($tmp[4]>=$h)and($tmp[5]>=$h)){
$crbr_h++;
}else{
$crbr_l++;
}
}
close CR_BR;
while(<BR_TC>){
$brtc++;
chomp;
my @tmp = split("\t",$_);
my $o = abs($tmp[4]-$tmp[5]);
if($o >= $d){
$brtc_d++;
}elsif(($o >= $d-0.1)and(($tmp[4]<$h)or($tmp[5]<$h))){
$brtc_d++;
}elsif(($tmp[4]>=$h)and($tmp[5]>=$h)){
$brtc_h++;
}else{
$brtc_l++;
}
}
close BR_TC;
while(<BTC>){
$btc++;
chomp;
my @tmp = split("\t",$_);
my $o = abs($tmp[4]-$tmp[5]);
if($o >= $d){
$btc_d++;
}elsif(($o >= $d-0.1)and(($tmp[4]<$h)or($tmp[5]<$h))){
$btc_d++;
}elsif(($tmp[4]>=$h)and($tmp[5]>=$h)){
$btc_h++;
}else{
$btc_l++;
}
}
close BTC;
print"$atcr\t$atcr_h\t$atcr_d\t$atcr_l\n$crbr\t$crbr_h\t$crbr_d\t$crbr_l\n$brtc\t$brtc_h\t$brtc_d\t$brtc_l\n$btc\t$btc_h\t$btc_d\t$btc_l\n";