skbio.sequence.SubstitutionMatrix.filter#

SubstitutionMatrix.filter(ids, strict=True)[source]#

Filter the dissimilarity matrix by IDs.

Parameters:
idsiterable of str

IDs to retain. May not contain duplicates or be empty. Each ID must be present in the dissimilarity matrix.

strictbool, optional

If strict is True and an ID that is not found in the distance matrix is found in ids, a MissingIDError exception will be raised, otherwise the ID will be ignored.

Returns:
DissimilarityMatrix

Filtered dissimilarity matrix containing only the IDs specified in ids. IDs will be in the same order as they appear in ids.

Raises:
MissingIDError

If an ID in ids is not in the object’s list of IDs.