ghap.freq | R Documentation |
This function takes a GHap.phase object and computes the allele frequency for each marker.
ghap.freq(object, type = "maf",
batchsize = NULL,
only.active.samples = TRUE,
only.active.variants = TRUE,
verbose = TRUE)
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'). |
batchsize |
A numeric value controlling the number of variants to be processed at a time (default = nalleles/10). |
only.active.samples |
A logical value specifying whether only active samples should be used for calculations (default = TRUE). |
only.active.variants |
A logical value specifying whether only active variants should be included in the output (default = TRUE). |
verbose |
A logical value specfying whether log messages should be printed (default = TRUE). |
The function outputs a numeric vector of the same length of active markers containing allele frequencies based on the active samples.
Yuri Tani Utsunomiya <ytutsunomiya@gmail.com>
Marco Milanesi <marco.milanesi.mm@gmail.com>
# #### 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')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.