Learn R Programming

bio3d (version 2.3-4)

identify.cna: Identify Points in a CNA Protein Structure Network Plot

Description

‘identify.cna’ reads the position of the graphics pointer when the (first) mouse button is pressed. It then searches the coordinates given in ‘x’ for the point closest to the pointer. If this point is close enough to the pointer, its index and community members will be returned as part of the value of the call and the community members will be added as labels to the plot.

Usage

# S3 method for cna
identify(x, labels=NULL, cna=NULL, ...)

Arguments

x

A numeric matrix with Nx2 dimensions, where N is equal to the number of objects in a 2D CNA plot such as obtained from the ‘plot.cna’ and various ‘layout’ functions.

labels

An optional character vector giving labels for the points. Will be coerced using ‘as.character’, and recycled if necessary to the length of ‘x’. Excess labels will be discarded, with a warning.

cna

A network object as returned from the ‘cna’ function.

Extra options passed to ‘identify’ function.

Value

If ‘labels’ or ‘cna’ inputs are provided then a membership vector will be returned with the selected community ids and their members. Otherwise a vector with the ids of the selected communities will be returned.

Details

This function calls the ‘identify’ and ‘summary.cna’ functions to query and label 2D CNA protein structure network plots produced by the ‘plot.cna’ function. Clicking with the mouse on plot points will add the corresponding labels and them to the plot and returned list object. A click with the right mouse button will stop the function.

See Also

plot.cna, identify, plot.igraph, plot.communities, igraph.plotting

Examples

Run this code
# NOT RUN {
if (!requireNamespace("igraph", quietly = TRUE)) {
   message('Need igraph installed to run this example')
} else {

attach(hivp)

# Read the starting PDB file to determine atom correspondence
pdbfile <- system.file("examples/hivp.pdb", package="bio3d")
pdb <- read.pdb(pdbfile)

# Plot the network
xy <- plot.cna(net)

# Use identify.cna on the communities
d <- identify.cna(xy, cna=net)

# Right click to end the function...
## d <- identify(xy, summary(net)$members)

detach(hivp)

}
# }

Run the code above in your browser using DataLab