forked from pxulab/MRLR
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1st_merge_sum_stat.pl
More file actions
executable file
·53 lines (49 loc) · 960 Bytes
/
1st_merge_sum_stat.pl
File metadata and controls
executable file
·53 lines (49 loc) · 960 Bytes
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
#!/usr/bin/perl -w
##
use strict;
my $file = shift or die "Usage: $0 <merge_match.10k_sum_intersect>\n";
&array($file,8);
sub array{
my ($file,$n)=@_;
my $before;
my ($sum,$high);
my $start;
my $end;
my @array;
open my $file_h,'<',$file;
while(<$file_h>){
my @line=split;
next if $line[7] eq "-";
my $sym=$line[$n];
$line[$n]=~s/^\d-/0-/;
my $id="$line[0]\t$line[3]\t$line[4]\t$line[$n]";
if(defined($before) &&($id eq $before)){
$end=$line[2];
$sum++;
if($line[7]eq"high"){
$high++;
}
}
else{
if(defined($before) && ($id ne $before)){
if($sum>=1 and $high>=1){
print "$before\t$start\t$end\t$sum\t$high\tFather-Child\n";
}
}
$before=$id;
$sum=1;
if($line[7]eq"high"){
$high=1;
}else{
$high=0;
}
$start=$line[1];
$end=$line[2];
}
}
if(eof($file_h)){
if($sum>=1 and $high>=1){
print "$before\t$start\t$end\t$sum\t$high\tFather-Child\n";
}
}
}