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

Note

Deprecated as of 0.5.0 for removal in 0.5.1. 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:

metric : str 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.

counts : 2D array_like of ints or floats

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

ids : iterable of strs

Identifiers for each sample in counts.

id_pairs : iterable 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.

validate : bool, optional

See skbio.diversity.beta_diversity for details.

kwargs : kwargs, 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.