garyboyd has asked for the wisdom of the Perl Monks concerning the following question:
What would be the most efficient way of merging two almost identical strings?
I have two dna sequences as strings, for example:
$string1:
AYGTACTAGACTACAGACTACAGACATCTACAGACTCATCAGCAGCATATTTA
$string2:
ACGTACTAGACTACAGACTACAGACATCTACAGACTCATCAGCAGCATATTKA
$string1 has an ambiguous base on the second character (Y) and $string2 has an ambiguous base on the 52nd character (K). Ambiguous bases can be denoted within the string by the following characters RYSWKMBDHV.
I want to be able to merge multiple DNA strings so that the nucleotide sequences are conserved, except where an ambiguous base occurs, so in the above example I would get a new string that looked like:
$new_string:
AYGTACTAGACTACAGACTACAGACATCTACAGACTCATCAGCAGCATATTKA
So the new string contains both the ambiguous base at position 2 and position 52.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: merging dna sequences
by moritz (Cardinal) on Nov 10, 2011 at 10:30 UTC | |
|
Re: merging dna sequences
by Eliya (Vicar) on Nov 10, 2011 at 11:02 UTC | |
by Anonymous Monk on Nov 10, 2011 at 22:11 UTC | |
by Anonymous Monk on Nov 10, 2011 at 23:35 UTC | |
by garyboyd (Acolyte) on Nov 10, 2011 at 12:29 UTC | |
by MidLifeXis (Monsignor) on Nov 10, 2011 at 14:09 UTC | |
by Eliya (Vicar) on Nov 10, 2011 at 14:14 UTC | |
by garyboyd (Acolyte) on Nov 10, 2011 at 16:07 UTC | |
|
Re: merging dna sequences
by Sinistral (Monsignor) on Nov 10, 2011 at 14:05 UTC | |
by Eliya (Vicar) on Nov 10, 2011 at 14:30 UTC |