Module 12
Filtering by GC
Selecting sequences by GC content.
Selecting by GC
You can filter sequences by their GC content, keeping only those above a threshold.
def gc(seq):
return (seq.count("G") + seq.count("C")) / len(seq) * 100
seqs = ["ATAT", "GCGC", "ATGC"]
high_gc = [s for s in seqs if gc(s) >= 50]
print(high_gc)Your task
Filter by GC
- Keep sequences with GC >= 50%.