genetics.atgc_content()

Calculate the nucleotide composition of a DNA sequence.

Usage

Source

genetics.atgc_content(dna_sequence)

Counts the occurrences of each nucleotide (A, T, G, C) in the sequence. Non-standard nucleotides are ignored in the count.

Parameters

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

Returns

dict: Dict[str, int]
A dictionary with keys ‘A’, ‘T’, ‘G’, ‘C’ and their counts as values.

Examples

    >>> atgc_content("ATGCGAT")
{'A': 2, 'T': 2, 'G': 2, 'C': 1}