one2one_f: Maximum number of unique one-to-one association over a number...

View source: R/one2one_f.R

one2one_fR Documentation

Maximum number of unique one-to-one association over a number of runs

Description

For a binary matrix of host-symbiont associations, it finds the maximum number of host-symbiont pairs, n, for which one-to-one unique associations can be chosen.

Usage

one2one_f(
  HS,
  reps = 10000,
  interval = NULL,
  strat = "sequential",
  cl = 1,
  plot = TRUE
)

Arguments

HS

Host-symbiont association matrix.

reps

Number of runs to evaluate.

interval

Vector with the minimum and maximum n that the user wants to test. Default is "NULL", where a minimum n (10% of the total associations) and a maximum n (20% of the total associations) are automatically assigned.

strat

Flag indicating whether execution is to be "sequential" or "parallel". Default is "sequential", resolves R expressions sequentially in the current R process. If "parallel" resolves R expressions in parallel in separate R sessions running in the background.

cl

Number of cluster to be used for parallel computing. parallelly::availableCores() returns the number of clusters available. Default is cl = 1 resulting in "sequential" execution.

plot

Default is "TRUE", plots the number of unique host- symbiont associations in the "interval" range against the number of runs that could be completed.

Value

The maximum number of unique one-to-one associations (n).

NOTE

It can be used to decide the best n prior to application of max_cong().

Examples


N = 10  #for the example, we recommend 1e+4 value
data(amph_trem)
n <- one2one_f(am_matrix, reps = N, interval = c(2, 10), plot = TRUE)



Rtapas documentation built on June 22, 2024, 10:47 a.m.