find_nodes {rsemmed} | R Documentation

## Search for nodes by name or semantic type

### Description

Search for nodes by name (exact match or using regular expressions) or which match supplied semantic types. Perform anti-matching by setting `match = FALSE`. Capitalization is ignored.

### Usage

    find_nodes(obj, pattern = NULL, names = NULL, semtypes = NULL, match = TRUE)

### Arguments

`obj` | Either the SemMed graph or a node set (`igraph.vs`)
`pattern` | Regular expression used to find matches in node names
`names` | Character vector of exact node names
`semtypes` | Character vector of semantic types
`match` | If `TRUE`, return nodes that DO match `pattern` (default). If `FALSE`, return nodes that DO NOT match.

### Value

A vertex sequence of matching nodes

### Examples

    data(g_mini)
    find_nodes(g_mini, pattern = "cortisol")
    find_nodes(g_mini, pattern = "cortisol$")
    find_nodes(g_mini, pattern = "stress")
    find_nodes(g_mini, pattern = "stress") %>%
        find_nodes(pattern = "disorder", match = FALSE)

    find_nodes(g_mini, names = "Serum cortisol")
    find_nodes(g_mini, names = "Chronic Stress")

    find_nodes(g_mini, semtypes = "dsyn")
    find_nodes(g_mini, semtypes = c("dsyn", "fndg"))

    ## pattern and semtypes are combined via OR:
    find_nodes(g_mini, pattern = "cortisol", semtypes = "horm")

    ## To make an AND query, chain find_nodes sequenctially:
    find_nodes(g_mini, pattern = "cortisol") %>%
        find_nodes(semtypes = "horm")

[Package rsemmed version 1.4.0 Index]