skbio.diversity.partial_beta_diversity#
- skbio.diversity.partial_beta_diversity(metric, counts, ids, id_pairs, validate=True, **kwargs)[source]#
Compute distances only between specified ID pairs.
Deprecated since version 0.5.0: The return type is unstable. Developer caution is advised. The resulting DistanceMatrix object will include zeros when distance has not been calculated, and therefore can be misleading.
- Parameters:
- metricstr or callable
The beta diversity metric to apply to the samples. See
beta_diversityfor details.- countstable_like of shape (n_samples, n_taxa)
Matrix containing count/abundance data of the samples. See supported formats.
- idsiterable of strs
Identifiers for each sample in
counts.- id_pairsiterable of tuple of (str, str)
Pairs of sample IDs to compare (e.g.,
[('a', 'b'), ('a', 'c'), ...]). If specified, the they must be a subset ofids.- validatebool, optional
Validate the input data. See
beta_diversityfor details.- kwargsdict, optional
Metric-specific parameters. See
beta_diversityfor details.
- Returns:
DistanceMatrixDistances between pairs of samples indicated by
id_pairs. Pairwise distances not defined by id_pairs will be 0.0. Use this resulting DistanceMatrix with caution as 0.0 is a valid distance.
- Raises:
- ValueError
If
idsare not specified. Ifid_pairsare not a subset ofids. Ifmetricis not a callable or is unresolvable string by scikit-bio. If duplicates are observed inid_pairs.
See also