Learn R Programming

SeqArray (version 1.8.0)

seqSetFilter: Set a filter to sample or variant

Description

Set a filter to sample and/or variant

Usage

seqSetFilter(gdsfile, sample.id=NULL, variant.id=NULL, samp.sel=NULL, variant.sel=NULL, action=c("set", "push", "push+set", "pop"), verbose=TRUE)

Arguments

gdsfile
sample.id
IDs of selected samples
variant.id
IDs of selected variants
samp.sel
a logical vector indicating the selected samples
variant.sel
a logical vector indicating the selected variants
action
"set" -- set the current filter via sample.id, variant.id, samp.sel or variant.sel; "push" -- push the current filter to the stack, and it could be recovered by "pop" later, no change on the current filter; "push+set" -- push the current filter to the stack, and changes the current filter via sample.id, variant.id, samp.sel or variant.sel; "pop" -- pop up the last filter
verbose
if TRUE, show information

Value

None.

See Also

seqGetFilter, seqGetData, seqApply

Examples

Run this code
# the file of GDS
gds.fn <- seqExampleFileName("gds")
# or gds.fn <- "C:/YourFolder/Your_GDS_File.gds"

# display
(f <- seqOpen(gds.fn))

# get 'sample.id
(samp.id <- seqGetData(f, "sample.id"))
# "NA06984" "NA06985" "NA06986" ...

# get 'variant.id'
head(variant.id <- seqGetData(f, "variant.id"))

# get 'chromosome'
table(seqGetData(f, "chromosome"))

# get 'allele'
head(seqGetData(f, "allele"))
# "T,C" "G,A" "G,A" ...


# set sample and variant filters
seqSetFilter(f, sample.id=samp.id[c(2,4,6,8,10)])
set.seed(100)
seqSetFilter(f, variant.id=sample(variant.id, 10))

# get genotypic data
seqGetData(f, "genotype")


# close the GDS file
seqClose(f)

Run the code above in your browser using DataLab