plotIBDclusters: Plot Cluster Networks

Description Usage Arguments See Also Examples

Description

plotIBDclusters() Produces a figure of an isoRelate cluster network, where unique isolates are represented by vertices and a line is drawn between two vertices if the isolates have been inferred IBD via the criteria specified in either getIBDiclusters or getIBDpclusters.The networks are created using the R package igraph.

Usage

1
2
3
4
5
plotIBDclusters(ped.genotypes, clusters, groups = NULL, vertex.color = NULL,
  vertex.frame.color = "white", vertex.size = 4, vertex.name = FALSE,
  edge.color = "gray60", edge.width = 0.8, mark.border = "white",
  mark.col = "gray94", add.legend = TRUE, legend.x = -1.5,
  legend.y = -0.25, layout = NULL, return.layout = FALSE)

Arguments

ped.genotypes

A list containing 2 objects. See the Value description in getGenotypes for more details on this input.

clusters

A named list of three objects containing network information. See the Value description in either getIBDiclusters or getIBDpclusters for more details on this input.

groups

A data frame with 3 columns of information:

  1. Family ID

  2. Isolate ID

  3. Group ID

Group ID, for example, can be the geographic regions where the isolates were collected. If groups is specified then each isolate in the pedigree must belong to a group. Vertices in the network will be colored according to group allocation. The default is groups=NULL and all vertices will have the same color.

vertex.color

A vector of characters or numeric values of the vertex colors in the network. If groups is specified then vertex.color should contain the same number of colors as unique groups.

vertex.frame.color

Character string or numeric value. A single color that will be used as the vertex border. Default is vertex.fame.color="white".

vertex.size

Numeric value indicating the size of the vertices in the network. Default is vertex.size=4.

vertex.name

Logical. Whether to add isolate names to the vertices. Default is vertex.name=FALSE.

edge.color

Character string or numeric value. A single color to be used for all edges. Default is edge.color="gray60".

edge.width

Numeric. A single value indicating the width of the edges. Default is edge.width=0.8.

mark.border

Character string or numeric value. A single color to be used for all borders in hierarchical clustering groups. Default is mark.border="white".

mark.col

Character string or numeric value. A single color to be used to fill hierarchical clustering groupings. Default is mark.col="gray94".

add.legend

Logical. Whether to include a legend in the plot. Default is add.legend=TRUE.

legend.x

Numerical. A single value indicating the x-coordinate of the legend, with default legend.x=-1.5.

legend.y

Numerical. A single value indicating the y-coordinate of the legend, with default legend.y=-0.25.

layout

A matrix containing the x and y coordinates of the vertices, generated using the Fruchterman-Reingold force-directed layout.

return.layout

Logical. Whether or not to return the layout matrix (vertex positions) in the network. This layout can be used as the input for the parameter layout to avoid different network configurations each time plotClusters() is run on the same network.

See Also

getGenotypes, getIBDpclusters and getIBDiclusters.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# generate the isolates who are IBD over the Plasmodium falciparum CRT gene
my_i_clusters <- getIBDiclusters(ped.genotypes = png_genotypes,
                                 ibd.segments = png_ibd,
                                 interval = c("Pf3D7_07_v3", 403222, 406317),
                                 prop=0,
                                 hi.clust = FALSE)

str(my_i_clusters)

# creating a stratification dataset
my_groups <- png_genotypes[[1]][,1:3]
my_groups[1:10,"pid"] <- "a"
my_groups[11:25,"pid"] <- "b"
my_groups[26:38,"pid"] <- "c"

# plot the network of clusters
plotIBDclusters(ped.genotypes = png_genotypes,
                clusters = my_i_clusters,
                groups = my_groups,
                vertex.color = NULL,
                vertex.frame.color = "white",
                vertex.size = 4,
                vertex.name = FALSE,
                edge.color = "gray60",
                edge.width = 0.8,
                mark.border = "white",
                mark.col = "gray94",
                add.legend = TRUE,
                legend.x = -1.5,
                legend.y = -0.25,
                layout = NULL,
                return.layout = FALSE)

# generate the isolates who share at least than 90% of their genome IBD
my_p_clusters <- getIBDpclusters(ped.genotypes = png_genotypes,
                                 ibd.segments = png_ibd,
                                 prop=0.9,
                                 hi.clust = FALSE)

# plot the network of clusters
plotIBDclusters(ped.genotypes = png_genotypes,
                clusters = my_p_clusters,
                groups = my_groups,
                vertex.color = NULL,
                vertex.frame.color = "white",
                vertex.size = 4,
                vertex.name = FALSE,
                edge.color = "gray60",
                edge.width = 0.8,
                mark.border = "white",
                mark.col = "gray94",
                add.legend = TRUE,
                legend.x = -1.5,
                legend.y = -0.25,
                layout = NULL,
                return.layout = FALSE)

bahlolab/isoRelate documentation built on May 11, 2019, 5:25 p.m.