Skip to main content
`Ctrl`+`K`

# skbio.diversity.partial_beta_diversity

skbio.diversity.partial_beta_diversity(metric, counts, ids, id_pairs, validate=True, **kwargs)

  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:
    metric str or callable

      The beta diversity metric to apply to the samples. See `beta_diversity` for details.

    counts table_like of shape (n_samples, n_taxa)

      Matrix containing count/abundance data of the samples. See supported formats.

    ids iterable of strs

      Identifiers for each sample in `counts`.

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

    validate bool, optional

      Validate the input data. See `beta_diversity` for details.

    kwargs dict, 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`.

  See also

  `beta_diversity`
  `get_beta_diversity_metrics`