Skip to content
Snippets Groups Projects
Select Git revision
  • a2af841f1a1c2aa348212630b3e64a8493b7343c
  • master default protected
  • jkende-master-patch-56415
3 results

Architecture_and_design.rst

Blame
  • Architecture_and_design.rst 1.54 KiB

    Architecture and Design

    Exercises

    14   Exercise

    Create 2 classes

    • Sequence
    • MutableSequence

    These 2 classes have same attributes but Sequence can be mutate and extend whereas Sequence are immutable.

    example of code using these classes:

    >>> eco = Sequence('toto' , 'GAATTC')
    >>> eco.mutate(1, 'T')
    >>> eco.sequence
    'GTATTC'
    >>> eco.mutate(10, 'T')
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "mutableSequence.py", line 97, in mutate
        raise ValueError("pos must be >0 and < {}".format(len(self._sequence)))
    ValueError: pos must be >0 and < 6

    15   Exercise

    how can you modeling

    • non mutable DNA sequence
    • mutable DNA sequence
    • non mutable amino acid sequence
    • mutable amino acid sequence

    can you easily extend your model to support no mutable/ mutable RNA sequence ?

    :download:`multi_inheritance.py <_static/code/multi_inheritance.py>`

    16   Exercise

    work with in small groups (2-3 people). To solve a problem we need to design

    • genome
    • gene
    • sequence

    in context in eukaryote and prokaryote. propose an architecture. you hav not to implement methods just do a schema of the components and the relations between the components.

    Note

    you can add objects not listed above if you need for your architecture.