-
Notifications
You must be signed in to change notification settings - Fork 3
/
analyotp1.pl
106 lines (84 loc) · 2.6 KB
/
analyotp1.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
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Code base of Animesh Sharma [ sharma.animesh@gmail.com ]
#!/usr/bin/perl
# analyotp1.pl krishn_bhakt@Bhakti-Yoga 2007/08/18 18:47:06
use warnings;
use strict;
$|=1;
use Data::Dumper;
use Bio::AlignIO;
my $fin=shift @ARGV;
my $str = Bio::AlignIO->new(-file=> $fin);
my $aln = $str->next_aln();
#print $str;
#print $aln->length, "\n";
#print $aln->no_residues, "\n";
#print $aln->is_flush, "\n";
#print $aln->no_sequences, "\n";
#print $aln->percentage_identity, "\n";
#print $aln->consensus_string(50), "\n";
my $seq;
my %seqn;
my %seqs;
my @seqm;
my $cont=0;
my $c2;
#for(my $c1=0;$c1<=($aln->length);$c1++){my $seqcol="seqc".$c1;}
foreach $seq ( $aln->each_seq() ) {
$seqs{$cont}=$seq->seq();
$seqn{$cont}=$seq->display_id();
my @t=split(//,$seqs{$cont});
for($c2=0;$c2<=$#t;$c2++){
$seqm[$cont][$c2]=$t[$c2];
}
$cont++;
#print $seq->display_id(),"\n",$seq->seq(),"\n";
}
#print "$c2\t$cont\n";
for(my $c3=0;$c3<$c2;$c3++){
my @sequ;
for(my $c4=0;$c4<$cont;$c4++){
push(@sequ,$seqm[$c4][$c3]);
}
my $uv=uniqelem(\@sequ);
print $c3+1,"\t$uv\n";
}
sub uniqelem {
my $lref=shift;
my @list=@$lref;
my %seen = ();
my @uniqu = grep { ! $seen{$_} ++ } @list;
my $returnuniqelem=(@uniqu);
return($returnuniqelem);
}
__END__
=head1 NAME
analyotp1.pl
=head1 SYNOPSIS
=head1 DESCRIPTION
Stub documentation for analyotp1.pl,
created by template.el.
It looks like the author of this script was negligent
enough to leave the stub unedited.
=head1 AUTHOR
, E<lt>krishn_bhakt@Bhakti-YogaE<gt>
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2007 by
This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.2 or,
at your option, any later version of Perl 5 you may have available.
=head1 BUGS
None reported... yet.
=cut