-3

私は perl スクリプトを持っていますが、配列が与えられた場合にのみ分子量を計算します。しかし、fastaファイルにあるタンパク質配列の分子量を計算したいです。

print "Enter the amino acid sequence:\n";  
$a = < STDIN > ; 
chomp($a);
my @a = ();
my $a = '';
$x = length($a); 
print "Length of sequence is : $x";
@a = split('', $a); 
$b = 0; 
my %data = ( 
    A=>71.09,  R=>16.19,  D=>114.11,  N=>115.09, 
    C=>103.15,  E=>129.12,  Q=>128.14,  G=>57.05, 
    H=>137.14,  I=>113.16,  L=>113.16,  K=>128.17, 
    M=>131.19,  F=>147.18,  P=>97.12,  S=>87.08, 
    T=>101.11,  W=>186.12,  Y=>163.18,  V=>99.14 
); 
foreach $i(@a) { 
    $b += $data{$i}; 
} 
$c = $b - (18 * ($x - 1)); 
print "\nThe molecular weight of the sequence is $c";             
4

1 に答える 1