utils.read.ped: Reads a PLINK .ped file into a SnpMatrix with family and map...

utils.read.pedR Documentation

Reads a PLINK .ped file into a SnpMatrix with family and map data

Description

WARNING: UTILITY SCRIPTS ARE FOR INTERNAL USE ONLY AND SHOULD NOT BE USED BY END USERS AS THEIR USE OUT OF CONTEXT COULD LEAD TO UNPREDICTABLE OUTCOMES.

Usage

utils.read.ped(
  file,
  snps,
  which,
  split = "\t| +",
  sep = ".",
  na.strings = "0",
  lex.order = FALSE,
  show_warnings = TRUE
)

Arguments

file

Name of the .ped file to read (plain text or gzipped) [required].

snps

Either the name of the associated .map file, or a character vector of locus names (one per locus) [optional; if missing, loci are named locus.1, locus.2, ...].

which

When snps is a map file, the column of that file holding the locus names [optional; defaults to the first column with no duplicates].

split

Regular expression used to split fields on each line [default "\t| +", i.e. tabs and spaces].

sep

Separator used when constructing locus and subject names [default "."].

na.strings

Strings to be treated as missing values. Note that the default treats the conventional PLINK missing-allele code as missing [default "0"].

lex.order

If TRUE, alleles at each locus are reordered lexicographically, and the genotype codes are switched to match [default FALSE].

show_warnings

If FALSE, the warnings for no-data, monomorphic and multi-allelic loci are suppressed. The multi-allelic NA reset is applied regardless [default TRUE].

Details

A vendored, lightly modified copy of snpStats::read.pedfile. The file is read twice: a first pass counts the lines, a second parses each line into the six pedigree columns and the genotype allele pairs. For each locus the first allele encountered in file order becomes allele.1 and the second becomes allele.2; genotypes are coded on that basis (raw SnpMatrix coding; as numeric, the count of allele.2). Loci at which more than two alleles are observed are set entirely to NA. The only in-package caller is gl.report.ld.map.

Value

A list with elements: genotypes (a snpStats::SnpMatrix, individuals x loci), fam (a data frame with pedigree, member, father, mother, sex, affected) and map (a data frame with the locus names and alleles, plus the .map columns when one was supplied).

Author(s)

Custodian: Luis Mijangos (Post to https://groups.google.com/d/forum/dartr)

See Also

Other utilities: gl.He(), gl.Ho(), gl.alf(), utils.allelic.richness(), utils.basic.stats(), utils.check.datatype(), utils.collapse.matrix(), utils.dart2genlight(), utils.dist.binary(), utils.fbm.amat(), utils.fbm.blocks(), utils.fbm.colblocks(), utils.fbm.colwise(), utils.fbm.copy(), utils.fbm.count.mean(), utils.fbm.decode(), utils.fbm.grm(), utils.fbm.has(), utils.fbm.new(), utils.fbm.pair.counts(), utils.fbm.reader(), utils.fbm.rowwise(), utils.fbm.tempfile(), utils.flag.start(), utils.het.pop(), utils.history.call(), utils.is.fixed(), utils.jackknife(), utils.n.var.invariant(), utils.plot.save(), utils.read.fasta(), utils.recalc.avgpic(), utils.recalc.callrate(), utils.recalc.freqhets(), utils.recalc.freqhomref(), utils.recalc.freqhomsnp(), utils.recalc.maf(), utils.reset.flags(), utils.transpose(), utils.vcf.depth(), utils.vcfr2genlight.polyploid()


dartR.base documentation built on Nov. 18, 2026, 9:06 a.m.