A set of tools for parsing, manipulating, and graphing data classified by a hierarchy (e.g. a taxonomy).
Metacoder is an R package for reading, plotting, and manipulating large taxonomic data sets, like those generated from modern high-throughput sequencing, like metabarcoding (i.e. amplification metagenomics, 16S metagenomics, etc). It provides a tree-based visualization called "heat trees" used to depict statistics for every taxon in a taxonomy using color and size. It also provides various functions to do common tasks in microbiome bioinformatics on data in the
taxmap format defined by the
taxa package, such as:
phyloseqformat and the
This project is available on CRAN and can be installed like so:
You can also install the development version for the newest features, bugs, and bug fixes:
All the documentation for
metacoder can be found on our website here:
The function that simulates PCR requires
primersearch from the EMBOSS tool kit to be installed. This is not an R package, so it is not automatically installed. Type
?primersearch after installing and loading metacoder for installation instructions.
Many of these operations can be done using other packages like
phyloseq, which also provides tools for diversity analysis. The main strength of
metacoder is that its functions use the flexible data types defined by
taxa, which has powerful parsing and subsetting abilities that take into account the hierarchical relationship between taxa and user-defined data. In general,
taxa are more of an abstracted tool kit, whereas
phyloseq has more specialized functions for community diversity data, but they both can do similar things. I encourage you to try both to see which fits your needs and style best. You can also combine the two in a single analysis by converting between the two data types when needed.
If you use metcoder in a publication, please cite our article in PLOS Computational Biology:
Foster ZSL, Sharpton TJ, Grünwald NJ (2017) Metacoder: An R package for visualization and manipulation of community taxonomic diversity data. PLOS Computational Biology 13(2): e1005404. https://doi.org/10.1371/journal.pcbi.1005404
Metacoder is under active development and many new features are planned. Some improvements that are being explored include:
This work is subject to the MIT License.
Metacoder's major dependencies are
This package includes code from the R package ggrepel to handle label overlap avoidance with permission from the author of ggrepel Kamil Slowikowski. We included the code instead of depending on
ggrepel because we are using functions internal to
ggrepel that might change in the future. We thank Kamil Slowikowski for letting us use his code and would like to acknowledge his implementation of the label overlap avoidance used in metacoder.
We would like to hear about users' thoughts on the package and any errors they run into. Please report errors, questions or suggestions on the issues tab of the Metacoder Github site. We also welcome contributions via a Github pull request. You can also talk with us using our Google groups site.
calc_n_sampleswhere the message reported the number of taxa instead of the number of rows in the table.
heat_tree_matrixthat happened when factors were used for treatments (issue #240.
NAs instead of odd error.
NAs instaed of returning
calc_n_samplesso that users can set the minimum threshold for whether a sample is counted or not instead of it always 1.
calc_prop_samplesfunction for calculating the proportion of samples with a value greater than 0 (issues #233.
primersearchis faster and takes less memory by using
calc_taxon_abundabout 5x faster.
taxmapobjects can be converted to
primersearchnow takes and returns a
taxmapobject with results added as tables.
primersearch_rawis a new function that behaves like the old
primersearchdid, returning a table.
datasetoption of many functions has been renamed to
datato match the option name in the
heat_tree_matrixthat happen when the input data is not exactly like that produced by
compare_groups(issues #195, #196, #197).
output_filewas used with
heat_tree_matrix. Now whole plot is saved instead of last subplot. (issue #203)
parse_mothur_tax_summarywhen reading from a file path (issue #211).
use_total = TRUE(issue #227).
parse_phyloseqerror when arbitrary rank names were used.
heat_tree_matrixalways has a 1:1 aspect ratio. (issue #205)
subtaxathat caused an error when all of
FALSE. (issue #143)
filter_taxathat caused an error when all taxa are filtered out. (issue #144)
heat_treenow uses the
taxmapclass defined in the taxa package.
primersearchoutput to be cleaner and have info like the amplicon sequence and primer binding sites.
heat_tree_matrixto make plotting a pairwise matrix of heat trees for comparing treatments.
parse_mothur_tax_summaryfor mothur *.tax.summary file made by classify.seqs.
parse_mothur_taxonomyfor mothur *.taxonomy file made by classify.seqs.
parse_qiime_biomfor the QIIME BIOM output.
parse_phyloseqto convert phyloseq objects.
parse_newickto parse newick files.
parse_unite_generalfor unite general FASTA release. (issue #154)
parse_rdpfor RDP FASTA release. (issue #160)
parse_silva_fastafor SILVA FASTA release. (issue #162)
calc_obs_propsto calculate proportions from observation counts (issue #167
parse_greengenesfor the Greengenes database. (issue #?)
write_greengenesto create an imitation of the Greengenes database format.
write_rdpto create an imitation of the RDP database format.
write_mothur_taxonomyto create an imitation of the mothur taxonomy format.
write_unite_generalto create an imitation of the UNITE general FASTA release.
write_silva_fastato create an imitation of the SILVA FASTA release.
compare_treatmentsto compare multiple samples in multiple treatments, applying a user-defined function.
calc_taxon_abundto sum observation values for each taxon.
calc_taxon_abundto set names of output columns.
evaluation nested too deeply: infinite recursion / options(expressions=)?occurs due to too many labels being printed.
heat_tree: improved how the predicted bondries of text is calcuated, so text with any rotation, justification, or newlines influences margins correctly (i.e. does not get cut off).
heat_tree: Can now save multiple file outputs in different formats at once
heat_treenow gives a warning if infinite values are given to it
extract_taxonomy: There is now a warning message if class regex does not match (issue #123)
heat_tree: Increased lengend text size and reduced number of labels
batch_sizeoption to help deal with invalid IDs better
margin_sizefuncion now takes four values instead of 2.
heat_tree: Fixed bug when color is set explicitly (e.g. "grey") instead of raw numbers and the legend is not removed. Now a mixure of raw numbers and color names can be used.
heat_treethat made values not in the input taxmap object not associate with the right taxa. See this post.
extract_taxonomy: Fixed an error that occured when not all inputs could be classified and sequences were supplied
primersearchthat cased the wrong primer sequence to be returned when primers match in the reverse direction
parse_mothur_summarywhere "unclassified" had got changed to "untaxmap" during a search and replace
mutate_obsthat made replacing columns result in new columns with duplicate names.
plotmethod have been renamed
taxon_levelshave been replaced with
n_supertaxato make names conceptually consistent. Note that this means what was
parse_mothur_summaryfunction: parses the mothur summary table
remove_redundant_namesfunction: removes components of names of taxa in subtaxa