summarize_semtypes: Summarize semantic types

Description Usage Arguments Details Value See Also Examples

View source: R/summarize.R

Description

Summarize the semantic types present in a collection of nodes

Usage

1
summarize_semtypes(graph, object, print = TRUE, is_path = TRUE)

Arguments

graph

The SemMed graph

object

A vertex sequence (igraph.vs), a list of vertex sequences, or a list of vertex sequence lists

print

If TRUE, information on semantic types will be printed to the screen.

is_path

If TRUE, object contains paths (ordered sequences of nodes).

Details

summarize_semtypes summarizes the semantic types present in supplied node collections and has different behavior depending on whether the node collection is ordered (paths) or unordered. Using is_path = TRUE indicates that the nodes are ordered. Using is_path = FALSE indicates that the nodes are an unordered collection, often from find_nodes or grow_nodes.

Using is_path = TRUE: When the node collection is ordered, the object is assumed to be the result of find_paths or a subset of such an object. Because find_paths returns a list of paths lists, summarize_semtypes takes a single path, a list of paths, or a list of path lists as input. In the case of a collection of ordered nodes, summarize_semtypes counts the semantic types present in object. If a node is associated with multiple semantic types, each type is counted once. The first and last nodes of each path are removed they correspond to the nodes in from and to from find_paths, and it is assumed that the middle nodes on the paths are more of interest. The tabulations are printed to screen (if print = TRUE) and returned as table's. These table's are bundled into a list-column of a tbl in the (invisbly returned) output. Each row of the tbl corresponds to a from-to pair present in object.

Using is_path = FALSE: This option is for summarizing results from find_nodes and grow_nodes, which return unordered node sets. (Note: paths and unordered node sets are both represented as igraph vertex sequences (class igraph.vs).) The printed output shows information for each semantic type present in object. It shows all nodes of that semantic type as well as their degree and degree percentile within the entire graph. The (invisibly returned) output combines all of the printed information in a tbl.

Value

Output is returned invisibly. If is_path = TRUE, a tbl where each row corresponds to a from-to pair in object. The last column is a list-column containing table's of semantic type counts. If is_path = FALSE, a tbl where each row corresponds to a name-semantic type combination. Columns give node name, semantic type, degree, and degree percentile.

See Also

summarize_predicates for summarizing predicates on edges

find_paths for searching for paths between node sets

find_nodes and grow_nodes for searching for and filtering nodes

Examples

1
2
3
4
5
6
7
8
9
data(g_mini)

node_cortisol <- find_nodes(g_mini, "Serum cortisol")
node_stress <- find_nodes(g_mini, "Chronic Stress")
paths <- find_paths(g_mini, from = node_cortisol, to = node_stress)
summarize_semtypes(g_mini, paths)

nodes_mood <- find_nodes(g_mini, "mood")
summarize_semtypes(g_mini, nodes_mood, is_path = FALSE)

lmyint/rsemmed documentation built on July 26, 2021, 1:20 a.m.