Commenting

A more pythonic Needleman-Wunsch is possible. While loops can be
replaced with simple if statements.
Count the number of calls to the Needleman-Wunsch function
Simplify the Needleman-Wunsch function

Only keep the final score value, do not perform the backtracing step.
Set matrix as a global parameter

To avoid a definition of the matrix each time the Needleman-Wunsch
function is called, it is defined as a global variable.

Commenting is improved, an unnecessary call to abs() is removed, the
default threshold value is set to 7.
Temporary deactivation of filterings
Insert back the substitution matrix in the Needleman-Wunsch function

It modifies the swarming results. I do not understand why.
Simpler max_length_difference computation
Add a TO DO list
Important clarification of the code