neatsort: Neatmap Sorting

View source: R/neatsort.R

neatsortR Documentation

Neatmap Sorting

Description

Sort samples or features based on the neatmap approach.

Usage

neatsort(x, target, method = "NMDS", distance = "bray", first = NULL, ...)

Arguments

x

phyloseq-class object or a matrix

target

For phyloseq-class input, the target is either 'sites' (samples) or 'species' (features) (taxa/OTUs); for matrices, the target is 'rows' or 'cols'.

method

Ordination method. See ordinate from phyloseq package. For matrices, only the NMDS method is available.

distance

Distance method. See ordinate from phyloseq package.

first

Optionally provide the name of the first sample/taxon to start the ordering (the ordering is cyclic so we can start at any point). The choice of the first sample may somewhat affect the overall ordering.

...

Arguments to be passed.

Details

This function borrows elements from the heatmap implementation in the phyloseq package. The row/column sorting is there not available as a separate function at present, however, hindering reuse in other tools. Implemented in the microbiome package to provide an independent method for easy sample/taxon reordering for phyloseq objects.

Value

Vector of ordered elements

References

This function is partially based on code derived from the phyloseq package. 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)
pseq <- peerj32$phyloseq
# For Phyloseq
sort.otu <- neatsort(pseq, target='species')
# For matrix
# sort.rows <- neatsort(abundances(pseq), target='rows')


microbiome/microbiome documentation built on Aug. 22, 2023, 7:12 a.m.