Learn R Programming

FamAgg (version 1.0.2)

FAKinGroupResults-class: Kinship group test

Description

The FAKinGroupResults object contains the results from the kinship test. This test performs a familial aggregation analysis on a subset of individuals within a family. Two actual tests are conducted, a ratio test that evaluates whether the number of affected individuals within the group is higher than expected by chance, and a kinship test that compares the largest kinship value between affected in the group to the one between randomly sampled individuals.

For more details see kinshipGroupTest.

Usage

## S3 method for class 'FAKinGroupResults':
affectedKinshipGroups(object)

## S3 method for class 'FAKinGroupResults': buildPed(object, id=NULL, max.generations.up=3, max.generations.down=16, prune=FALSE) ## S3 method for class 'FAKinGroupResults': plotPed(object, id=NULL, family=NULL, filename=NULL, device="plot", ...)

## S3 method for class 'FAKinGroupResults': plotRes(object, id=NULL, family=NULL, addLegend=TRUE, type="density", ...)

## S3 method for class 'FAKinGroupResults': result(object, method="BH")

## S3 method for class 'FAKinGroupResults': runSimulation(object, nsim=50000, strata=NULL)

## S3 method for class 'FAKinGroupResults': shareKinship(object, id=NULL)

## S3 method for class 'FAKinGroupResults': trait(object) <- value

Arguments

addLegend
For plotRes: if a legend should be added to the plot.
device
For plotPed: see plotPed for more details.
family
For plotPed: not supported.
filename
For plotPed: the file name to which the pedigree plot should be exported. See plotPed for more details.
id
For buildPed, plotPed, plotRes and shareKinship: the id of the kinship group (i.e. one of the ids in column "group_id" of the result table result(object)).

Note: id can be a numeric or a character. Numeric ids will be internally converted to character.

max.generations.down
For buildPed: the maximal number of generations to look for children.
max.generations.up
For buildPed: the maximal number of generations to look for ancestors.
method
The multiple hypothesis testing method. All methods supported by p.adjust are allowed.
nsim
Number of simulations.
object
The FAKinGroupResults object.
prune
For buildPed: whether the full pedigree should be returned (prune=FALSE) or the pedigree should be reduced to a smaller pedigree containing only individuals in the kinship group (prune=TRUE); see details for more information. Note: the plotPed method does also support this parameter.
strata
For runSimulation: a numeric, character of factor characterizing each individual in the pedigree. The length of this vector and the ordering has to match the pedigree. This vector allows to perform stratified random sampling. See details on the PedigreeAnalysis help page or examples for more information.
type
For plotRes: either "density" (the default) or "hist" specifying whether the distribution of expected values from the simulation should be visualized as a density plot or histogram.
value
For trait<-: can be a named numeric, character or factor vector. The names (at least some of them) have to match the ids in the pedigree of the object.
...
For plotPed: additional arguments to be submitted to the internal buildPed call and to plotPed.

Value

  • Refer to the method and function description above for detailed information on the returned result object.

Objects from the Class

FAKinGroupResults objects are created by the kinshipGroupTest method for FAData objects.

Extends

Class FAData directly.

Details

Calling the runSimulation method on a FAKinGroupResults object is the same as calling the kinshipGroupTest on a FAData object. In the first case the simulation is performed using the trait information data stored internally in the object, while in the latter case the trait information have to be submitted to the function call.

A call to the setter methods trait<- resets any simulation results present in the sim slot, thus, the object can be re-used to perform a simulation analysis using the new trait data.

The buildPed method returns by default the full pedigree (all ancestors and all children) up to the maximal number of generations. By setting prune=TRUE the method restricts the pedigree to all individuals with a kinship >= the minimal kinship between the individual (with the id equal to the group id) and any other affected individual in its pedigree.

The plotPed method allows to plot the pedigree for a kinship group. This pedigree consists of the full pedigree (all ancestors and children) of all individuals in the kinship group. Similar to the buildPed method the pedigree can be restricted to the kinship group (and eventual missing parents etc) by setting prune=TRUE.

See Also

FAData, kinship, trait, probabilityTest, kinshipSumTest, genealogicalIndexTest, familialIncidenceRateTest, fsirTest, buildPed, plotPed, switchPlotfun

Examples

Run this code
##########################
##
##  Perform the simulation analysis
##
## Load the test data.
data(minnbreast)

## Subset to some families and generate the pedigree data.frame
mbsub <- minnbreast[minnbreast$famid == 165 | minnbreast$famid == 432, ]
PedDf <- mbsub[, c("famid", "id", "fatherid", "motherid", "sex")]
colnames(PedDf) <- c("family", "id", "father", "mother", "sex")

## Generate the FAData.
fad <- FAData(pedigree=PedDf)

## Specify the trait.
tcancer <- mbsub$cancer
names(tcancer) <- mbsub$id

## Perform the kinship group test.
far <- kinshipGroupTest(fad, trait=tcancer, traitName="cancer", nsim=1000)
res <- result(far)
head(res)

## Plot the pedigree for the most significant kinship group
plotPed(far, id=res[1, "group_id"])

## The full pedigree for this affected individual and its kinship group is
## large:
nrow(buildPed(far, id=res[1, "group_id"]))

## We can however restrict it to a reduced pedigree containing only the
## kinship group and all individuals with a kinship >= the smallest kinship
## between the individual and any other affected individual in the pedigree:
nrow(buildPed(far, id=res[1, "group_id"], prune=TRUE))

## By specifying prune=TRUE we can restrict the pedigree plot to these
## individuals
plotPed(far, id=res[1, "group_id"], prune=TRUE)

## Get the ids of all individuals sharing kinship with any of the inddividuals
## in that kinship group:
shareKinship(far, id=res[1, "group_id"])

## Plot the simulation analysis result for the ratio test.
plotRes(far, id=res[1, "group_id"], type="hist")

Run the code above in your browser using DataLab