Skip to content

Latest commit

 

History

History
121 lines (90 loc) · 3.89 KB

README.md

File metadata and controls

121 lines (90 loc) · 3.89 KB

metaphlanToPhyloseq

GitHub Release License Issues - metaphlanToPhyloseq Made with R Made with R

Overview

metaphlanToPhyloseq is a simple R package to transform MetaPhlAn 4 taxonomic microbiome abundance profiles into the right format for easy creation of a phyloseq object.

Installation

You can install the development version of metaphlanToPhyloseq from GitHub with:

# install.packages("devtools")
devtools::install_github("jrotzetter/metaphlanToPhyloseq", build_vignettes = TRUE)

Alternatively you can also use the pak package:

# install.packages("pak")
pak::pak("jrotzetter/metaphlanToPhyloseq")

Or the remotes package:

# install.packages("remotes")
remotes::install_github("jrotzetter/metaphlanToPhyloseq", build_vignettes = TRUE)

Dependencies

  • dplyr (>= 1.1.4)
  • phyloseq (>= 1.46.0)
  • utils

Usage

library(metaphlanToPhyloseq)

# Filter data to only include the specified taxonomic rank
single_profile <- filter_taxa_lvl(df = single_abundance_profile, taxa_lvl = "Genus")
merged_profiles <- filter_taxa_lvl(df = merged_abundance_profiles, taxa_lvl = "s")

# Keep only the columns of interest (clade_name and relative_abundance)
single_profile <- single_profile[, c(1, 3)]

# Create a phyloseq object
physeq_single <- metaphlan_to_phyloseq(
    mtphlan_profile = single_profile,
    taxa_lvl = "genus",
    use_taxa_names = TRUE,
    merged_profiles = FALSE
)

physeq_merged <- metaphlan_to_phyloseq(
  merged_profiles,
  taxa_lvl = "Species"
)

# Above steps are optional as the filtering to a specific taxonomic rank can be
# done directly from within the function or not at all
physeq <- metaphlan_to_phyloseq(
  merged_abundance_profiles,
  taxa_lvl = NULL,
  use_taxa_names = TRUE
)

For more details please see vignette("metaphlanToPhyloseq") or the help pages in the documentation. Both are also available online at https://jrotzetter.github.io/metaphlanToPhyloseq/.

Planned features

  • Add valid, package-specific maintainer e-mail address
  • Add unit tests
  • Potential CRAN submission after further maturation and expansion of the package (tree support, visualisations) in the future

Getting help

If you encounter a bug, please file an issue with a minimal reproducible example on GitHub. For questions or help with MetaPhlAn, please visit the corresponding bioBakery forum. For help with phyloseq, helpful tutorials and articles can be found on GitHub.

License

Released under MIT by @jrotzetter.

This license means:

  • You can freely copy, modify, distribute and reuse this software.
  • The original license must be included with copies of this software.
  • Please link back to this repo if you use a significant portion of the source code.
  • The software is provided “as is”, without warranty of any kind.