panstripe: panstripe

View source: R/panstripe.R

panstripeR Documentation

panstripe

Description

Fits a Tweedie distribution to the inferred gene gain and loss events along each branch of a given phylogeny. Includes covariates to control for the impact of annotation errors and the depth of ancestral branches.

Usage

panstripe(
  pa,
  tree,
  asr_method = "max.parsimony",
  min_depth = NULL,
  family = "Tweedie",
  intercept = FALSE,
  fit_method = "glm",
  ci_type = "perc",
  nboot = 1000,
  boot_type = "branch",
  conf = 0.95,
  boot_pvalue = FALSE,
  return_anc_states = FALSE,
  quiet = FALSE
)

Arguments

pa

a binary gene presence/absence matrix with genes as columns and genomes as rows. The rownames should match the tip.labels of the corresponding phylogeny.

tree

a core gene phylogeny of class phylo

asr_method

method used to perform ancestral state reconstruction. Can be either 'max.parsimony' (default), 'max.likelihood', or 'stochastic.map'

min_depth

the minimum depth of a branch to be included in the regression. All branches are included by default.

family

the family used by glm. One of 'Tweedie', 'Poisson', 'Gamma' or 'Gaussian'. (default='Tweedie')

intercept

whether or not to include an intercept term in the GLM (default=FALSE). Adding an intercept can increase the robustness of the algorithm to errors at higher branches of the phylogeny at the expense of less sensitivity.

fit_method

the method used to fit the GLM. Can be either 'glm' (default) which uses base R and the 'tweedie' package or 'glmmTMB' which uses Template Model Builder.

ci_type

the method used to calculate the bootstrap CI (default='perc'). See boot.ci for more details.

nboot

the number of bootstrap replicates to perform (default=100)

boot_type

whether to resample by 'branch', the default, or by 'gene'

conf

A scalar indicating the confidence level of the required intervals (default=0.95).

boot_pvalue

whether or not to calculate bootstrap p-values (default=FALSE)

return_anc_states

return the calculated branch level ancestral state matrix

quiet

whether to print progress information (default=FALSE)

Value

a panfit object with the resulting parameter estimates and bootstrap replicates

Examples


sim <- simulate_pan(rate=5e-4, mean_trans_size=3, fn_error_rate=2, fp_error_rate=2)
pa <- sim$pa
tree <- sim$tree
nboot <- 100
family <- 'Tweedie'
ci_type='perc'
boot_type='branch'
conf=0.95
asr_method="stochastic.map"
res <- panstripe(sim$pa, sim$tree, nboot=100)
res$summary
res <- panstripe(sim$pa, sim$tree, nboot=100, fit_method='glmmTMB', family='gaussian')
res$summary


gtonkinhill/panstripe documentation built on Feb. 27, 2025, 9:01 p.m.