## S3 method for class 'AssocTestResult':
weights(object, Z, model)
## S3 method for class 'AssocTestResultRanges':
weights(object, Z, model, limit=20, sex=NULL)
AssocTestResult
or AssocTestResultRanges
GenotypeMatrix
,
an object of class TabixFile
, or a
character string with the file name of a VCF fileNullModel
Inf
or non-numeric value like NA
or NULL
to disable limitation. Do this with caution, in particular, when
reading from a VCF file, as reading of excessively large regions
from VCF files may take very long or even kill the R session because
of excessive memory comsumption!NULL
, all samples are treated the same
without any modifications; if sex
is a factor with levels
F
(female) and M
(male) that is as long as
the number of samples in model
, this argument is
interpreted as the sex of the samples. In this case, the genotypes
corresponding to male samples are
doubled before further processing. This is designed for mixed-sex
analyses of the X chromosome outside of the pseudoautosomal
regions.GRanges
or
GRangesList
(see details above)weights
method allows for finding out the individual contributions each of the
variants made to the test statistic. This computation is only possible
for kernels computeKernel
). If called for an
object as
first argument object
, a
object Z
, and a
object
model
, weights
returns a
object that contains all variants of
variantInfo(Z)
along with two numerical metadata columns named
If weights
is called for an
object object
,
a second argument Z
that is an object of class
, an object of class
TabixFile
, or a character string with the
name of a VCF file, and a
object
model
, the contribution weights described above
are computed for each region in object
. In this case, the
method returns a
with as many
components as object
has regions, where each list component is
a
object containing the
contribution weights as described above.
It is essential for weights
to work correctly that
object
is actually the result of an association test between
Z
and model
. If called for objects that actually do not
belong to each other, the results are void. The method is implemented
such that all possible checks are made that possibly detect
inconsistencies between the input objects. However, the final
responsibility is left to user to make sure that all data are
consistent. Special caution is necessary if weights
is run
for an AssocTestResultRanges
object that has
been obtained by merging multiple
using the c
method. The c
method performs several checks
to ensure consistency of association test parameters among the merged
results, but the sex
parameter is an exception: if it appears
to be inconsistent among the results to merge, it is omitted from the
merged object (see also
).
The weights
method needs to re-evaluate some computations of
the association test. In case it is called for Z
being a
TabixFile
object or file name of a VCF file,
weights
even needs to re-read the genotype data from the file.
Therefore, the method has a safety limit not to process too many
regions (see limit
argument described above).
assocTest
, AssocTestResult
,
AssocTestResultRanges
, nullModel
,
NullModel
, computeKernel
,
GenotypeMatrix
, p.adjust
,
filterResult
## load genome description data(hgA) ## partition genome into overlapping windows windows <- partitionRegions(hgA) ## load genotype data from VCF file vcfFile <- system.file("examples/example1.vcf.gz", package="podkat") Z <- readGenotypeMatrix(vcfFile) ## read phenotype data from CSV file (continuous trait + covariates) phenoFile <- system.file("examples/example1lin.csv", package="podkat") pheno <- read.table(phenoFile, header=TRUE, sep=",") ## train null model with all covariates in data frame 'pheno' model <- nullModel(y ~ ., pheno) ## perform association test res <- assocTest(Z, model, windows) ## perform multiple testing correction and filter for ## significant regions res <- filterResult(p.adjust(res), filterBy="p.value.adj") ## compute contributions contrib <- weights(res, Z, model) contrib ## extract most indicative variants filterResult(contrib) ## plot contributions plot(contrib[[1]], "weight.raw") plot(contrib[[1]], "weight.contribution", type="b", alongGenome=TRUE)