Entering edit mode
13.2 years ago
Jamis
▴
40
From a given two sequences i need to check for every three codons and if the changes are same as in the following list, then i ve to check out the location of changes and the codons which are changed and count their number of occurences.
For eg:
seq1- TTCAUUUCCCAU
seq2- TTTAUAUCGCAC
so, the output which i need to get is:
TTC->TTT considered / location-1 / count-1
AUU->AUA considered / location-2 / count-1
UCC->UCG considered / location-3 / count-1
NOTE:
CAU->CAC not considered because it is not there in the following list
LIST:-> The direction of changes should also be considered.
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
and the code which i ve written till now is :
#!/usr/bin/perl
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;