View source: R/SequenceOperator.R
autoresolve_sequence_type | R Documentation |
The 'autoresolve_sequence_type' function analyzes the characters in a given sequence to determine whether it is a DNA, RNA, or protein sequence. The function uses standard IUPAC nucleotide and amino acid codes to classify the sequence based on its composition.
autoresolve_sequence_type(sequence)
sequence |
A string representing the nucleotide or protein sequence to be analyzed. The sequence should be composed of characters corresponding to standard IUPAC codes. |
A string indicating the resolved sequence type: 'DNA', 'RNA', or 'PROTEIN'. If the sequence contains ambiguous characters or does not fit clearly into one of these categories, an error is thrown.
# Example of determining the sequence type for a DNA sequence
seq_type_dna <- autoresolve_sequence_type("ATGCGTACGTAGC")
print(seq_type_dna) # Should return "DNA"
# Example of determining the sequence type for a protein sequence
seq_type_protein <- autoresolve_sequence_type("MVLSPADKTNVKAAW")
print(seq_type_protein) # Should return "PROTEIN"
# Example of an ambiguous sequence that causes an error
# autoresolve_sequence_type("ATGB") # Should throw an error due to ambiguity
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.