#' Creates many copies of a random DNA sequence of a prescribed length
#'
#' This uniformly chooses A, C, G or T at every position
#'
#' @param sequence_length The length of the sequence to be generated
#' @param n The number of copies of the random sequence to be returned
#' @return A list of characters (all the same) that are generated randomly
#' @export
get_random_sequence <- function(sequence_length, n = 1)
{
return(rep(strsplit(
# create a random DNA sequence
stringi::stri_rand_strings(
1, sequence_length, pattern = "[TCAG]"),
# split the string into nucleotides
split = ""),
# repeat the string n times
n))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.