utils.ped2plink: Reads a PLINK .ped fileset with PLINK allele orientation

View source: R/utils.ped2plink.r

utils.ped2plinkR Documentation

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.ped2plink(ped, map = NULL)

Arguments

ped

Path to the .ped file [required].

map

Path to the matching .map file, or NULL when there is none. Without a .map, loci are named locus.1, locus.2, ... and chromosome and position are set to NA [default NULL].

Details

Reads a PLINK text fileset (.ped, optionally with a .map) in R with utils.read.ped, with no PLINK executable required, and returns the same three components as snpStats::read.plink() so that gl.read.PLINK can treat text and binary input identically.

utils.read.ped codes alleles in order of first appearance in the file. PLINK 1.x instead makes the minor allele A1 and the major allele A2, and on a tie the first-encountered allele becomes A2. Alleles are switched here per locus to match that rule, so the genotype dosage (count of allele.2) is the same as that obtained from a .bed fileset written by plink --make-bed from the same .ped. Loci are kept in file order, whereas plink --make-bed sorts them by chromosome and position, so the two can differ in locus order. PLINK's chromosome code 0 (unmapped) is returned as NA, as snpStats::read.plink does for a .bim.

Value

A list with genotypes (a SnpMatrix), fam (a data.frame with pedigree, member, father, mother, sex, affected) and map (a data.frame with chromosome, snp.name, cM, position, allele.1, allele.2, one row per locus, row names = snp.name).

Author(s)

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


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