calculate_kmer_enrichment: _k_-mer Enrichment between Foreground and Background Sets

View source: R/k-mer-based.R

calculate_kmer_enrichmentR Documentation

k-mer Enrichment between Foreground and Background Sets

Description

Calls compute_kmer_enrichment to compute k-mer enrichment values for multiple foregrounds. Calculates enrichment for foreground sets in parallel.

Usage

calculate_kmer_enrichment(
  foreground_sets,
  background_set,
  k,
  permutation = FALSE,
  chisq_p_value_threshold = 0.05,
  p_adjust_method = "BH",
  n_cores = 4
)

Arguments

foreground_sets

list of foreground sets; a foreground set is a character vector of DNA or RNA sequences (not both) and a strict subset of the background_set

background_set

character vector of DNA or RNA sequences that constitute the background set

k

length of k-mer, either 6 for hexamers or 7 for heptamers

permutation

if TRUE, only the enrichment value is returned (efficiency mode used for permutation testing)

chisq_p_value_threshold

threshold below which Fisher's exact test is used instead of Pearson's chi-squared test

p_adjust_method

see p.adjust

n_cores

number of computing cores to use

Value

A list with three entries:

dfs a list of data frames with results from compute_kmer_enrichment for each of the foreground sets
kmers a character vector of all k-mers
kmer_origins a list of k-mers and their original sequence(s)

See Also

Other k-mer functions: check_kmers(), compute_kmer_enrichment(), count_homopolymer_corrected_kmers(), create_kmer_origin_list(), draw_volcano_plot(), estimate_significance(), estimate_significance_core(), generate_kmers(), generate_permuted_enrichments(), run_kmer_spma(), run_kmer_tsma()

Examples

# define simple sequence sets for foreground and background
foreground_set1 <- c(
  "CAACAGCCUUAAUU", "CAGUCAAGACUCC", "CUUUGGGGAAU",
  "UCAUUUUAUUAAA", "AAUUGGUGUCUGGAUACUUCCCUGUACAU",
  "AUCAAAUUA", "AGAU", "GACACUUAAAGAUCCU",
  "UAGCAUUAACUUAAUG", "AUGGA", "GAAGAGUGCUCA",
  "AUAGAC", "AGUUC", "CCAGUAA"
)
foreground_set2 <- c("UUAUUUA", "AUCCUUUACA", "UUUUUUU", "UUUCAUCAUU")
foreground_sets <- list(foreground_set1, foreground_set2)
background_set <- c(foreground_set1, foreground_set2,
                    "CCACACAC", "CUCAUUGGAG", "ACUUUGGGACA", "CAGGUCAGCA")

# single-threaded
kmer_enrichment_values_st <- calculate_kmer_enrichment(foreground_sets,
  background_set, 6, n_cores = 1)
## Not run: 
# multi-threaded
kmer_enrichment_values_mt <- calculate_kmer_enrichment(foreground_sets,
  background_set, 6)
## End(Not run)

kkrismer/transite documentation built on July 13, 2024, 8:01 a.m.