metacoder v0.1.3


Monthly downloads



Tools for Parsing, Manipulating, and Graphing Hierarchical Data

A set of tools for parsing, manipulating, and graphing data classified by a hierarchy (e.g. a taxonomy).


Build Status Downloads from Rstudio mirror per month Downloads from Rstudio mirror CRAN version

An R package for metabarcoding research planning and analysis

Metabarcoding is revolutionizing microbial ecology and presenting new challenges:

  • Numerous database formats make taxonomic data difficult to parse, combine, and subset.
  • Stacked bar charts, commonly used to depict community diversity, lack taxonomic context.
  • Barcode loci and primers are a source of under-explored bias.

Metacoder is an R package that attempts to addresses these issues:

  • Sources of taxonomic data can be extracted from most file formats and manipulated.
  • Community diversity can be visualized by color and size in a tree plot.
  • Primer specificity can be estimated with in silico PCR.


Documentation is available at

Download the current version

Stable releases are available on CRAN and can be installed in the standard way:


The most recent version can be installed from Github:



The function that runs in silico 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 MetcodeR for installation instructions.


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.


This work is subject to the MIT License.

Functions in metacoder

Name Description
arrange_taxa Sort columns of taxmap objects
class_from_class Parse embedded classifications
class_from_name Retrieve classifications from taxon names
bryophytes_ex_data Example dataset of bryophytes
class_to_taxonomy List of classifications to taxonomy tree
contains dplyr select_helpers
genbank_ex_data Fungal ITS Genbank refseq
count_capture_groups Count capture groups
delete_vetices_and_children delete_vetices_and_children
%>% magrittr forward-pipe operator
heat_tree Plot a taxonomic tree
line_coords Makes coordinates for a line
make_new_ids Generate new unique IDs
n_obs Count observations in taxmap
n_obs_1 Count observation assigned in taxmap
postDrawDetails.resizingTextGrob Clean up after the drawing.
pr2_ex_data Example of PR2 SSU data
get_class_from_el Get classification for taxa in edge list
get_node_children get_node_children
get_numerics Return numeric values in a character
split_by_level Splits a taxonomy at a specific level or rank
text_grob_length Estimate text grob length
transform_data Transformation functions
verify_color_range Verify color range parameters
verify_label_count Verify label count
rdp_ex_data Example of RDP Archea data
read_fasta Read a FASTA file
roots Get root taxa
run_primersearch Execute EMBOSS Primerseach
silva_ex_data Example dataset from SILVA
label_bounds Bounding box coords for labels
layout_functions Layout functions
map_unique Run a function on unique values of a iterable
matches dplyr select_helpers
n_supertaxa Get number of supertaxa
ncbi_sequence Downloads sequences from ids
taxmap Create an instance of taxmap
taxon_data Return taxon data from taxmap
transmute_obs Replace columns in taxmap objects
transmute_taxa Replace columns in taxmap objects
unite_ex_data_2 Example of UNITE fungal ITS data
unite_ex_data_3 Example of UNITE fungal ITS data
get_edge_children get_edge_children
get_edge_parents get_edge_parents
hierarchies Get classification of taxa
inter_circle_gap Finds the gap/overlap of circle coordinates
metacoder Metacoder
molten_dist Get all distances between points
sample_frac_obs Sample a proportion of observations from taxmap
sample_frac_taxa Sample a proportion of taxa from taxmap
select_obs Subset columns in a taxmap object
select_taxa Subset columns in a taxmap object
validate_regex_key_pair Check a regex-key pair
validate_regex_match Check that all match input
apply_color_scale Covert numbers to colors
arrange_obs Sort columns of taxmap objects
contaminants Example dataset of contamination
convert_numeric_cols Convert columns to numeric if appropriate
filter_taxa Filter taxa with a list of conditions
format_taxon_subset Format taxon subset value
make_plot_legend Make color/size legend
make_text_grobs Create a list of text grobs
one_of dplyr select_helpers
parse_hmp_qiime Parse HMP QIIME results
parse_summary_seqs Parse summary.seqs output
parse_taxonomy_table Parse taxonomic data in a tsv/csv file
primersearch_is_installed Test if primersearch is installed
print.taxmap Print a taxmap object
scale_bar_coords Make scale bar division
select_labels Pick labels to show
subtaxa Get all subtaxa of a taxon
supertaxa Get all supertaxa of a taxon
taxonomic_sample Recursivly sample a set of taxonomic assignments
taxonomy_ranks Get ordered ranks from taxonomy
diverging_palette The default diverging color palette
drawDetails.resizingTextGrob Draws a resizingTextGrob
everything dplyr select_helpers
extract_taxonomy Extract taxonomy information from sequence headers
ncbi_taxon_sample Download representative sequences for a taxon
num_range dplyr select_helpers
plot_alignment Display sequence alignment
polygon_coords Makes coordinates for a regualr polygon
qualitative_palette The default qualitative color palette
quantative_palette The default quantative color palette
can_be_num Test if characters can be converted to numbers
check_element_length Check length of graph attributes
class_from_obs_id Retrieve classifications from observation IDs
class_from_taxon_id Retrieve classifications from taxon IDs
fasta_headers Get line numbers of FASTA headers
filter_obs Filter observations with a list of conditions
get_id_from_name Get taxon ID from name
get_name_from_id Get taxon name from ID
preDrawDetails.resizingTextGrob Adjusts text size to viewport
primersearch Use EMBOSS primersearch for in silico PCR
read_lines_apply Apply a function to chunks of a file
recursive_sample Recursivly sample observations with a heirarchical classification
rescale Rescale numeric vector to have specified minimum and maximum.
resizingTextGrob Adds text grob that scales with viewport size
unique_mapping get indexes of a unique set of the input
unite_ex_data_1 Example of UNITE fungal ITS data
verify_trans Verify transformation function parameters
vigilant_report Report a error/warning if needed
n_subtaxa_1 Get number of subtaxa
obs Get observations associated with taxa
obs_data Return observation data from taxmap
remove_redundant_names Remove the redundant taxon names
inverse Generate the inverse of a function
its1_ex_data Example of ITS1 fungal data
n_subtaxa Get number of subtaxa
rename_duplicated Number duplicated names
sample_n_obs Sample n observations from taxmap
DNAbin_to_char Converts DNAbin to a named character vector
sample_n_taxa Sample n taxa from taxmap
add_alpha add_alpha
verify_size Verify size parameters
verify_size_range Verify size range parameters
edge_list_depth Get distance from root of edgelist observations
ends_with dplyr select_helpers
get_optimal_range Find optimal range
get_taxonomy_levels Get taxonomy levels
parse_mothur_summary Parse mothur classification summary file
parse_primersearch Parse EMBOSS primersearch output
mutate_obs Add columns to taxmap objects
mutate_taxa Add columns to taxmap objects
obs_data_colnames Get column names of obs_data
obs_data_cols_used Get names of obs_data in an unevaluated expression
split_class_list Split a list of classifications by a row/column value
taxon_data_colnames Get column names of taxon_data
taxon_data_cols_used Get names of taxon_data in an unevaluated expression
starts_with dplyr select_helpers
No Results!

Vignettes of metacoder

No Results!

Last month downloads


License GPL-2 | GPL-3
LazyData true
VignetteBuilder knitr
RoxygenNote 6.0.1
Date 2017-05-22
Encoding UTF-8
NeedsCompilation no
Packaged 2017-05-23 05:26:16 UTC; fosterz
Repository CRAN
Date/Publication 2017-05-23 05:36:48 UTC

Include our badge in your README