Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "1 Viking database! Family tree of Gorm den Gamle, Harald Blåtand, Svend Tveskæg.. Build new class for representing this tree..?"— Presentation transcript:

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

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

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

4 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) royal_vikings.py (part 1) Overrides __str__ method of Node class

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

6 Navigating the family tree, starting with Niels 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 ( ) - Svend Tveskæg ( ) - Harald Blåtand ( ) – Gorm den Gamle (?-958)

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

8 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 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 10 Average Hamming Error in tree Average number of mismatches per alignment position over all alignments in tree ( )/( ) = 5/20 = 0.25 errors per alignment position CGTAT CGATAT CGAGAT GTAT CATAT 2/5 1/6 1/5 1/4

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

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

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

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

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

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

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

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

19 19.. on to the exercises


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

Similar presentations


Ads by Google