Created
October 9, 2012 20:36
-
-
Save mhan008/3861251 to your computer and use it in GitHub Desktop.
Week2 #5-7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
my @seqnames = ("AAC35278", "AnCSMA", "AfCHSF", "AAF19257", "P30573-1"); | |
my @seqs = ("LLIAITYYNEDKVLTARTLHGVMQNPAWQKIVVCLVFDGIDPVLATIGV-VMKKDVDGKE","AMCLVTCYSEGEEGIRTTLDSIALTPN-SHKSIVVICDGIIKVLRMMRD-TGSKRHNMAK", "ALCLVTCYSEGEEGIRTTLDSIAMTPN$ | |
for ( my $i = 0; $i <= 4 ; $i++) { | |
print "Sequence name is $seqnames[$i]\n"; | |
my @residues = split('-',$seqs[$i]); | |
my $len = join (/\s/, @residues); | |
my $length = length $len; | |
print "And residue length is $length\n"; | |
} | |
my %columns; | |
for ( my $i = 0; $i <= 4; $i++) { | |
my $index = index($seqs[$i],"-"); | |
while( $index >= 0) { | |
#print "Gaps at position(s) $index\n"; | |
$columns{$index} = "1"; | |
$index = index($seqs[$i],"-",$index+=2); | |
} | |
} | |
my $hash = keys %columns; | |
print "Unique gapped columns $hash\n"; | |
my $identity = 0; | |
for ( my $i = 0; $i < 60; $i++) { | |
my $AfC = substr($seqs[2], $i, 1); | |
my $AAF = substr($seqs[3], $i, 1); | |
if( $AfC eq $AAF) { | |
$identity++; | |
} | |
} | |
print "Number of identical residues between AfCHSF and AAF19527 is $identity\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment