in reply to Lower-casing Substrings and Iterating Two Files together
The output should look like:$seq = 'GGTACACAGAAGCCAAAGCAGGCTCCAGGCTCTGAGCTGTCAGCACAGAGACCGAT'; $mask = 'GGTNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNT'; ($srch = $mask) =~ s/(N+)/($1)/g; $srch =~ tr/N/./; $cnt = 1; ($repl = $mask) =~ s/N+/" . lc(\$" . $cnt++ . ") . "/ge; print $srch, "\n", $repl, "\n\n", $seq, "\n"; $seq =~ s/$srch/$repl/ee; print $seq, "\n";
That said, if the aforementioned assumption does hold, I have to think that a search for efficiency should begin in the code that generated "data2.txt", if at all possible.GGT(....................................................)T GGT . lc($1) . T GGTACACAGAAGCCAAAGCAGGCTCCAGGCTCTGAGCTGTCAGCACAGAGACCGAT GGTacacagaagccaaagcaggctccaggctctgagctgtcagcacagagaccgaT
|
|---|