View source: R/plotLDnetwork.r
plotLDnetwork | R Documentation |
Allows for visual inspection of clusters identified by extractBranches
.
plotLDnetwork(
ldna,
LDmat,
option,
threshold,
clusters,
summary,
digits = 2,
exl = NULL,
full.network = TRUE,
include.parent = FALSE,
after.merger = FALSE,
graph.object = FALSE,
col = "grey",
frame.color = "grey",
pos = NULL
)
ldna |
Output from |
LDmat |
a matrix of pairwise LD values |
option |
|
threshold |
Specifies the LD threshold at which an LD network is plotted. Only required for option=1. |
clusters |
Output from |
summary |
Output from |
digits |
Needs to be the same as used |
exl |
A list of locus names to be excluded from the LD networks (default is |
full.network |
If |
include.parent |
If |
after.merger |
Whether to show LD networks at an LD threshold just before ( |
graph.object |
Whether to output |
col |
Color of vertices when using |
frame.color |
Frame color for vertices. |
pos |
A numeric vector giving the position of loci along each chromosome. This is converted into red-green color space such that within each cluster it is possible to infer if vertex position reflexts its physical position in the chromosome. Currently works only for |
See examples for more details
If option=1
and graph.object=TRUE
the output is an igraph.object that can further be manipulated for custom networks (see igraph
for details).
Petri Kemppainen petrikemppainen2@gmail.com
LDnaRaw
, extractBranches
and summaryLDna
#### Example with option=1
data(LDna)
plotLDnetwork(LDmat=r2.baimaii_subs, option=1, threshold=0.4)
plotLDnetwork(LDmat=r2.baimaii_subs, option=1, threshold=0.4, col="red") # for more color
### Examples with option 2
par(mfcol=c(1,2))
ldna <- LDnaRaw(r2.baimaii_subs)
clusters <- extractBranches(ldna, min.edges=20)
summary <- summaryLDna(ldna, clusters,LDmat=r2.baimaii_subs)
#default settings with option=2
par(mfcol=c(2,2))
plotLDnetwork(ldna, r2.baimaii_subs, option=2, clusters=clusters, summary=summary)
## Other useful settings
# For large data sets
plotLDnetwork(ldna, r2.baimaii_subs, option=2, clusters=clusters, summary=summary, full.network=FALSE, include.parent=FALSE, after.merger=FALSE)
# To visualise the merger
plotLDnetwork(ldna, r2.baimaii_subs, option=2, clusters=clusters, summary=summary, full.network=TRUE, after.merger=TRUE)
# Or
plotLDnetwork(ldna, r2.baimaii_subs, option=2, clusters=clusters, summary=summary, full.network=FALSE, include.parent=TRUE, after.merger=TRUE)
# To show that ususally several clusters are involved in most mergers
plotLDnetwork(ldna, r2.baimaii_subs, option=2, clusters=clusters, summary=summary, full.network=FALSE, include.parent=TRUE, after.merger=FALSE)
### Print directly to file, recommended for large data sets with many clusters.
library(parallel)
fun <- function(x){
setEPS()
postscript(paste(x, "network.eps", sep="_"))
plotLDnetwork(ldna, r2.baimaii_subs, option=2, clusters=clusters[x], summary=summary[x,], full.network=FALSE)
dev.off()
}
lapply(1:length(clusters), fun)
# a multicore version of this
mclapply(1:length(clusters), fun, mc.cores=4, mc.preschedule=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.