String match problem [closed]
I have two strings:
string1 = "ABCD"
string2 = "-A---C-D-"
and I want to adjust string1 to become sth like "-AB--C-D-" which has max similarity (i.e. min Levenshtein Distance) with string2.
How can I do that?
Thanks
Guys, thanks for replying.
Actually this is a biological problem : align two sequences.
Maybe you guys know BLAST (basic local alignment search tool) which fits I requirement perfectly. Just wandering is there any easier way to accomplish it.
I believe you will need to play around with string1.intersect(string2);
Correction:
I have lost my head, you need a union, not an intersection. I am a mathematician and I still forgot. string1.Union(string2);
This is waaaay more than a union. BLAST is a complicated algorithm. http://en.wikipedia.org/wiki/BLAST
http://blast.ncbi.nlm.nih.gov/Blast.cgi
Have someone else do it for you.
I guess would will need to represent your sequences with something other than a String
but I cannot suggest a design for such a class and its operators since I do not know anything about the biological stuff.
精彩评论