extract_all_prob: Extract probabilities using bayes' thereom

View source: R/extract_all_prob.R

extract_all_probR Documentation

Extract probabilities using bayes' thereom

Description

extract_all_prob() implements bayes' thereom to get the probabilites of a mutation coming from a specific signature

Usage

extract_all_prob(mutation, signatures, contribution)

Arguments

mutation

Input string of the mutation type to look at. Formatted examples: C[C>A]T, G[T>C]A

signatures

Matrix of the signatures relevent in sample

contributions

Matrix of how much each signature contributed to the samples

Value

A vector of the posteriors

Examples


library(MutationalPatterns)
library(tidyverse)

cosmic.sigs <- get_known_signatures()

# Get signatures
signatures <- matrix(nrow = 96, ncol = 2)
signatures[,1] <- cosmic.sigs[,4]
signatures[,2] <- get_ffpe_signature()# Naming columns and rows
colnames(signatures) <- c("SBS4", "FFPE")
rownames(signatures) <- get_mutation_types()

# Get contributions
contribution <- matrix(nrow = 2, ncol = 1)
contribution[,1] <- c(0.5, 0.5)
rownames(contribution) <- c("SBS4", "FFPE")

mutation <- "A[C>T]A"
extract_all_prob(mutation, signatures, contribution)

popopo19/excerno documentation built on Aug. 28, 2022, 1:23 a.m.