INNER CODE UNIT · Python
seq_gc
open2c/bioframe · src/bioframe/extras.py:324
def seq_gc(seq, mapped_only=True):
"""
Calculate the fraction of GC basepairs for a string of nucleotides.
Parameters
----------
seq : str
Basepair input
mapped_only: bool
if True, ignore 'N' in the sequence for calculation.
if True and there are no mapped base-pairs, return np.nan.
Returns
-------
gc : float
calculated gc content.