predict_signature: Function to predict using SuperSig object

Description Usage Arguments Value Examples

View source: R/predict_signature.R

Description

Using a generated SuperSig, predict on a new dataset and return predicted probabilities for each observation.

Usage

1
predict_signature(object, newdata, factor)

Arguments

object

an object of class SuperSig

newdata

a data frame of mutations containing columns for sample_id, age, IndVar, and the 96 trinucleotide mutations (see vignette for details)

factor

the factor/exposure (e.g. "age", "smoking")

Value

predict_signature returns the original data frame with additional columns for the feature counts and classification score

Examples

1
2
3
4
5
6
7
head(example_dt) # use example data from package
input_dt <- make_matrix(example_dt) # convert to correct format
input_dt$IndVar <- c(1, 1, 1, 0, 0) # add IndVar column
out <- get_signature(data = input_dt, factor = "Age") # get SuperSig
newdata <- predict_signature(out, newdata = input_dt, factor = "age")
suppressPackageStartupMessages({library(dplyr)})
head(newdata %>% select(score))

TomasettiLab/supersigs documentation built on Dec. 13, 2021, 12:53 a.m.