genetics.complementary_dna()

Create the complementary DNA sequence.

Usage

Source

genetics.complementary_dna(dna_sequence)

Generates the complementary strand by replacing each nucleotide with its complement: A↔︎T and G↔︎C. Non-standard nucleotides are replaced with ‘X’.

Parameters

dna_sequence: str
The DNA sequence to complement. Case-insensitive.

Returns

str: str
The complementary DNA sequence as a string.

Examples

    >>> complementary_dna("ATGC")
'TACG'
    >>> complementary_dna("ATGN")
'TACGX'