freq: Compute marker allele frequencies

ghap.freqR Documentation

Compute marker allele frequencies

Description

This function takes a GHap.phase object and computes the allele frequency for each marker.

Usage

  ghap.freq(object, type = "maf",
            only.active.samples = TRUE,
            only.active.markers = TRUE,
            ncores = 1, verbose = TRUE)

Arguments

object

A GHap object of type phase or plink.

type

A character value indicating which allele frequency to compute. Valid options are minor allele frequency ('maf', default), frequency of allele 0 ('A0') and frequency of allele 1 ('A1').

only.active.samples

A logical value specifying whether only active samples should be used for calculations (default = TRUE).

only.active.markers

A logical value specifying whether only active markers should be included in the output (default = TRUE).

ncores

A numeric value specifying the number of cores to be used in parallel computing (default = 1).

verbose

A logical value specfying whether log messages should be printed (default = TRUE).

Value

The function outputs a numeric vector of the same length of active markers containing allele frequencies based on the active samples.

Author(s)

Yuri Tani Utsunomiya <ytutsunomiya@gmail.com>
Marco Milanesi <marco.milanesi.mm@gmail.com>

Examples

  
# #### DO NOT RUN IF NOT NECESSARY ###
# 
# # Copy phase data in the current working directory
# exfiles <- ghap.makefile(dataset = "example",
#                          format = "phase",
#                          verbose = TRUE)
# file.copy(from = exfiles, to = "./")
# 
# # Copy plink data in the current working directory
# exfiles <- ghap.makefile(dataset = "example",
#                          format = "plink",
#                          verbose = TRUE)
# file.copy(from = exfiles, to = "./")
# 
# ### RUN ###
# 
# # Calculate allele frequency for phase data
# phase <- ghap.loadphase("example")
# q <- ghap.freq(phase, type = 'A0')
# p <- ghap.freq(phase, type = 'A1')
# maf <- ghap.freq(phase, type = 'maf')
# 
# # Calculate allele frequency for plink data
# plink <- ghap.loadplink("example")
# q <- ghap.freq(plink, type = 'A0')
# p <- ghap.freq(plink, type = 'A1')
# maf <- ghap.freq(plink, type = 'maf')


GHap documentation built on July 2, 2022, 1:07 a.m.