Learn R Programming

pgenlibr (version 0.7.0)

AppendAlleles: Appends a hardcall variant, specified as allele codes, to a .pgen being written. Unlike AppendBiallelic(), this supports phased and multiallelic hardcalls.

Description

Appends a hardcall variant, specified as allele codes, to a .pgen being written. Unlike AppendBiallelic(), this supports phased and multiallelic hardcalls.

Usage

AppendAlleles(
  pgen_writer,
  acbuf,
  phasepresent = NULL,
  all_phased = FALSE,
  allele_ct = NULL
)

Value

No return value, called for side-effect.

Arguments

pgen_writer

Object returned by NewPgenWriter().

acbuf

Integer or numeric matrix with 2 rows and sample_ct columns, in the format filled by ReadAlleles(): 0 corresponds to the REF allele, 1 to the first ALT, 2 to the second ALT, etc., and a missing hardcall is represented by a pair of NA (or -9) codes. For a phased heterozygous call, the first row holds the allele on the first haplotype; unphased heterozygous calls can be stored in either order.

phasepresent

Logical vector of length sample_ct indicating which calls are phased; entries for non-heterozygous calls are ignored. Optional. (A buffer filled by ReadAlleles() is in this format.) Requires hardcall_phase_present = TRUE in the NewPgenWriter() call.

all_phased

Whether to treat all calls as phased; defaults to FALSE. Cannot be combined with phasepresent, and requires hardcall_phase_present = TRUE in the NewPgenWriter() call. If neither phasepresent nor all_phased is specified, all calls are unphased.

allele_ct

Number of alleles (REF + ALTs) for this variant. Optional; by default, this is inferred to be max(2, 1 + <max observed allele code>). It must be specified when the last ALT allele in the .pvar is unobserved.