export_mothur_dist: Export a distance object as '.names' and '.dist' files for...

View source: R/IO-methods.R

export_mothur_distR Documentation

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)

joey711/phyloseq documentation built on Nov. 4, 2022, 1:16 a.m.