Merging matching slices of an unknown string

Viewed 45

I am solving an enigma and I have several slices of a big, numeric string. Initially they seemed to be random, but through some frequency analysis I learned that they are all slices of a big string.

The problem is these slices may contain separate parts of the big string but do not contain information about where they are located, and may contain even separate substrings. E.g.:

text: 0102030405060708091011121314151617181920
slice 1: 010203041516171819
slice 2: 030405060717181920
slice 3: 060708091011121314
slice 4: 040506071213141516

Notice how by sliding the slices I can rebuild the original text:

slice 1: 01020304                    1516171819
slice 2:     0304050607                  17181920
slice 3:           060708091011121314
slice 4:       04050607        1213141516

Since the original text might be hundreds or even thousands of digits, doing it manually is very hard and time consuming. I have a collection of 80 slices and they should produce a merged string that is the original text, which I do not have.

I searched for some string matching algorithms, such as longest common substring, but they do not cover splitting the slices to try and match. Also diff algorithms generally don't support merging multiple strings at once and two slices contain too little in common for this to be useful, usually giving false matches that down the road fail.

1 Answers

I would comment if I had the reputation, but this problem looks analogous to assembling a genome from a large number of small, sequenced fragments. Not sure what the latest technology is but De Brujin graphs is how I was taught to do that.

This question (about genome assembly - but again maybe applicable) might help: http://rosalind.info/problems/grep/

And the subset of questions from Rosalind about De Brujin graphs http://rosalind.info/search/?q=%20bruijn

Related