Subset GHap.phase object

Share:

Description

This function takes a list of markers and individuals and subsets a GHap.phase object.

Usage

1
ghap.subsetphase(phase, ids, markers, verbose = TRUE)

Arguments

phase

A GHap.phase object.

ids

Character vector of individual names to keep.

markers

Character vector of marker names to keep.

verbose

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

Value

The returned GHap.phase object (as described in the documentation for the ghap.loadphase function) is the same as the one used in the phase argument. However, individuals and markers not included in the provided vectors are set to FALSE (i.e., inactivated) in the phase$samples.in and phase$marker.in vectors, respectively. This procedure avoids expensive subsetting operations by simply flagging which markers and individuals should be used in downstream analyses.

Author(s)

Yuri Tani Utsunomiya <ytutsunomiya@gmail.com>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# #### DO NOT RUN IF NOT NECESSARY ###
# 
# # Copy the example data in the current working directory
# ghap.makefile()
# 
# # Load data
# phase <- ghap.loadphase("human.samples", "human.markers", "human.phase")
# 
# 
# ### RUN ###
# 
# # Subset data - randomly select 3000 markers with maf > 0.02
# maf <- ghap.maf(phase, ncores = 2)
# set.seed(1988)
# markers <- sample(phase$marker[maf > 0.02], 3000, replace = FALSE)
# phase <- ghap.subsetphase(phase, unique(phase$id), markers)
# rm(maf,markers)