-
Notifications
You must be signed in to change notification settings - Fork 3
/
splice_site_check.pl
102 lines (91 loc) · 2.03 KB
/
splice_site_check.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
#!/usr/bin/perl
use strict;
use warnings;
die unless @ARGV == 1;
my ($run_dir)=@ARGV;
my $sn=(split(/\//,$run_dir))[-1];
my %splice_s=();
my $f_bed="/gscmnt/gc2524/dinglab/bed_maker/E75_bed_v3.tsv";
my $f_in=$run_dir."/".$sn.".maf";
my $f_out=$run_dir."/".$sn.".checked.maf";
open(IN,"<$f_bed");
open(OUT,">$f_out");
while(<IN>)
{
my $l=$_;
chomp($l);
my @temp=split("\t",$l);
my $chr=$temp[0];
$chr=~s/chr//g;
my $p1=$temp[1]+1;
my $p2=$temp[2]+1;
my $p3=$p1+1;
my $p4=$p2-1;
my @inf=split(":",$temp[3]);
my $intron=$inf[3];
if($intron=~/^i/) {
my $site1=$chr.":".$p1;
my $site2=$chr.":".$p2;
my $site3=$chr.":".$p3;
my $site4=$chr.":".$p4;
$splice_s{$site1}=1;
$splice_s{$site2}=1;
$splice_s{$site3}=1;
$splice_s{$site4}=1;
}
}
foreach my $l (`cat $f_in`)
{
my $ltr=$l;
chomp($ltr);
if($ltr=~/^Hugo/ || $ltr=~/version 2\.4/) { print OUT $ltr,"\n"; }
else {
my @temp=split("\t",$ltr);
# print $temp[8],"\n";
if($temp[8] eq "Intron")
{
my $chr=$temp[4];
my $type=$temp[9];
$chr=~s/chr//g;
my $ref=$temp[10];
my $var=$temp[12];
my $pos=$temp[5];
if($type eq "SNP")
{
my $p1=$chr.":".$pos;
if(defined $splice_s{$p1})
{
$ltr=~s/Intron/Splice_Site/g;
}
print OUT $ltr,"\n";
}
elsif($type eq "DEL")
{
for(my $i=0;$i<length($ref);$i++)
{
my $posn=$pos+$i;
my $p1=$chr.":".$posn;
if(defined $splice_s{$p1})
{
$ltr=~s/Intron/Splice_Site/g; last;
}
}
print OUT $ltr,"\n";
}
elsif($type eq "INS")
{
my $posn=$pos+1;
my $p1=$chr.":".$pos;
my $p2=$chr.":".$posn;
if(defined $splice_s{$p1} && $splice_s{$p2})
{
$ltr=~s/Intron/Splice_Site/g;
}
print OUT $ltr,"\n";
}
}
else { print OUT $ltr,"\n"; }
}
}
close IN;
close OUT;