Recreate interaction records from evidences columnsSource:
Recreate interaction records from evidences columns
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).
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.
ci <- collectri(evidences = TRUE) ci <- filter_evidences(datasets = 'collectri') #> Error: argument "data" is missing, with no default ci <- from_evidences(ci) #> Error in do.call(stop, list(m), envir = env): `from_evidences` can be called only on data frames with `evidences` column. # the two lines above are equivalent to only_from(ci) # and all the three lines above is equivalent to: # collectri(strict_evidences = TRUE)