eseraygun / python-alignment

Native Python library for generic sequence alignment
BSD 3-Clause "New" or "Revised" License
54 stars 14 forks source link

Non recursive impl with indicies #7

Open de-code opened 7 years ago

de-code commented 7 years ago

This isn't ready yet.

I've re-implemented the Smith Waterman algorithm in a non-recursive way. It creates SequenceAlignment only once but still supports multiple alignments. It would probably be good to add a limit if the caller is only interested in one alignment.

The other thing is that it doesn't creates EncodedSequence for the input if the passed in sequence was an EncodedSequence, otherwise it uses Sequence. It would also work if it only creates Sequence - at least all of the tests pass. In fact I am not sure why we need to wrap it in a Sequence object at all. Python's list is fine. And the EncodedSequence can be list like. There isn't much of an advantage using EncodedSequence in the response - the list has already been created. The algorithm works with any sequence. The gap element to use can be passed in.

Indicies are available as _firstindicies and _secondindicies - a list of integers with None for gaps.

Some TODOs:

Anyway, let me know what you think.