-
Notifications
You must be signed in to change notification settings - Fork 0
/
relax_count.pl
46 lines (46 loc) · 1.01 KB
/
relax_count.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
#######Relax select count###############
#--------------------------------------#
#######make by Kogoori Masaki###########
#--------------------------------------#
#Example Usage: for i in *.fa.filter.relax; do perl relax_count.pl $i >> relax.count ; done#
use warnings;
open $I,"< $ARGV[0]" or die "no inputfile!";
@gene = <$I>;
@species = ("cahirinus","dimidiatus","russatus","kempi","percivali");
@count = 0;
$name = $ARGV[0];
$name =~ s/\.fa\.filter\.relax//g;
for($j=0;$j<=$#gene;$j++)
{
for($d=0;$d<=$#species;$d++)
{
if($gene[$j] =~ /\"$species[$d]\"\:\{/)
{
push @count,"$j";
}
if($gene[$j] =~ /p-value/)
{
$pvalue = $gene[$j];
}
}
}
for($f=1;$f<=$#count;$f++)
{
my $a = $count[$f]+7;
my $e = $gene[$count[$f]];
$e =~ s/\n//g;
$e =~ s/\:\{//g;
$e =~ s/\"//g;
print $name."\t";
print $e;
$kvalue = $gene[$a];
$kvalue =~ s/\:/\t/g;
$kvalue =~ s/\,//g;
$kvalue =~ s/\"//g;
$pvalue =~ s/\"//g;
$pvalue =~ s/\:/\t/g;
$pvalue =~ s/\,//g;
chomp $kvalue;
print "$kvalue\t"."$pvalue";
}
close $I;