从给定的两个序列中,我需要检查每三个密码子,如果更改与以下列表中的相同,那么我必须检查更改的位置和更改的密码子并计算它们的出现次数。
例如:
sequence 1 - TTCAUUUCCCAU
sequence 2 - TTTAUAUCGCAC
我需要得到的输出是
TTC->TTT considered/location-1/count-1
AUU->AUA considered/location-2/count-1
UCC->UCG considered/location-3/count-1
注意:CAU->CAC
不考虑,因为它不在以下列表中。LIST:-> 还应考虑变化的方向。
first sequence->second sequence
TTC->TTT
CTG->UUA
AUU->AUA
GUG->GUA
UCC->UCG
CCC->CCG
ACC->ACG
GCC->GCG
UAC->UAU
UGA->UAG
CAC->CAU
CAG->CAA
AAC->AAU
AAG->AAA
GAC->GAU
GAG->GAA
UGC->UGU
CGG->CGU
AGC->AGU
AGG->CGU
AGA->CGU
UAA->UAG
GGC->GGU
我写到现在的代码是:
print "Enter the sequence:";
$a = <>;
print "Enter the mutated sequence:";
$b = <>;
chomp($a);
chomp($b);
my @codon = split(/(\w{3})/, $a);
my @codon1 = split(/(\w{3})/, $b);
open(OUT, ">output.txt") or die;
$count = 0;
@new = ();
@new1 = ();
for ($i = 0; $i <= $#codon; $i++) {
for ($j = 0; $j <= $#codon1; $j++) {
if ($codon[$i] = {TTC}) || ($codon1[$j] = {TTT}) {
$count++;
}
}
}
print OUT " @new";
close OUT;