SeqVarData | R Documentation |
Extends SeqVarGDSClass
to include annotation for samples and variants.
A SeqVarData
object adds an AnnotatedDataFrame
for both samples and variants to a SeqVarGDSClass
object.
Note that a SeqVarData
object must be created using an unfiltered SeqVarGDSClass
object. The sample.id
column in the sampleData
AnnotatedDataFrame
must exactly match the sample.id
node in the GDS file (and similarly for variant.id
in variantData
). This enables all subsequent filters set on the SeqVarData
object to apply to the GDS and the annotation simultaneously.
SeqVarData(gds, sampleData, variantData)
: Returns a SeqVarData
object.
gds
can be either the filename of a sequencing GDS file or an existing SeqVarGDSClass
object.
sampleData
must be an AnnotatedDataFrame
with a column sample.id
matching sample.id
in the GDS file. If this argument is missing, a data frame with 0 columns will be created.
variantData
must be an AnnotatedDataFrame
with a column variant.id
matching variant.id
in the GDS file. If this argument is missing, a data frame with 0 columns will be created.
sampleData(x)
, sampleData(x)<- value
:
Get or set the AnnotatedDataFrame
with sample data. If a sample filter has been applied with seqSetFilter
, only selected samples will be returned. value
must include all samples.
variantData(x)
, variantData(x)<- value
:
Get or set the AnnotatedDataFrame
with variant data. If a variant filter has been applied with seqSetFilter
, only selected variants will be returned. value
must include all variants.
granges(x)
:
Return a GRanges
object with the columns of variantData
as metadata columns.
validateSex(x)
:
Return the contents of a column named "sex" in sampleData(x)
, provided the contents are valid (values either "M"/"F" or 1/2, or NA). If the column is missing or invalid, return NULL
.
See SeqVarGDSClass
for additional methods.
Stephanie Gogarten
SeqVarGDSClass
,
seqVCF2GDS
,
seqOpen
,
seqGetData
,
seqSetFilter
,
seqApply
,
seqClose
gds <- seqOpen(seqExampleFileName("gds"))
## create sample annotation
library(Biobase)
sample.id <- seqGetData(gds, "sample.id")
sex <- sample(c("M","F"), length(sample.id), replace=TRUE)
phenotype <- rnorm(length(sample.id), mean=10)
samp <- data.frame(sample.id, sex, phenotype, stringsAsFactors=FALSE)
meta <- data.frame(labelDescription=c("unique sample identifier",
"sex (M=male, f=female)", "example phenotype"),
row.names=names(samp), stringsAsFactors=FALSE)
sample.data <- AnnotatedDataFrame(samp, meta)
seqData <- SeqVarData(gds, sample.data)
head(validateSex(seqData))
## add another annotation column
sample.data$site <- sample(letters, length(sample.id), replace=TRUE)
varMetadata(sample.data)["site", "labelDescription"] <- "study site"
sampleData(seqData) <- sample.data
## set a filter
seqSetFilter(seqData, sample.id=sample.id[1:10])
nrow(sampleData(seqData))
seqClose(seqData)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.