diff --git a/source/_static/code/gc_percent.py b/source/_static/code/gc_percent.py index 0f6575d5e0e206954b582f486b0923b01b8a9298..a9abe85aad840581c25a3f1df7acdc7f99e1789c 100644 --- a/source/_static/code/gc_percent.py +++ b/source/_static/code/gc_percent.py @@ -1,11 +1,13 @@ def gc_percent(seq): """ + Compute the ratio of GC in a DNA sequence + :param seq: The nucleic sequence to compute :type seq: string :return: the percent of GC in the sequence :rtype: float """ seq = seq.upper() - gc_pc = float(seq.count('G') + seq.count('C')) / float(len(seq)) + gc_pc = seq.count('G') + seq.count('C') / len(seq) return gc_pc