-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFig5A_CNV_burden.pl
76 lines (57 loc) · 1.22 KB
/
Fig5A_CNV_burden.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
#!/usr/bin/perl
use strict;
my %hash;
my $line;
open IN,"SureSelect_Human_All_Exon_V6_r2_hg38/S07604514_Regions.bed" or die "can not open S07604514_Regions\n";
while($line=<IN>){
chomp $line;
my @tmp=split(/\t/,$line);
next if ($line=~/browser/);
next if ($line=~/track/);
my $chr=$tmp[0];
my $start=$tmp[1];
my $end=$tmp[2];
for (my $i=$start;$i<=$end;$i++){
my $tt="$chr:$i";
$hash{$tt}=1;
}
}
close IN;
my $infile=$ARGV[0];
my $gender=$ARGV[1];
my $sample=$ARGV[2];
my $num=0;
my $line;
open IN,"$infile" or die "can not open $infile\n";
while($line=<IN>){
chomp $line;
my @tmp=split(/\t/,$line);
my $chr=$tmp[0];
my $start=$tmp[1];
my $end=$tmp[2];
my $cn=$tmp[6];
my $depth=$tmp[9];
next if($depth <10);
next if($cn ==2);
next if ($chr!~/chr/);
if ($gender eq 'F'){
if ($chr eq "chrY"){
next;
}
}
#print "$chr\t$start\t$end\t$cn\t$depth\n";
for (my $i=$start;$i<=$end;$i++){
my $tt="$chr:$i";
if (exists $hash{$tt}){
$num++;
}
}
}
close IN;
my $tmb;
if ($gender eq 'M'){
$tmb=sprintf("%.2f",$num*100/38449302);
}else{
$tmb=sprintf("%.2f",$num*100/38342646);
}
print "$sample\t$num\t$tmb\n";