Created
June 10, 2022 15:10
-
-
Save CodePint/bc4cfd8312359cf3fecd439ca5d43488 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# For a string containing only the letters A C G T, how would you count the occurrences | |
# of each triplet (overlapping three character substrings)? For example, in the input | |
# string "AACTGATGCTGACTGATAGTA" the characters "TGA" appear three times. | |
# | |
# AACTGATGCTGACTGATAGTA | |
# TGA: --- --- --- | |
# | |
# Produce a Python function (or class) that calculates these triplet counts, the FORMAT | |
# and STRUCTURE of the output is up to you. | |
# | |
# Return:| Triplet | Count | | |
# | AAC | 1 | | |
# | ACT | 2 | | |
# | CTG | 3 | | |
# | TGA | 3 | | |
# | GAT | 2 | | |
# | ATG | 1 | | |
# | TGC | 1 | | |
# | GCT | 1 | | |
# | GAC | 1 | | |
# | ATA | 1 | | |
# | TAG | 1 | | |
# | AGT | 1 | | |
# | GTA | 1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment