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_diversity for 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 of ids.

validatebool, optional

Validate the input data. See beta_diversity for details.

kwargsdict, optional

Metric-specific parameters. See beta_diversity for details.

Returns:
DistanceMatrix

Distances 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 ids are not specified. If id_pairs are not a subset of ids. If metric is not a callable or is unresolvable string by scikit-bio. If duplicates are observed in id_pairs.