best_baps_partition: best_baps_partition

View source: R/best_baps_partition.R

best_baps_partitionR Documentation

best_baps_partition

Description

Function to combine smaller clusters from a fast hierarchical algorithm to maximise the BAPS likelihood.

Usage

best_baps_partition(sparse.data, h, quiet = FALSE)

Arguments

sparse.data

a sparse SNP data object returned from import_fasta_sparse_nt

h

a hclust object representing the hierarchical clustering that is to be cut

quiet

suppress the printing of extra information (default=FALSE)

Value

a final clustering

Examples


fasta.file.name <- system.file("extdata", "seqs.fa", package = "fastbaps")
sparse.data <- import_fasta_sparse_nt(fasta.file.name)
d <- snp_dist(sparse.data)
d <- as.dist(d/max(d))
h <- hclust(d, method="ward.D2")
partition <- best_baps_partition(sparse.data, h)

newick.file.name <- system.file("extdata", "seqs.fa.treefile", package = "fastbaps")
iqtree <- phytools::read.newick(newick.file.name)
h <- phytools::midpoint.root(iqtree)
best.partition <- best_baps_partition(sparse.data, h)


gtonkinhill/fastbaps documentation built on Sept. 25, 2022, 1:56 p.m.