Skip to contents

Defines backend-independent ancestry result objects used to normalize ADMIXTURE, fastStructure, and sNMF output. The contract enforces sample identity, Q-matrix dimensions and simplex constraints, replicate uniqueness, fit metrics, runtime, convergence, and provenance.

Usage

new_ancestry_replicate(sample_ids, q, backend, k = ncol(q),
  replicate = 1L, seed = NA_integer_, metrics = numeric(),
  converged = NA, runtime_seconds = NA_real_, provenance = list(),
  tolerance = 1e-06)

validate_ancestry_replicate(x, tolerance = 1e-06)

new_ancestry_result(replicates)

validate_ancestry_result(x)

ancestry_result_table(x)

ancestry_q_table(x)

Arguments

sample_ids

Unique sample identifiers in Q-matrix row order.

q

Numeric ancestry coefficient matrix with one row per sample and one column per inferred cluster.

backend

One of admixture, faststructure, or snmf.

k

Number of inferred clusters.

replicate

Positive replicate identifier.

seed

Integer random seed or NA_integer_.

metrics

Named numeric fit metrics.

converged

Logical convergence status or NA.

runtime_seconds

Nonnegative runtime in seconds or NA_real_.

provenance

Named list containing backend and execution provenance.

tolerance

Allowed absolute deviation of Q-matrix row sums from one.

x

An ancestry replicate or ancestry result object.

replicates

List of canonical ancestry replicate objects.

Value

Constructors return validated S3 objects. Validators return their input invisibly. Table helpers return data.table objects.