Difference between revisions of "7) Aligning two protein sequences"
imported>S (Created page with "<p>Aligned two tumor protein using MEGA7 program.</p> <p>Tumor protein p53 and tumor protien p73.</p> <p>Could not upload mas output file. </p>") |
imported>S |
||
Line 1: | Line 1: | ||
− | <p> | + | <p><strong>This one compares two sequence, which user input. But is not designed for global alignment. </strong></p> |
− | <p> | + | <p>#!/usr/bin/perl<br /> |
+ | use strict;<br /> | ||
+ | use warnings;</p> | ||
− | <p> | + | <p> <strong>my $dna1 = <STDIN>;</strong><br /> |
+ | chomp($dna1);<br /> | ||
+ | my @string1 = split ('', $dna1);<br /> | ||
+ | <strong>my $len1 = length $dna1;</strong></p> | ||
+ | |||
+ | <p> <strong>my $dna2 = <STDIN>;</strong><br /> | ||
+ | chomp ($dna2);<br /> | ||
+ | my @string2 = split ('', $dna2);<br /> | ||
+ | <strong>my $len2 = length $dna2;</strong></p> | ||
+ | |||
+ | <p>sub max {<br /> | ||
+ | my ($max, @vars) = @_;<br /> | ||
+ | for (@vars) {<br /> | ||
+ | <strong> $max = $_ if $_ > $max;</strong><br /> | ||
+ | }<br /> | ||
+ | return $max;<br /> | ||
+ | }</p> | ||
+ | |||
+ | <p><strong> my $stlen = max ($len1, $len2);</strong></p> | ||
+ | |||
+ | <p> <strong>foreach (my $i =0; $i < $stlen; $i++) </strong>{<br /> | ||
+ | if ( $string1[$i] eq $string2[$i] ) {<br /> | ||
+ | print " $string1[$i] = $string2[$i]\n";}<br /> | ||
+ | else<br /> | ||
+ | { print "$string1[$i] x $string2[$i]\n"; }<br /> | ||
+ | }<br /> | ||
+ | </p> | ||
+ | |||
+ | <p><strong>The output result sample is:</strong> </p> | ||
+ | |||
+ | <p>MKRRRLLYYILEUGNMCG<br /> | ||
+ | KKKRRLLYVILEUGNNNG<br /> | ||
+ | M x K<br /> | ||
+ | K = K<br /> | ||
+ | R x K<br /> | ||
+ | R = R<br /> | ||
+ | R = R<br /> | ||
+ | L = L<br /> | ||
+ | L = L<br /> | ||
+ | Y = Y<br /> | ||
+ | Y x V<br /> | ||
+ | I = I<br /> | ||
+ | L = L<br /> | ||
+ | E = E<br /> | ||
+ | U = U<br /> | ||
+ | G = G<br /> | ||
+ | N = N<br /> | ||
+ | M x N<br /> | ||
+ | C x N<br /> | ||
+ | G = G<br /> | ||
+ | </p> |
Latest revision as of 18:47, 13 June 2017
This one compares two sequence, which user input. But is not designed for global alignment.
#!/usr/bin/perl
use strict;
use warnings;
my $dna1 = <STDIN>;
chomp($dna1);
my @string1 = split ('', $dna1);
my $len1 = length $dna1;
my $dna2 = <STDIN>;
chomp ($dna2);
my @string2 = split ('', $dna2);
my $len2 = length $dna2;
sub max {
my ($max, @vars) = @_;
for (@vars) {
$max = $_ if $_ > $max;
}
return $max;
}
my $stlen = max ($len1, $len2);
foreach (my $i =0; $i < $stlen; $i++) {
if ( $string1[$i] eq $string2[$i] ) {
print " $string1[$i] = $string2[$i]\n";}
else
{ print "$string1[$i] x $string2[$i]\n"; }
}
The output result sample is:
MKRRRLLYYILEUGNMCG
KKKRRLLYVILEUGNNNG
M x K
K = K
R x K
R = R
R = R
L = L
L = L
Y = Y
Y x V
I = I
L = L
E = E
U = U
G = G
N = N
M x N
C x N
G = G