Only the .pgen is written; you are responsible for writing the companion .pvar (or .bim) and .psam (or .fam) files yourself, with samples in the same order as in the vectors passed to the append functions, and variants in append order. After all variant_ct variants have been appended (with AppendBiallelic(), AppendAlleles(), or AppendDosages()), ClosePgenWriter() must be called to finalize the file.
NewPgenWriter(
filename,
sample_ct,
variant_ct,
nonref_flags = as.logical(c(TRUE)),
allele_ct_limit = 2L,
hardcall_phase_present = FALSE,
dosage_present = FALSE
)A pgen_writer object.
.pgen file path.
Number of samples.
Number of variants that will be written.
TRUE when the data is from an ordinary PLINK 1 .bed file (where the A2 allele is major rather than consistently reference), FALSE when the REF allele is consistently reference, or a logical vector of length variant_ct when this is mixed. NULL is also permitted (this delegates tracking of nonref information to the .pvar file), but it's discouraged since .pgen+.bim+.fam is a useful data representation with direct plink2 support. Defaults to TRUE, as in the Python PgenWriter.
Maximum number of alleles (REF + ALTs) that any variant can have; defaults to 2. Values larger than 2 are only useful with AppendAlleles().
Whether phased hardcalls may be written (with AppendAlleles()). Defaults to FALSE.
Whether dosages may be written (with AppendDosages()). Defaults to FALSE.