-
Notifications
You must be signed in to change notification settings - Fork 0
/
AlinearSeeds.pl
executable file
·121 lines (94 loc) · 2.01 KB
/
AlinearSeeds.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
use strict;
my $Pdb=$ARGV[0];
my $Chain=$ARGV[1];
my $FileName="RetrivedReps_".lc($Pdb)."_".$Chain;
my @File=qx(awk {'print'} $FileName);
chomp @File;
my @Seeds=();
my @Reps=();
my $NPos=split("",$File[1]);
#print $NPos,"\n";
for(my $i=0;$i<@File; $i+=6)
{
push(@Reps, [split("",$File[$i+2])]);
push(@Seeds, [split("",$File[$i+5])]);
}
for(my $i=0; $i<$NPos; $i++)
{
my $aligned="true";
for (my $j=0; $j<@Seeds; $j++)
{
# if( lc($Seeds[$j][$i]) ne lc ($Seeds[0][$i]))
if( lc ($Seeds[$j][$i]) eq '-')
{
$aligned="false";
# print "$Seeds[0][$i] $j $i\n";
#Corregir
for (my $k=0; $k<@Seeds; $k++)
{
if($Seeds[$k][$i] ne "-")
{
splice @{$Seeds[$k]}, $i, 0, '-';
splice @{$Reps[$k]}, $i, 0, '-';
$NPos++;
# print @{$Reps[$k]}, "\n";
# print @{$Seeds[$k]}, "\n";
}
}
}
}
}
#--------------------------------
for(my $i=0; $i<$NPos; $i++)
{
my $aligned="true";
for (my $j=0; $j<@Seeds; $j++)
{
# if( lc($Seeds[$j][$i]) ne lc ($Seeds[0][$i]))
if( lc ($Seeds[$j][$i]) eq '-')
{
$aligned="false";
# print "$Seeds[0][$i] $j $i\n";
#Corregir
for (my $k=0; $k<@Seeds; $k++)
{
if($Seeds[$k][$i] ne "-")
{
splice @{$Seeds[$k]}, $i, 0, '-';
splice @{$Reps[$k]}, $i, 0, '-';
# print @{$Reps[$k]}, "\n";
# print @{$Seeds[$k]}, "\n";
}
}
}
}
}
#--------------------------------
#for (my $i=0; $i<$NPos; $i++)
#{
# my $gapped="true";
# for (my $j=0; $j<@Seeds; $j++)
# {
# if($Seeds[$j][$i] ne "-")
# {
# $gapped="false";
# }
# }
# if ($gapped eq "true")
# {
# for (my $j=0; $j<@Seeds; $j++)
# {
## splice @{$Seeds[$j]}, $i, 1;
## splice @{$Reps[$j]}, $i, 1;
## print "After triming\n", @{$Reps[$j]}, "\n";
## print @{$Seeds[$j]}, "\n";
# }
# }
#}
my $LogoFile=uc($Pdb)."/Hanging/$Pdb\_$Chain.logo";
open (ToLogo, ">$LogoFile");
for (my $i=0; $i<@Seeds; $i++)
{
print ToLogo ">$Pdb\_$Chain\_rep$i","\n",@{$Reps[$i]},"\n";
}
close ToLogo;