|
|
||
|---|---|---|
| data | ||
| include | ||
| resources | ||
| src | ||
| tests | ||
| .gitattributes | ||
| .gitignore | ||
| CMakeLists.txt | ||
| Makefile | ||
| README.md | ||
README.md
DNA++
Instructions
- Create a base class Sequence that represents a generic sequence. Include the following attributes and methods:
- Attributes:
- sequence: A string representing the sequence itself.
- Methods:
__init__(self, sequence): Initialize the sequence.get_length(self): Return the length of the sequence.get_sequence(self): Return the sequence as a string.
- Attributes:
- Create a subclass DNASequence that inherits from the Sequence class. Add the following methods:
get_complement(self): Return the complementary DNA sequence. A pairs with T, and C pairs with G.transcribe_to_rna(self): Return the RNA sequence by replacing all T's with U's.
- Create another subclass ProteinSequence that inherits from the Sequence class. Add a method
translate_to_protein(self)that translates the DNA sequence into a protein sequence using the genetic code (you can use a dictionary to map codons to amino acids). - Provide an example DNA sequence and demonstrate the functionality of your program by:
- Creating a DNA sequence object.
- Getting its complement and transcribed RNA sequence.
- Translating it into a protein sequence.
Hints:
- You can create a dictionary to represent the genetic code, where keys are codons (triplets of nucleotides), and values are the corresponding amino acids.
- The complement of a DNA sequence can be found by replacing A with T, T with A, C with G, and G with C.