Skip to contents

Reads packed BED one marker at a time and returns or streams pool-by-marker frequencies. DNA and phenotype weights are normalized separately. This is a simulation observation model, not a fitted bias correction or predictor.

Usage

gsim_pool(
  genotypes,
  contributions,
  records,
  markers = NULL,
  allele_consumer = NULL,
  chunk_size = 64L,
  assay_depth = 0L,
  seed = 1
)

Arguments

genotypes

BED prefix, BED manifest or gsim_cohort.

contributions

Data frame with pool, animal, record, and optional nonnegative dna_weight, phenotype_weight (default one). Each pool/record pair must be unique. Repeated animals across records are allowed; DNA weights then add across those contributions.

records

A gsim_records() object, supplying observable records and its noise descriptor. Genetic truth is never used to form pooled summaries.

markers

Optional unique BIM marker IDs, in desired order.

allele_consumer

Optional function called with each frequency matrix chunk. With a consumer, the full frequency matrix is not retained.

chunk_size

Marker count per chunk, between 1 and 64.

assay_depth

Zero for exact allele frequencies; positive integer for independent binomial read-count measurement per pool and marker. This model does not include extraction bias or read correlation.

seed

Nonnegative integer-valued assay seed.

Value

gsim_pools containing frequencies (or NULL), weighted phenotypes, measurement-noise variances, normalized contributions and a covariance query descriptor. Matching weights are diagnosed over animals within each pool. Matching weights alone cannot establish a common genetic design across different traits, visits or fixed effects. Assay error has variance p(1-p)/depth conditional on the true frequency; it is separate from the phenotype covariance. Callback side effects are caller-owned. assay_variance reports conditional frequency measurement variance using simulated true frequencies; streamed chunks carry it as an attribute.