openalea.phenomenal.tracking.alignment.needleman_wunsch

openalea.phenomenal.tracking.alignment.needleman_wunsch(X, Y, gap, gap_extremity_factor=1.0)[source]

Performs pairwise alignment of profiles X and Y with Needleman-Wunsch algorithm. A profile is defined as an array of one or more sequences of the same length. Each sequence includes one or several vectors of the same length, and might contain gaps (vectors filled with NaN) Source code : https://gist.github.com/slowkow/06c6dba9180d013dfd82bec217d22eb5 The source code was modified to correct a few errors, and adapted to fit all requirements (extremity gap, customized scoring function, etc.)

Parameters:
  • X (array of shape (profile length, sequence length, vector length)) – profile 1

  • Y (array of shape (profile length, sequence length, vector length)) – profile 2

  • gap (float) – gap penalty parameter

  • gap_extremity_factor (float) – optional factor to increase/decrease gap penalty on sequence extremities

Return type:

(list, list)