my @oldMarkers = qw(chr1 chr2 IMP IMP IMP IMP IMP IMP IMP IMP IMP IMP IMP IMP IMP chr2);
my @newMarkers;
my $chrCount = 0;
my $impCount = 0;
foreach my $marker (@oldMarkers) {
if ( $marker =~ /^chr\d+$/ ) {
push @newMarkers, ++$chrCount;
$impCount = 0;
} elsif ( $marker eq "IMP" ) {
$impCount++;
$impCount = 1 if $impCount == 10;
push @newMarkers, "$chrCount.$impCount";
} else {
die "Unrecognized marker $marker";
}
}
print "@newMarkers\n";