lmpy.randomize.swap
Module containing Gotelli swap method for randomizing a PAM.
Module Contents
Functions
|
Randomize a PAM matrix using the Gotelli swap method. |
|
Randomize a PAM matrix using the trial swap method. |
- lmpy.randomize.swap.swap_randomize(matrix, num_swaps, max_tries=MAX_TRIES_WITHOUT_SWAP)[source]
Randomize a PAM matrix using the Gotelli swap method.
- Parameters
matrix (Matrix) – A Lifemapper matrix object with binary elements
num_swaps (int) – The number of swaps to perform
max_tries (int) – The maximum number of attempts to swap before failing.
- Returns
A randomized matrix.
- Return type
- Raises
Exception – Raised when the maximum number of tries is reached without swapping.