neatsort: Neatmap Sorting

Description Usage Arguments Details Value References Examples

View source: R/neatsort.R

Description

Sort samples or features based on the neatmap approach.

Usage

1
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

1
2
3
4
5
6
data(peerj32)
pseq <- peerj32$phyloseq
# For Phyloseq
sort.otu <- neatsort(pseq, target='species')
# For matrix
# sort.rows <- neatsort(abundances(pseq), target='rows')

microbiome documentation built on Nov. 8, 2020, 5:08 p.m.