<commit_before>---
name: Rarefy, compute pairwise distances, and apply ordination
type-imports:
    - feature_table.artifact_types:FeatureTable
    - feature_table.artifact_types:Frequency
    - diversity.artifact_types:DistanceMatrix
    - diversity.artifact_types:Phylogeny
    - diversity.artifact_types:PCoAResults
    - qiime.plugin:Str
    - qiime.plugin:Int
inputs:
    feature_table: FeatureTable[Frequency]
    phylogeny: Phylogeny
    metric: Str
    depth: Int
outputs:
    - distance_matrix: DistanceMatrix
    - pcoa_results: PCoAResults
---
## Compute PCoA results from a feature table

This workflow rarefies a feature table to an even sampling depth, computes all
pairwise distances using the provided distance metric, and applies principal
coordinate analysis.

### Rarefy feature table

```python
>>> from feature_table import rarefy
>>> rarefied_table = rarefy(feature_table, depth=depth)
```

### Compute pairwise distances

```python
>>> from diversity import beta_diversity
>>> distance_matrix = beta_diversity(metric, rarefied_table, phylogeny=phylogeny)
```

### Apply principal coordinate analysis

```python
>>> import skbio.stats.ordination
>>> pcoa_results = skbio.stats.ordination.pcoa(distance_matrix)
```

This is not how visualizations will be handled in QIIME 2 (track progress in
[#21](https://github.com/biocore/qiime2/issues/21)), but just an illustration
that the PCoA results computed here are reasonable:

```python
>>> %matplotlib inline
>>> pcoa_results
```<commit_msg>MAINT: removes plotting<commit_after>---
name: Rarefy, compute pairwise distances, and apply ordination
type-imports:
    - feature_table.artifact_types:FeatureTable
    - feature_table.artifact_types:Frequency
    - diversity.artifact_types:DistanceMatrix
    - diversity.artifact_types:Phylogeny
    - diversity.artifact_types:PCoAResults
    - qiime.plugin:Str
    - qiime.plugin:Int
inputs:
    feature_table: FeatureTable[Frequency]
    phylogeny: Phylogeny
    metric: Str
    depth: Int
outputs:
    - distance_matrix: DistanceMatrix
    - pcoa_results: PCoAResults
---
## Compute PCoA results from a feature table

This workflow rarefies a feature table to an even sampling depth, computes all
pairwise distances using the provided distance metric, and applies principal
coordinate analysis.

### Rarefy feature table

```python
>>> from feature_table import rarefy
>>> rarefied_table = rarefy(feature_table, depth=depth)
```

### Compute pairwise distances

```python
>>> from diversity import beta_diversity
>>> distance_matrix = beta_diversity(metric, rarefied_table, phylogeny=phylogeny)
```

### Apply principal coordinate analysis

```python
>>> import skbio.stats.ordination
>>> pcoa_results = skbio.stats.ordination.pcoa(distance_matrix)
```
{'fraction_non_alphanumeric': 0.09504878930249368, 'fraction_numerical': 0.0021684134441633538, 'mean_word_length': 4.991341991341991, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 45, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1779104', 'n_tokens_mistral': 863, 'n_tokens_neox': 797, 'n_words': 223}