Skip to contents

This function takes a DNA or RNA sequence as input and removes any characters that are not A, C, G, T (for DNA) or A, C, G, U (for RNA).

Usage

clean_sequence(sequence, type = "DNA")

Arguments

sequence

A character string containing the DNA or RNA sequence to be cleaned.

type

A character string indicating the type of sequence. The default is "DNA". If set to "RNA", the function will remove any characters that are not A, C, G, U.

Value

A character string containing the cleaned DNA or RNA sequence.

Examples

clean_sequence("atgcNnRYMK") # Returns "ATGC"
#> [1] "ATGC"
clean_sequence("auggcuuNnRYMK", type = "RNA") # Returns "AUGGCUU"
#> [1] "AUGGCUU"