For a given ID, find all sub IDs and their sub IDs etc. The type of relationship can be selected too. This is a helper function for other functions.
find_all_subs(
data,
ids,
main_id = id,
type = type,
accepted_types = "is_a",
exclude_parent_id = FALSE
)
a data frame that contains relational information on IDs (main_id) their sub
IDs (sub_id) and their relationship (type). For ChEBI this data frame can be obtained by calling
fetch_chebi(relation = TRUE)
. For ECO data it can be obtained by calling fetch_eco(relation = TRUE).
a character vector of IDs for which sub IDs should be searched.
a character or integer column containing IDs. Default is id
for ChEBI IDs.
a character column that contains the type of interactions. Default is type
for ChEBI IDs.
a character vector containing the accepted_types of relationships that should be considered for the search. It is possible to use "all" relationships. The default type is "is_a". A list of possible relationships for e.g. ChEBI IDs can be found here.
a logical value that specifies if the parent ID should be included in the returned list.
A list of character vectors containing the provided ID and all of its sub IDs. It contains one element per input ID.