build_phytree_pq {MiscMetabar} | R Documentation |
Build phylogenetic trees from refseq slot of a phyloseq object
Description
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 |
nb_bootstrap |
(default 0): If a positive number is set,
the function also build 3 bootstrapped trees using |
model |
allows to choose an amino acid models or nucleotide model,
see |
optInv |
Logical value indicating whether topology gets optimized
(NNI). See |
optGamma |
Logical value indicating whether gamma rate parameter gets
optimized. See |
rearrangement |
type of tree tree rearrangements to perform, one of
"NNI", "stochastic" or "ratchet"
see |
control |
A list of parameters for controlling the fitting process.
see |
optNni |
Logical value indicating whether topology gets optimized (NNI).
see |
multicore |
(logical) whether models should estimated in parallel.
see |
... |
Other params for be passed on to
|
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)
}