diff --git a/NAMESPACE b/NAMESPACE index c221e86..965ab39 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -3,6 +3,7 @@ export(all_interactions) export(all_uniprot_acs) export(all_uniprots) +export(ambiguity) export(ancestors) export(annotated_network) export(annotation_categories) @@ -315,6 +316,7 @@ importFrom(dplyr,bind_cols) importFrom(dplyr,bind_rows) importFrom(dplyr,c_across) importFrom(dplyr,case_when) +importFrom(dplyr,cur_group_id) importFrom(dplyr,distinct) importFrom(dplyr,filter) importFrom(dplyr,first) @@ -541,6 +543,7 @@ importFrom(tidyselect,any_of) importFrom(tidyselect,ends_with) importFrom(tidyselect,eval_select) importFrom(tidyselect,everything) +importFrom(tidyselect,last_col) importFrom(tidyselect,starts_with) importFrom(tidyselect,vars_select_helpers) importFrom(tidyselect,where) diff --git a/man/ambiguity.Rd b/man/ambiguity.Rd new file mode 100644 index 0000000..884f253 --- /dev/null +++ b/man/ambiguity.Rd @@ -0,0 +1,53 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/id_mapping.R +\name{ambiguity} +\alias{ambiguity} +\title{Inspect the ambiguity of a mapping} +\usage{ +ambiguity( + d, + from_col, + to_col, + groups = NULL, + record_id = NULL, + quantify = TRUE, + qualify = TRUE, + expand = NULL +) +} +\arguments{ +\item{d}{Data frame: a data frame with two columns to be inspected. It might +contain arbitrary other columns. Existing grouping will be removed.} + +\item{groups}{Character vector of column names. Inspect ambiguity within +these groups; by default, ambiguity is determined across all rows.} + +\item{record_id}{Character or symbol: a column identifying unique records; +if not provided, each row will be considered a unique record.} + +\item{quantify}{Logical or character: inspect the mappings for each +ID for ambiguity. If TRUE, for each translated column, two new columns +will be created with numeric values, representing the ambiguity of the +mapping on the "from" and "to" side of the translation, respectively. +If a character value provided, it will be used as a column name suffix +for the new columns.} + +\item{qualify}{Logical or character: inspect the mappings for each +ID for ambiguity. If TRUE, for each translated column, a new column +will be inculded with values `one-to-one`, `one-to-many`, `many-to-one` +or `many-to-many`. If a character value provided, it will be used as a +column name suffix for the new column.} + +\item{expand}{Logical: override the expansion of target columns, including +`to_col`: by default, this function expands data into multiple rows if +the `to_col` has already been expanded. Using this argument, the +`to_col` and other target columns will be lists of vectors for `expand = +FALSE`, and simple vectors for `expand = TRUE`.} +} +\value{ +A data frame (tibble) with ambiguity information added in new + columns, as described at the "quantify" and "qualify" arguments. +} +\description{ +Inspect the ambiguity of a mapping +} diff --git a/man/translate_ids.Rd b/man/translate_ids.Rd index 20d5f64..954c559 100644 --- a/man/translate_ids.Rd +++ b/man/translate_ids.Rd @@ -20,8 +20,9 @@ translate_ids( complexes = NULL, complexes_one_to_many = NULL, track = FALSE, - inspect = FALSE, - inspect_grp = NULL, + quantify_ambiguity = FALSE, + qualify_ambiguity = FALSE, + ambiguity_groups = NULL, expand = TRUE ) } @@ -85,11 +86,20 @@ will be used.} \item{track}{Logical: Track the records (rows) in the input data frame by adding a column \code{record_id} with the original row numbers.} -\item{inspect}{Logical: inspect the mappings for each ID for ambiguity. -If TRUE, for each translated column, a new column will be inculded with -values \code{one-to-one}, \code{one-to-many}, \code{many-to-one} or \code{many-to-many}.} +\item{quantify_ambiguity}{Logical or character: inspect the mappings for each +ID for ambiguity. If TRUE, for each translated column, two new columns +will be created with numeric values, representing the ambiguity of the +mapping on the "from" and "to" side of the translation, respectively. +If a character value provided, it will be used as a column name suffix +for the new columns.} -\item{inspect_grp}{Character vector: additional column names to group by +\item{qualify_ambiguity}{Logical or character: inspect the mappings for each +ID for ambiguity. If TRUE, for each translated column, a new column +will be inculded with values \code{one-to-one}, \code{one-to-many}, \code{many-to-one} +or \code{many-to-many}. If a character value provided, it will be used as a +column name suffix for the new column.} + +\item{ambiguity_groups}{Character vector: additional column names to group by during inspecting ambiguity. By default, the identifier columns (from and to) will be used to determine the ambiguity of mappings.}