scikit-bio is back in active development! Check out our announcement of revitalization.

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.

Parameters:
metricstr or callable

The pairwise distance function to apply. If metric is a string, it must be resolvable by scikit-bio (e.g., UniFrac methods), or must be callable.

counts2D array_like of ints or floats

Matrix containing count/abundance data where each row contains counts of taxa in a given sample.

idsiterable of strs

Identifiers for each sample in counts.

id_pairsiterable of tuple

An iterable of tuples of IDs to compare (e.g., [('a', 'b'), ('a', 'c'), ...]). If specified, the set of IDs described must be a subset of ids.

validatebool, optional

See skbio.diversity.beta_diversity for details.

kwargskwargs, optional

Metric-specific parameters.

Returns:
skbio.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.

Warning

partial_beta_diversity is deprecated as of 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.