Function getComplementSequence

  • Given a string sequence and a nucleic acid type, get the complement sequence Optimized using string replacement for better performance

    Parameters

    • sequence: undefined | string

      The sequence to get a complement of

    • nucleicAcidType: NucleicAcidType

      The type of nucleic acid of the given sequence

    Returns undefined | string

    The complement sequence, or undefined if the input sequence was undefined

    Example

     //Get DNA complement
    getComplementSequence('ATCG', NucleicAcidType.DNA); //returns 'TAGC'

    //Get RNA complement
    getComplementSequence('AUCG', NucleicAcidType.RNA); //returns 'UAGC'