make_labels: Make labels for a classifier based on a gold standard

Description Usage Arguments Value Examples

View source: R/make_labels.R

Description

Create labels for a classifier for protein pairs in the same order as in a dataset that will be used as input to a classifier, in a memory-friendly way.

Usage

1
make_labels(gold_standard, dat, node_columns = c(1, 2), protein_groups = NULL)

Arguments

gold_standard

an adjacency matrix of gold-standard interactions

dat

a data frame with interacting proteins in the first two columns

node_columns

a vector of length two, denoting either the indices (integer vector) or column names (character vector) of the columns within the data frame containing the nodes participating in pairwise interactions; defaults to the first two columns of the data frame (c(1, 2))

protein_groups

optionally, specify a list linking each protein in the first two columns of the input data frame to a protein group

Value

a vector of the same length as the input dataset, containing NAs for protein pairs not in the gold standard and ones or zeroes based on the content of the adjacency matrix

Examples

1
2
3
4
5
6
data(gold_standard)
adj <- adjacency_matrix_from_list(gold_standard)
proteins <- unique(unlist(gold_standard))
dat <- data.frame(protein_A = sample(proteins, 10), 
                  protein_B = sample(proteins, 10))
labels <- make_labels(adj, dat)

fosterlab/PrInCE-R documentation built on Dec. 11, 2020, 3:51 p.m.