skbio.stats.distance.PairwiseMatrix.filter#
- PairwiseMatrix.filter(ids, strict=True)[source]#
Filter the matrix by IDs.
- Parameters:
- idssequence of str
IDs to retain. May not contain duplicates or be empty. Each ID must be present in the matrix.
- strictbool, optional
If True (default) and an ID that is not found in the distance matrix but is found in
ids, aMissingIDErrorexception will be raised, otherwise the ID will be ignored.
- Returns:
- PairwiseMatrix
Filtered matrix containing only the IDs specified in
ids. IDs will be in the same order as they appear inids.
- Raises:
- MissingIDError
If an ID in
idsis not in the object’s list of IDs.
Notes
This function uses parallel computation for improved performance. See the parallelization guide for information on controlling the number of threads used.