Module 13
Calculate statistics
Length, counts, and GC content.
Statistics
Compute the length, base counts, and GC content of the sequence.
def statistics(seq):
return {
"length": len(seq),
"A": seq.count("A"),
"T": seq.count("T"),
"G": seq.count("G"),
"C": seq.count("C"),
"gc": (seq.count("G") + seq.count("C")) / len(seq) * 100
}
print(statistics("ATGCGCAT"))Your task
Statistics
- Write statistics(seq) and test it.