-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstop.condon.filter.pl
53 lines (51 loc) · 1004 Bytes
/
stop.condon.filter.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
#usage perl <fasta> <filter_file>
#过滤多序列(CDS)对齐中的终止密码子
use warnings;
open($I,"<$ARGV[0]") or die "No input fasta file!!\n"."Usage :perl filter.pl <fasta> <filter_file>; ";
open($O,">$ARGV[1]") or die "Please assign output_file!!\n"."Usage :perl filter.pl <fasta> <filter_file>; ";
@array1 = <$I>;
@count = undef;
##捕获位点
for($i=0;$i<=$#array1;$i++)
{
if($array1[$i] =~ /\>/)
{
}
else
{
my @a = $array1[$i] =~ /(.{3})/g;
for($n=0;$n<=$#a;$n++)
{
my $c = $a[$n];
chomp $c;
if ($c eq "TGA" || $c eq "TAA" || $c eq "TAG" )
{
push @count,"$n";
}
}
}
}
##过滤密码子
for($i=0;$i<=$#array1;$i++)
{
if($array1[$i] =~ /\>/)
{
print {$O} "\n$array1[$i]";
}
else
{
my @a = $array1[$i] =~ /(.{3})/g;
for ($e=0;$e<=$#a;$e++)
{
for ($g=1;$g<=$#count;$g++)
{
$a[$count[$g]] = "";
}
$c = $a[$e];
print {$O} $c;
}
}
}
system("sed -i '1d' $ARGV[1]");
close $I;
close $O;