Upon successful completion of an association test, the 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 linear.podkat and linear.SKAT
(see computeKernel
). If called for an AssocTestResult
object as
first argument object
, a GenotypeMatrix
object Z
, and a NullModel
object
model
, weights
returns a
GRanges
object that contains all variants of
variantInfo(Z)
along with two numerical metadata columns named
weight.raw and weight.contribution. The column
weight.raw corresponds to raw contributions. These are
signed, i.e. a positive value indicates a positive association, while
a negative value indicates a negative association. The larger the
absolute value, the larger the contribution. The column
weight.contribution corresponds to relative contributions.
These values are non-negative and they sum up to 1.
For mathematical details, see Subsection 9.4 of the package vignette.
If weights
is called for an
AssocTestResultRanges
object object
,
a second argument Z
that is an object of class
GenotypeMatrix
, an object of class
TabixFile
, or a character string with the
name of a VCF file, and a NullModel
object
model
, the contribution weights described above
are computed for each region in object
. In this case, the
method returns a GRangesList
with as many
components as object
has regions, where each list component is
a GRanges
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 AssocTestResultRanges
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 AssocTestResultRanges
).
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).