View source: R/func__mergeIddAlleles.R
mergeIddAlleles | R Documentation |
Merge nodes of identically distributed alleles into a single node to simplify the linkage network. When lmms.only = FALSE, two alleles are mergable only if the physical distances measured between them are well supporting the presence of physical linkage (namely, s_d = 1) and the distributions of alleles are not identical by descent (IBD); when lmms.only = TRUE, two alleles are mergable if they are identically distributed (hence they are represented by the same pattern for linear mixed models).
This function takes as input the output of the core function findPhysLink or lmm. Hence it can only be used after running either function. The output is a data frame for network visualisation, which consists of associations between differently distributed alleles and merged clusters. Identically distributed alleles that are not supported by either physical distances or non-IBD status are not included in this data frame. In addition, internal associations (where beta = 1) between identically distributed alleles are not covered by this network either.
This function accepts a data frame having unidirected edges as the argument of assoc.
mergeIddAlleles( assoc, other.cols = NULL, lmms.only = FALSE, replace.names = TRUE )
assoc |
The data frame named assoc in findPhysLink's output. By design, alleles are all paired in this data frame. |
other.cols |
Additional columns of the data frame assoc that a user wants to include in the results. Notice variables corresponding to these columns must no be affected by idd. alleles of the same cluster. For example, the beta value does not differ with any alleles in the same cluster. In other words, the estimate of beta for the model y ~ x1 does not differ from y ~ x2 when x1 = x2. By contrast, summary statistics of distance measurements for the distance between y and x1 may differ from those between y and x2. Results can be misleading if this requirement is not satisfied. |
lmms.only |
A logical argument specifying whether the input data frame "assoc" comes from the function lmm rather than findPhysLink. |
replace.names |
A logical argument specifying whether to replace cluster names in the assoc data frame with actual allele names. For example, "c1" becomes "allele1&allele2" if replace.names equals TRUE. |
Yu Wan (wanyuac@126.com)
# Example 1 assoc <- findPhysLink(...) a <- mergeIddAlleles(assoc[["assoc"]]) # Example 2 a <- lmm(...) lmms <- subset(a$dif$h1, p_adj <= 0.05 & beta > 0) lmms$dif <- rep(1, times = nrow(lmms)) # not identically distributed lmms <- rbind.data.frame(lmms, cbind.data.frame(a$idd$h1, dif = rep(0, times = nrow(a$idd$h1))), stringsAsFactors = FALSE) lmms_merged <- mergeIddAlleles(assoc = lmms, lmms.only = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.