Module 12
Reusable analysis functions
Building tools you can reuse.
Building tools
The best analyses are built from reusable functions. Each function does one thing well.
def analyze(seq):
return {
"length": len(seq),
"gc": (seq.count("G") + seq.count("C")) / len(seq) * 100
}
print(analyze("ATGCGCAT"))Your task
Reusable function
- Write analyze(seq) that returns length and gc.