开发者

String match problem [closed]

It's difficult to tell what is being asked 开发者_JS百科here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜