neat {microbiome} | R Documentation

## Neatmap Sorting

### Description

Order matrix or phyloseq OTU table based on the neatmap approach.

### Usage

    neat(
      x,
      arrange = "both",
      method = "NMDS",
      distance = "bray",
      first.feature = NULL,
      first.sample = NULL,
      ...
    )

### Arguments

`x` | A matrix or phyloseq object.
`arrange` | Order 'features', 'samples' or 'both' (for matrices). For matrices, it is assumed that the samples are on the columns and features are on the rows. For phyloseq objects, features are the taxa of the OTU table.
`method` | Ordination method. Only NMDS implemented for now.
`distance` | Distance method. See `vegdist` function from the vegan package.
`first.feature` | Optionally provide the name of the first feature to start the ordering
`first.sample` | Optionally provide the name of the first sample to start the ordering
`...` | Arguments to pass.

### Details

Borrows elements from the heatmap implementation in the phyloseq package. The row/column sorting is not available there as a separate function. Therefore I implemented this function to provide an independent method for easy sample/taxon reordering for phyloseq objects. The ordering is cyclic so we can start at any point. The choice of the first sample may somewhat affect the overall ordering

### Value

Sorted matrix

### References

This function is partially based on code derived from the phyloseq package. However for the original neatmap approach for heatmap sorting, see (and cite): Rajaram, S., & Oono, Y. (2010). NeatMap–non-clustering heat map alternatives in R. BMC Bioinformatics, 11, 45.

### Examples

    data(peerj32)
    # Take subset to speed up example
    x <- peerj32$microbes[1:10,1:10]
    xo <- neat(x, 'both', method='NMDS', distance='bray')

[Package microbiome version 1.12.0 Index]