1 / 19

Viking database!

Viking database!. Family tree of Gorm den Gamle, Harald Blåtand, Svend Tveskæg .. Build new class for representing this tree..?. tree.py. No!. We already have a generic tree class: Phylogeny_node. general_tree.py. Create copy with more general name

wright
Download Presentation

Viking database!

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Viking database! Family tree of Gorm den Gamle, Harald Blåtand, Svend Tveskæg .. Build new class for representing this tree..?

  2. tree.py No! We already have a generic tree class: Phylogeny_node

  3. general_tree.py • Create copy with more general name • Build Royal class as a subclass of this class: • Needs same attributes and methods, plus perhaps more

  4. royal_vikings.py (part 1) Overrides __str__ method of Node class • A Royal viking in a family tree has a father/parent node, a name, and a string representing the reigning period (if viking was queen/king)

  5. royal_vikings.py (part 2) Test program Not queen/king: no reign given

  6. royal_vikings.py (part 3) [..] Name: Svend Estridsen Parent: Estrid Siblings: Sons: Harald Hen, Knud den Hellige, Oluf Hunger, Erik Ejegod, Niels (f)ather, (s)on, si(b)ling, (p)rint, (q)uit? f Name: Estrid Parent: Svend Tveskæg Siblings: Harald 2., Knud den Store Sons: Svend Estridsen (f)ather, (s)on, si(b)ling, (p)rint, (q)uit? b Number of sibling (0-1)? 1 Name: Knud den Store Parent: Svend Tveskæg Siblings: Harald 2., Estrid Sons: Knud 3. Hardeknud (f)ather, (s)on, si(b)ling, (p)rint, (q)uit? p Knud den Store (1014-1035) - Svend Tveskæg (987-1014) - Harald Blåtand (958-987) – Gorm den Gamle (?-958) Navigating the family tree, starting with Niels

  7. Another kind of tree: Newick trees ((monkey:100.85,cat:47.14):20.59); 20.59 47.14 100.85 cat monkey

  8. Project: Newick trees Load and parse newick tree file Need newick class Newick node has name, list of sons, distance to father, sequence Inherit from general_tree's Node class! Need parser Check that loaded tree corresponds to “current sequences” Create (ID, sequence) dictionary from current seqs (efficient!) After parsing tree file, traverse tree and look up sequence from each node ID, store in node Give error message if ID not found Calculate “Average Hamming error”

  9. Project: Newick trees Load and parse newick tree file Need newick class Newick node has name, list of sons, distance to father, sequence Inherit from general_tree's Node class! Need parser Check that loaded tree corresponds to “current sequences” Create (ID, sequence) dictionary from current seqs (efficient!) After parsing tree file, traverse tree and look up sequence from each node ID, store in node Give error message if ID not found Calculate “Average Hamming error”

  10. Average Hamming Error in tree Average number of mismatches per alignment position over all alignments in tree (2+1+1+1)/(5+6+5+4) = 5/20 = 0.25 errors per alignment position CATAT 1/4 1/5 CGATAT GTAT 1/6 2/5 CGTAT CGAGAT

  11. hamming.py (part 1) Newick_node derives from Node Exercise: Newick_node method CATAT CGATAT GTAT CGTAT CGAGAT

  12. hamming.py (part 1) CATAT mismatches = 0 alignmentlength = 0 CGATAT GTAT 0/0 2/5 CGTAT CGAGAT

  13. hamming.py (part 1) CATAT mismatches = 2 alignmentlength = 5 CGATAT GTAT 0/0 0/0 2/5 1/6 CGTAT CGAGAT

  14. hamming.py (part 1) CATAT mismatches = 3 alignmentlength = 11 CGATAT GTAT 0/0 1/6 CGTAT CGAGAT

  15. hamming.py (part 1) CATAT 3/11 CGATAT GTAT CGTAT CGAGAT

  16. hamming.py (part 1) CATAT 3/11 0/0 1/5 1/4 CGATAT GTAT CGTAT CGAGAT

  17. hamming.py (part 1) 5/20 CATAT 3/11 0/0 1/5 1/4 CGATAT GTAT CGTAT CGAGAT

  18. hamming.py (part 2) Average Hamming Error CATAT CGATAT GTAT CGTAT CGAGAT Average Hamming error: 0.250

  19. .. on to the exercises

More Related