Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

export_mothur_dist

Export a distance object as .names and .dist files for mothur


Description

The purpose of this function is to allow a user to easily export a distance object as a pair of files that can be immediately imported by mothur for OTU clustering and related analysis. A distance object can be created in R in a number of ways, including via cataloguing the cophentic distances of a tree object.

Usage

export_mothur_dist(x, out=NULL, makeTrivialNamesFile=NULL)

Arguments

x

(Required). A "dist" object, or a symmetric matrix.

out

(Optional). The desired output filename for the .dist file, OR left NULL, the default, in which case the mothur-formated distance table is returned to R standard out.

makeTrivialNamesFile

(Optional). Default NULL. The desired name of the .names file. If left NULL, the file name will be a modified version of the out argument.

Value

A character vector of the different cutoff values contained in the file. For a given set of arguments to the cluster() command from within mothur, a number of OTU-clustering results are returned in the same list file. The exact cutoff values used by mothur can vary depending on the input data. This simple function returns the cutoffs that were actually included in the mothur output. This an important extra step prior to importing the OTUs with the import_mothur_otulist() function.

Examples

#
data(esophagus) 
myDistObject <- as.dist(ape::cophenetic.phylo(phy_tree(esophagus)))
export_mothur_dist(myDistObject)

phyloseq

Handling and analysis of high-throughput microbiome census data

v1.34.0
AGPL-3
Authors
Paul J. McMurdie <joey711@gmail.com>, Susan Holmes <susan@stat.stanford.edu>, with contributions from Gregory Jordan and Scott Chamberlain
Initial release
2019-04-23

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.