Skip to contents

Recreate interaction records from evidences columns

Usage

from_evidences(data, .keep = FALSE)

Arguments

data

An interaction data frame from the OmniPath web service with evidences column.

.keep

Logical: keep the original "evidences" column when unnesting to separate columns by direction.

Value

A copy of the input data frame with all the standard columns describing the direction, effect, resources and references of the interactions recreated based on the contents of the nested list evidences column(s).

Details

The OmniPath interaction data frames specify interactions primarily by three columns: "is_directed", "is_stimulation" and "is_inhibition". Besides these, there are the "sources" and "references" columns that are always included in data frames created by OmnipathR and list the resources and literature references for each interaction, respectively. The optional "evidences" column is required to find out which of the resources and references support the direction or effect sign of the interaction. To properly recover information for arbitrary subsets of resources or datasets, the evidences can be filtered first, and then the standard data frame columns can be reconstructed from the selected evidences. This function is able to do the latter. It expects either an "evidences" column or evidences in their wide format 4 columns layout. It overwrites the standard columns of interaction records based on data extracted from the evidences, including the "curation_effort" and "consensus..." columns.

Note: The "curation_effort" might be calculated slightly differently from the version included in the OmniPath web service. Here we count the resources and the also add the number of references for each resource. E.g. a resource without any literatur reference counts as 1, while a resource with 3 references adds 4 to the value of the curation effort.

Note: If the "evidences" column has been already unnested to multiple columns ("positive", "negative", etc.) by unnest_evidences, then these will be used; otherwise, the column will be unnested within this function.

Note: This function (or rather its wrapper, only_from) is automatically applied if the `strict_evidences` argument is passed to any function querying interactions (e.g. import_omnipath_interactions).

Examples

if (FALSE) {
ci <- collectri(evidences = TRUE)
ci <- unnest_evidences(ci)
ci <- filter_evidences(datasets = 'collectri')
ci <- from_evidences(ci)
# the three lines above are equivalent to only_from(ci)
# and all the four lines above is equivalent to:
# collectri(strict_evidences = TRUE)
}