applyMethod | R Documentation |
Apply a method to a subset of variants and/or samples in a GDS object
## S4 method for signature 'SeqVarGDSClass,function,character'
applyMethod(gdsobj, FUN, variant, sample=NULL, ...)
## S4 method for signature 'SeqVarGDSClass,function,numeric'
applyMethod(gdsobj, FUN, variant, sample=NULL, ...)
## S4 method for signature 'SeqVarGDSClass,function,GRanges'
applyMethod(gdsobj, FUN, variant, sample=NULL, ...)
## S4 method for signature 'SeqVarGDSClass,function,missing'
applyMethod(gdsobj, FUN, variant, sample=NULL, ...)
gdsobj |
A |
FUN |
A method or function to be applied to |
variant |
A vector of variant.id values or a |
sample |
A vector of sample.id values defining the samples to be
included in the call to |
... |
Additional arguments, passed to |
applyMethod
applies a method or function FUN
to the
subset of variants defined by variant
and samples defined by
sample
in a GDS object.
If a filter was previously set with seqSetFilter
, it
will be saved and reset after the call to applyMethod
.
The result of the call to FUN
.
Stephanie Gogarten
SeqVarGDSClass
gds <- seqOpen(seqExampleFileName("gds"))
variant.id <- seqGetData(gds, "variant.id")
sample.id <- seqGetData(gds, "sample.id")
applyMethod(gds, getGenotype, variant.id[1:5], sample.id[1:10])
library(GenomicRanges)
chrom <- seqGetData(gds, "chromosome")
pos22 <- seqGetData(gds, "position")[chrom == 22]
ranges <- GRanges(seqnames="22", IRanges(min(pos22), max(pos22)))
applyMethod(gds, heterozygosity, ranges, margin="by.sample")
applyMethod(gds, heterozygosity, ranges, margin="by.variant")
seqClose(gds)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.