build_phytree_pq {MiscMetabar}R Documentation

Build phylogenetic trees from refseq slot of a phyloseq object

Description

[Experimental]

This function build tree phylogenetic tree and if nb_bootstrap is set, it build also the 3 corresponding bootstrapped tree.

Default parameters are based on doi:10.12688/f1000research.8986.2 and phangorn vignette Estimating phylogenetic trees with phangorn. You should understand your data, especially the markers, before using this function.

Note that phylogenetic reconstruction with markers used for metabarcoding are not robust. You must verify the robustness of your phylogenetic tree using taxonomic classification (see vignette Tree visualization) and bootstrap or multi-tree visualization

Usage

build_phytree_pq(
  physeq,
  nb_bootstrap = 0,
  model = "GTR",
  optInv = TRUE,
  optGamma = TRUE,
  rearrangement = "NNI",
  control = phangorn::pml.control(trace = 0),
  optNni = TRUE,
  multicore = FALSE,
  ...
)

Arguments

physeq

(required): a phyloseq-class object obtained using the phyloseq package.

nb_bootstrap

(default 0): If a positive number is set, the function also build 3 bootstrapped trees using nb_bootstrap bootstrap samples

model

allows to choose an amino acid models or nucleotide model, see phangorn::optim.pml() for more details

optInv

Logical value indicating whether topology gets optimized (NNI). See phangorn::optim.pml() for more details

optGamma

Logical value indicating whether gamma rate parameter gets optimized. See phangorn::optim.pml() for more details

rearrangement

type of tree tree rearrangements to perform, one of "NNI", "stochastic" or "ratchet" see phangorn::optim.pml() for more details

control

A list of parameters for controlling the fitting process. see phangorn::optim.pml() for more details

optNni

Logical value indicating whether topology gets optimized (NNI). see phangorn::optim.pml() for more details

multicore

(logical) whether models should estimated in parallel. see phangorn::bootstrap.pml() for more details

...

Other params for be passed on to phangorn::optim.pml() function

Details

This function is mainly a wrapper of the work of others. Please make a reference to phangorn package if you use this function.

Value

A list of phylogenetic tree

Author(s)

Adrien Taudière

Examples



if (requireNamespace("phangorn")) {
  df <- subset_taxa_pq(data_fungi_mini, taxa_sums(data_fungi_mini) > 9000)
  df_tree <- build_phytree_pq(df, nb_bootstrap = 2)
  plot(df_tree$UPGMA)
  phangorn::plotBS(df_tree$UPGMA, df_tree$UPGMA_bs, main = "UPGMA")
  plot(df_tree$NJ, "unrooted")
  plot(df_tree$ML)

  phangorn::plotBS(df_tree$ML$tree, df_tree$ML_bs, p = 20, frame = "circle")
  phangorn::plotBS(
    df_tree$ML$tree,
    df_tree$ML_bs,
    p = 20,
    frame = "circle",
    method = "TBE"
  )
  plot(phangorn::consensusNet(df_tree$ML_bs))
  plot(phangorn::consensusNet(df_tree$NJ_bs))
  ps_tree <- merge_phyloseq(df, df_tree$ML$tree)
}



[Package MiscMetabar version 0.9.1 Index]