buildNet {GeneAnswers} | R Documentation

## build and display a network for given IDs and interaction Matrix

### Description

A function to build and display a network for given IDs and interaction Matrix with specified filtered IDs.

### Usage

    buildNet(graphIDs, idType=c('GO', 'GO.BP', 'GO.CC', 'GO.MF', 'GeneInteraction', 'Customized'), edgeM=NULL, layers=1, filterGraphIDs=NULL, filterLayer=0,
     					annLib=c('org.Hs.eg.db', 'org.Mm.eg.db', 'org.Rn.eg.db', 'org.Dm.eg.db', 'customized'), output=c('interactive', 'fixed'), netMode=c('layer', 'connection'),
    					vertexSize = NULL, edgeColor = NULL, colorMap=NULL, zeroColorIndex=NULL, matchMode=c('absolute', 'relative'),  label=TRUE,
    					directed=FALSE, direction=c('up', 'down', 'both'), showModeForNodes=c('nodes', 'filters'), verbose=TRUE, readable=TRUE, labelSize=1, labelColor='#666666',  ...)

### Arguments

`graphIDs` | a character vector for given IDs
`idType` | type of IDs, could be one of 'GO', 'GO.BP', 'GO.CC', 'GO.MF', 'GeneInteraction' and 'Customized'
`edgeM` | a 2-column Matrix representing a network
`layers` | an integer, specify how many layers will be retrieved.
`filterGraphIDs` | a chacater vector for filtered IDs or a 2- or 3-column matrix for extra values.
`filterLayer` | an integer, specify where filterGraphIDs are applied.
`annLib` | type for annotation library, 'org.Hs.eg.db', 'org.Mm.eg.db', 'org.Rn.eg.db', 'org.Dm.eg.db'and 'customized'. For 'customized', edgeM is necessary
`output` | type to specify output figure types
`netMode` | type to show network, see details
`vertexSize` | an integer, the size of vertices in the network, default is NULL
`edgeColor` | a R compatible color type, the color of edges in the network, default is NULL
`colorMap` | a R compatible color character vector, or NULL by embedded color scheme.
`zeroColorIndex` | index of color corresponding to zero, see details
`matchMode` | the mode of values matching colors, valid only if inputValue is not NULL, see details
`label` | logic, specify whether put labels for non-given nodes in the network.
`directed` | logic, the network is a directed or not
`direction` | search direction, it could be 'up', 'down' and 'both'. Valid for directed network only.
`showModeForNodes` | type, the show mode for nodes on the network, only valid if filterGraphIDs is not NULL, see details
`verbose` | logic, specify to show information or not.
`readable` | logic, specify whether show IDs or Terms/Names for nodes
`labelSize` | an integer, the size of label for nodes
`labelColor` | an R compatible color, default is #666666
`...` | other parameters used by 'getCategoryTerms'

### Details

Currently, if idType is 'GO', 'GO.BP', 'GO.CC' or 'GO.MF', edgeM will be ignore.

edgeM is a 2-column matrix. For directional connection, the direction is from column 1 elements to column 2 elements. For non-directional connection, each connection should be reversely presented twice, one is from column 1 element to column 2 element, while another is from column 2 element to column 1 element. In other words, non-directional connection is considered as two reverse directional connections.

filterGraphIDs are applied only at the filterLayer and more outer layers. This means the nodes between the filterLayer layer and the most external layer belong to the filterGraphIDs. The nodes between given graphIDs and the (filterLayer-1) layer are or are not from filterGraphIDs, but those nodes not in filterGraphIDs should be able to be finally connected by given graphIDs and filterGraphIDs.

There are two type of color matching methods. 'absolute' means, given zeroColorIndex that is color index in the colorMap for value 0, any value more than 0 will be matched to color between zeroColorIndex and the last one in colorMap based on the ratio of the value tothe maximum of the inputValue, while the value less than 0 will be matched to color between the first color in colorMap and zeroColorIndex, also based on the ratio of the value to the minimum of the inputValue.

showModeForNodes stands for, if the filterGraphIDs is not NULL, some or all of filterGraphIDs could be nodes for given IDs multiple search. If it is set to 'nodes', it means only the values of nodes in the display network will be used to match color by matchMode. For 'filters', it means the values of all filter nodes will be used to match color. If values for color of nodes in the network are not large, while the maximum of color of filter nodes is large, it is recommended to set to 'nodes', or it is difficult to see difference for the nodes. For comparing two networks, for example, one is up-search and another is down-search for the same IDs, it is better to set to 'absolute' for easy comparisons.

There are two types of output figures. "Fixed" means a network will be drawn on a regular R canvas, while "interactive" will generate a tck/tk canvas. Users can adjust nodes on it by mouse.

If the filterGraphIDs is a ID vector. The filterGraphIDs nodes will be black, others will be white. If filterGraphIDs is a 2- or 3-column matrix, the 1st column is filter IDs and 2nd column is for color of nodes. If the 3rd column is available, it is for size of nodes.

There are two types of netMode. 'layer' means size of nodes will be smaller and smaller for more and more external layers. And also color of edges change for different layers. 'connection' mode just distinguish direct or indirect connection. The size of the given IDs the largest. However, if filterGraphIDs is a 3-column matrix, the size of nodes will be determined by the 3rd column of filterGraphIDs.

The graphIDs nodes are yellow circled solid dots. Color depends on colorMap and filterGraphIDs 2nd column. If no value available, all given graphIDs filterGraphIDs nodes are black, others are white.

### Value

invisibly return a list containing elements to represent a network.

### Author(s)

Gang Feng, Pan Du and Simon Lin

### References

Feng, G., Du, P., Krett, N., Tessel, M., Rosen, S., Kibbe, W.A. and Lin, S.M., 'A collection of bioconductor methods to visualize gene-list annotations', BMC Research Notes 2010, 3:10

### See Also

`getCategoryTerms`

### Examples

    require(GeneAnswers)
    example(GeneAnswers)
    filterM <- cbind(rownames(getEnrichmentInfo(x)), -log2(getEnrichmentInfo(x)[,7]), getEnrichmentInfo(x)[,1])

    ## Not run: buildNet(rownames(getEnrichmentInfo(x))[6:9], layers=5, filterGraphIDs=filterM, filterLayer=3, directed=TRUE, output='fixed')
    ## Not run: buildNet(rownames(getEnrichmentInfo(x))[200:204], layers=2, filterGraphIDs=filterM, filterLayer=1, directed=TRUE, output='fixed', netMode='connection', direction='down')
    ## Not run: buildNet(rownames(getEnrichmentInfo(x))[6:9], layers=3, filterGraphIDs=filterM[,1:2], filterLayer=3, directed=TRUE, output='fixed', netMode='connection')

[Package GeneAnswers version 2.28.0 Index]