skbio.sequence.RNA.gc_content#

RNA.gc_content()[source]#

Calculate the relative frequency of G’s and C’s in the sequence.

This includes G, C, and S characters. This is equivalent to calling gc_frequency(relative=True). Note that the sequence will be degapped before the operation, so gap characters will not be included when calculating the length of the sequence.

Returns:
float

Relative frequency of G’s and C’s in the sequence.

See also

gc_frequency

Examples

>>> from skbio import DNA
>>> DNA('ACGT').gc_content()
0.5
>>> DNA('ACGTACGT').gc_content()
0.5
>>> DNA('ACTTAGTT').gc_content()
0.25
>>> DNA('ACGT--..').gc_content()
0.5
>>> DNA('--..').gc_content()
0

S means G or C, so it counts:

>>> DNA('ASST').gc_content()
0.5

Other degenerates don’t count:

>>> DNA('RYKMBDHVN').gc_content()
0.0