I have some data describing sequences of events. There are a number of different events (over 30), and the data records which event occurred in what order. There are no fixed number of events that occur in each sequence, and the same event may occur multiple times in the same sequence. Timing and length of events is irrelevant. This is "Distinct-State-Sequence" data in the language of TraMineR.
So for example, using letters to code for the events, some datapoints may be:
1: ABCDEFG
2: ACDGH
3: BDEFEGI
4: AH
5: DEGHI
My aim is to uncover consistent patterns in the order of events, e.g. trying to find a minimal set of different representative sequences (clustering). However, my hunch is that because the sequences are uneven in length and inconsistent in starting point, that these should be aligned first to be able to be fairly compared, such that the data looks something like this:
1: ABCDEF-G--
2: A-CD---GH-
3: -B-DEFE--I
4: A-------H
5: ---DE--GHI
I've come across the TraMineR package which may well do what I want in general, but it has limited options for alignment (left align, right align, align on a single character).
I'm familiar with DNA/RNA/AA sequence alignment, but even if I can get an alignment algorithm to work with 34-state data, this probably isn't appropriate for non-biological data.
I've also come across alignment methods for text corpora, but since this isn't natural language data this probably isn't appropriate either.
I'm familiar with R in general but more for standard tabular data. I'd appreciate any pointers towards algorithms that I can use to align these sequences - from there on I think I can probably figure out how to do things like distance calculations and clustering.