Plink
Import PLINK files as PopData
plink(infile::String; keepfields::Symbol|Vector{Symbol}, silent::Bool)
Read a PLINK .ped or binary .bed file into memory as a PopData object.
Requires an accompanying .fam file in the same directory, but an accompanying .bim file is optional.
infile::String: path to.pedor.bedfile
Keyword Arguments
famfields::Symbol|Vector{Symbol}: which additional fields to import from the.famfile:all(default):none- any one or combination of
[:sire, :dam, :sex, :phenotype]
bimfields::Symbol|Vector{Symbol}: which additional fields to import from the optional.bimfile:all(default):none- any one or combination of
[:chromosome, :cm, :bp]
silent::Bool: whether to print file information during import (default:false)
Example
# assumes there is parakeet.ped + parakeet.fam in same directory
julia> parakeet = plink("datadir/parakeet.ped", famfields = :sex)
# assumes there is parrot.ped + parrot.fam in same directory
julia> parrot = plink("datadir/parrot.bed", famfields = [:sire, :dam], bimfields = :chromosome)
Write PopData to PLINK format
plink(data::PopData; filename::String)
Write a biallelic PopData object to PLINK .ped format with an accompanying
.fam file. Genotypes are coded by the PLINK standard:
- Integers are the alleles
0encodes missing- After column 6, every two numbers indicate a diploid genotype such that:
00Homozygous for first allele01Missing genotype10Heterozygous11Homozygous for second allele
Example
julia> sharks = dropmultiallelic(@gulfsharks) ;
julia> plink(sharks, filename = "biallelic_sharks.ped")