calc_string_entropy_k_mer: Calculate Shannon Entropy for K-mers in a String

View source: R/extract_features_from_bam.R

calc_string_entropy_k_merR Documentation

Calculate Shannon Entropy for K-mers in a String

Description

This function computes the Shannon entropy for all possible k-mers within a given string. Shannon entropy is a measure of the unpredictability of the k-mer composition, with higher values indicating more diversity. This function is useful in bioinformatics for analyzing the complexity of sequences.

Usage

calc_string_entropy_k_mer(s, k = 2, alphabet = c("A", "C", "G", "T", "N"))

Arguments

s

A string for which the Shannon entropy is to be calculated.

k

The size of the k-mers (substrings of length k) to be considered for entropy calculation. The default value is 2.

alphabet

A vector of characters representing the possible nucleotides or readings in the string. The default set includes "A", "C", "G", "T", "N".

Value

Returns a numeric value representing the Shannon entropy of the k-mers in the string. This entropy value is a measure of the randomness or diversity of k-mer composition.


JakobPedersenLab/dreams documentation built on Feb. 2, 2024, 3:14 p.m.