Hi monkfan, If i understood your question correctly, it helps you.
use strict; my %compare = ('[TCG]GGGG[AT]'=>['AGGGGC', 'TGGGGC'], 'TGGGGT'=>['AGGG +GC','AGGGGC']); for my $ky (keys (%compare)) { my @source = split /GGGG/, $ky; my @arr = @{$compare{$ky}}; print "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; print "\nSource:\t", $ky; print "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; for my $t (0..$#arr){ my @tar = split /GGGG/,$arr[$t]; print "\nTarget:\t", $arr[$t], "\n"; my $mis = 0; for my $po (0..$#source){ if ($tar[$po] !~ m/$source[$po]/){ $mis++; print "\nPosition for Mismatch : ",$po + 1 if ($po == +0); print "\nPosition for Mismatch : ",$po + 5 if ($po == +1); } } print "\nNo of Mismatch = $mis\n"; } print "\n+++++++++++++++++++++++++++++\n"; } __END__ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Source: [TCG]GGGG[AT] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Target: AGGGGC Position for Mismatch : 1 Position for Mismatch : 6 No of Mismatch = 2 Target: TGGGGC Position for Mismatch : 6 No of Mismatch = 1 +++++++++++++++++++++++++++++ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Source: TGGGGT ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Target: AGGGGC Position for Mismatch : 1 Position for Mismatch : 6 No of Mismatch = 2 Target: AGGGGC Position for Mismatch : 1 Position for Mismatch : 6 No of Mismatch = 2 +++++++++++++++++++++++++++++
Regards,
Velusamy R.
In reply to Re: Mismatch Positions of Ambiguous String
by Samy_rio
in thread Mismatch Positions of Ambiguous String
by monkfan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |