xSocialiserDAGplot: Function to draw DAG plot for visualising terms used to...

Description Usage Arguments Value Note See Also Examples

View source: R/xSocialiserDAGplot.r

Description

xSocialiserDAGplot is supposed to draw DAG plot for visualising terms used to annotate an input SNP or gene. By default, terms used for direct/original annotations by box-shaped nodes, and terms for indirect/inherited annotations by ellipse nodes. This function is part of utilities in understanding calculated similarity. It returns an object of class 'Ragraph' or class 'igraph'.

Usage

 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
xSocialiserDAGplot(
g,
query,
displayBy = c("IC", "none"),
path.mode = c("all_paths", "shortest_paths", "all_shortest_paths"),
height = 7,
width = 7,
margin = rep(0.1, 4),
colormap = c("yr", "bwr", "jet", "gbr", "wyr", "br", "rainbow", "wb",
"lightyellow-orange"),
ncolors = 40,
zlim = NULL,
colorbar = T,
colorbar.fraction = 0.1,
newpage = T,
layout.orientation = c("top_bottom", "left_right", "bottom_top",
"right_left"),
node.info = c("none", "term_id", "term_name", "both",
"full_term_name"),
wrap.width = NULL,
graph.node.attrs = NULL,
graph.edge.attrs = NULL,
node.attrs = NULL,
output.format = c("Ragraph", "igraph")
)

Arguments

g

an object of class "igraph" (resulting from similarity analysis)

query

an object in query (for example, an SNP or Gene)

displayBy

which statistics will be used for displaying. It can be "IC" for information content (by default), "none" for no color-coding on nodes/terms

path.mode

the mode of paths induced by nodes/terms. It can be "all_paths" for all possible paths to the root, "shortest_paths" for only one path to the root (for each node in query), "all_shortest_paths" for all shortest paths to the root (i.e. for each node, find all shortest paths with the equal lengths)

height

a numeric value specifying the height of device

width

a numeric value specifying the width of device

margin

margins as units of length 4 or 1

colormap

short name for the colormap. It can be one of "jet" (jet colormap), "bwr" (blue-white-red colormap), "gbr" (green-black-red colormap), "wyr" (white-yellow-red colormap), "br" (black-red colormap), "yr" (yellow-red colormap), "wb" (white-black colormap), and "rainbow" (rainbow colormap, that is, red-yellow-green-cyan-blue-magenta). Alternatively, any hyphen-separated HTML color names, e.g. "lightyellow-orange" (by default), "blue-black-yellow", "royalblue-white-sandybrown", "darkgreen-white-darkviolet". A list of standard color names can be found in http://html-color-codes.info/color-names

ncolors

the number of colors specified over the colormap

zlim

the minimum and maximum z/data values for which colors should be plotted, defaulting to the range of the finite values of z. Each of the given colors will be used to color an equispaced interval of this range. The midpoints of the intervals cover the range, so that values just outside the range will be plotted

colorbar

logical to indicate whether to append a colorbar. If data is null, it always sets to false

colorbar.fraction

the relative fraction of colorbar block against the device size

newpage

logical to indicate whether to open a new page. By default, it sets to true for opening a new page

layout.orientation

the orientation of the DAG layout. It can be one of "left_right" for the left-right layout (viewed from the DAG root point), "top_bottom" for the top-bottom layout, "bottom_top" for the bottom-top layout, and "right_left" for the right-left layout

node.info

tells the ontology term information used to label nodes. It can be one of "none" for no node labeling, "term_id" for using Term ID, "term_name" for using Term Name (the first 15 characters), "both" for using both of Term ID and Name (the first 15 characters), and "full_term_name" for using the full Term Name

wrap.width

a positive integer specifying wrap width of Term Name

graph.node.attrs

a list of global node attributes. These node attributes will be changed globally. See 'Note' below for details on the attributes

graph.edge.attrs

a list of global edge attributes. These edge attributes will be changed globally. See 'Note' below for details on the attributes

node.attrs

a list of local edge attributes. These node attributes will be changed locally; as such, for each attribute, the input value must be a named vector (i.e. using Term ID as names). See 'Note' below for details on the attributes

output.format

the format specifying the return value. It can be "Ragraph" (by default) or "igraph"

Value

An object of class 'Ragraph' or 'igraph'. If the returned is an Ragraph object, an image will be shown. If the returned is an igraph object, no image will be shown; in this case, the returned igraph object stores ontology terms used to annotate the query, including a new node attribute 'inherited' indicative of whether terms are inherited or not.

Note

A list of global node attributes used in "graph.node.attrs":

A list of global edge attributes used in "graph.edge.attrs":

A list of local node attributes used in "node.attrs" (only those named Term IDs will be changed locally!):

See Also

xSocialiserGenes, xSocialiserSNPs

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
## Not run: 
# Load the library
library(XGR)
RData.location="~/Sites/SVN/github/bigdata"

# 1) SNP-based similarity analysis using GWAS Catalog traits (mapped to EF)
# provide genes and SNPs reported in AS GWAS studies
ImmunoBase <- xRDataLoader(RData.customised='ImmunoBase')
## get lead SNPs reported in AS GWAS
example.snps <- names(ImmunoBase$AS$variants)
SNP.g <- xSocialiserSNPs(example.snps, include.LD=NA,
RData.location=RData.location)

# 2) Circos plot involving nodes 'rs6871626'
xCircos(g=SNP.g, entity="SNP", nodes.query="rs6871626",
RData.location=RData.location)

# 3) DAG plot visualising terms used to annotate an SNP 'rs6871626'
agDAG <- xSocialiserDAGplot(g=SNP.g, query='rs6871626', displayBy="IC",
node.info=c("full_term_name"))
## modify node labels
xSocialiserDAGplot(g=SNP.g, query='rs6871626', displayBy="IC",
node.info=c("full_term_name"),
graph.node.attrs=list(fontsize=20,fontcolor="blue",color="transparent"))

# 4) Return an igraph object storing ontology terms used to annotate an SNP 'rs6871626'
dag <- xSocialiserDAGplot(g=SNP.g, query='rs6871626', displayBy="IC",
output.format="igraph")

## End(Not run)

XGR documentation built on Jan. 8, 2020, 5:06 p.m.

Related to xSocialiserDAGplot in XGR...