Bringing it all Together: Family Trees

Slides:



Advertisements
Similar presentations
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 25: Trees and Generalized Lists.
Advertisements

Intro to Genetics DOROTHY HAINS STEM DEPARTMENT. STANDARDS S5L2: Students will understand that offspring can look and act like their parents because they.
Arbitrarily Long Data Structures: Lists and Recursion CMSC Introduction to Computer Programming October 4, 2002.
Scheme: Lists Cont’d Chapter 9-10 of HTDP Ms. Knudtzon September 26.
CS CS1321: Introduction to Programming Georgia Institute of Technology College of Computing Lecture 11 Sept 27th, 2001 Fall Semester.
1 Lisp Functions –Built-in functions –Defining functions –Function Evaluation and Special Forms defun, if Control statements –Conditional if, cond –Repetition.
Data Structures: Binary Trees CMSC Introduction to Computer Programming October 28, 2002.
Recursion: Linear and Tree Recursive Processes and Iteration CMSC Introduction to Computer Programming October 7, 2002.
Mutual Recursion: Web pages CMSC Introduction to Computer Programming November 25, 2002.
18-October-2002cse Symbols © 2002 University of Washington1 Symbols CSE 413, Autumn 2002 Programming Languages
Abstraction: Procedures as Parameters CMSC Introduction to Computer Programming October 14, 2002.
Data Abstraction: Sets Binary Search Trees CMSC Introduction to Computer Programming October 30, 2002.
Genetics Basic rules… Lots of info is being researched by the Human Genome Project….
Comp book Open your comp book to pg. 51 to take notes. Set up your notes Cornell style. Remember: The best notes are notes that you organize on your own.
Notes. Gene Symbols 1.All organisms have least two genes for every trait. 2.They receive at least one from each parent. _Symbols_ are used to help predicting.
EQ1: How do we inherit traits from our parents? EQ2: Is inheritance predictable?
CS CS1321: Introduction to Programming Georgia Institute of Technology College of Computing Lecture 13 October 4, 2001 Fall Semester.
Polygenic Traits: Co-dominance & Incomplete dominance.
E.S.L. © 2008 Quinín Freire Family. Mom and Dad Father and son.
Gene Every human has a gene for eye color. Gene: A piece of DNA that codes for a protein.
Heredity & Genetics.
Punnett Squares. Are traits and variations equally shown?  Are all traits and their variations equally shown in organisms?  Why not?  If your mom has.
Reproduction Reproduction is the process of producing a new organism. The purpose is to transfer DNA.
Data Abstraction: Sets
Additional Scheme examples
CS 5010 Program Design Paradigms “Bootcamp” Lesson 5.2
Question 1: How can the child of two brown-eyed parents have blue eyes? ( in such case which kind of dominance presents here?.)
Warm Up: What is the definition of genetics? The study of heredity.
Complex Inheritance Whiteboard Practice
From Templates to Folds
4.1 Living Things Inherit Traits in Patterns
Do Now What is the relationship between a chromosome, a gene, and DNA?
Mendelian Genetics.
Probability of Heredity
Investigating Human Traits
A Closer Look at Conception
Ch. 12 Genetics.
Presented by Kesler Science
Example: Let’s examine a dog’s hair color AND a dog’s eye color
Punnett squares.
Genetics.
Genetics Chapter 10—pages
Heredity: All About You
Ch. 12 Genetics.
A Closer Look at Conception
Presented by Kesler Science
CS 5010 Program Design Paradigms “Bootcamp” Lesson 6.5
Let's Play "What's the Question"
Investigating Human Traits
Heredity.
The science of heredity Frank Gregorio
Developing Programs for Family Trees
Inheritance Practice Test
Inheritance Practice Test
Family.
Marcellin Biology Notes
By : Kaylee and Khaleema
I II III = Huntington's Disease
From Parents to Offspring
GENETICS.
GENETICS.
Inherited Traits Living things get or inherit traits, such as, eye color or face shape from their parents. Heredity is the process through which traits.
EQ: How do genotypes affect phenotypes?
Changing Data: (Continued)
TRAITS Traits are personal characteristics. They are things about you, such as how you look or what you like.
Are You… ? Male Female Right Handed Left Handed Tall for Age
Presentation transcript:

Bringing it all Together: Family Trees CMSC 11500 Introduction to Computer Programming October 18, 2002

Roadmap An integrated example: Family trees Building the data definition Structures of structures Using the data From data definition to template Traversing family trees Heredity: traits Simplifying with Let

Family Trees Each child has: mother, father, & some attributes - e.g. birthdate, hair color, eye color Granny: Eyes: Brown Grandpa: Eyes: Blue Mom: Eyes: Green Dad: Eyes: Brown Jane: Eyes: Hazel John: Eyes: Brown

Data Definition A family-tree is ‘unknown, or (make-ft name eye-color mother father) where name, eye-color are symbols; mother,father are family-tree (define-struct ft (name eye-color mother father) (make-ft ‘Granny ‘Blue ‘unknown ‘unknown) (make-ft ‘John ‘Brown (make-ft ‘Mom ‘Green (…) (…))…..)

Defining Functions: Data definition to Template A family-tree is: - unknown, or - (make-ft name eye-color mother father) Questions: How many kinds of family-tree? # pieces in 1st part? # pieces in 2nd part? Self-references? - Do What?

Defining Functions: Data definition to Template A family-tree is: - unknown, or - (make-ft name eye-color mother father) Template: (define (fn-for-f-tree aft) (cond ((eq? ‘unknown aft) …) ((ft? aft) … (ft-name aft)… … (ft-eye-color aft)… … (fn-for-f-tree (ft-mother aft)). … (fn-for-f-tree (ft-father aft))..

Things to do with Family Trees Find ancestor(s) with certain traits e.g. eye-color, born before some date Find all traits for all relatives Compute relations between individuals Determine if they are related by blood

Blue-Eyed Ancestor Contract:b-e-a: family-tree ->symbol Purpose: Find a blue-eyed ancestor

Blue-eyed-ancestor (define (b-e-a aft) (cond ((eq? ‘unknown aft) #f) ((ft? aft) (if (eq? (ft-eye-color aft) ‘blue) (ft-name aft) (let ((b-e-m (b-e-a (ft-mother aft))) (b-e-f (b-e-a (ft-father aft)))) (cond ((symbol? b-e-m) b-e-m) ((symbol? b-e-f) b-e-f) (else #f))))))

All-blue-eyed-ancestors Get all ancestors (not just first) Contract: a-b-e-a: family-tree -> (listof symbol) Purpose: Find all blue-eyed-ancestors Helper: “append” (append ‘(a b c) ‘(a b c)) -> ‘(a b c) (define (append list1 list2) (cond ((null? list1) list2) (else (cons (car list1) (append (cdr list1) list2)))

All-blue-eyed-ancestors (define (a-b-e-a aft) (cond ((eq? ‘unknown aft) ‘()) ((ft? aft) (if (eq? (ft-eye-color aft) ‘blue) (cons (ft-name aft) (append (a-b-e-a (ft-mother aft)) (a-b-e-a (ft-father aft)))) (append (a-b-e-a (ft-mother aft)) (a-b-e-a (ft-father aft))))))))

All-blue-eyed-ancestors (define (a-b-e-a aft) (cond ((eq? ‘unknown aft) ‘()) (else (let ((in-parents (append (a-b-e-a (ft-mother aft)) (a-b-e-a (ft-father aft))))) (if (eq? (ft-eye-color aft) ‘blue) (cons (ft-name aft) in-parents) in-parents))))))

Next Time Data structures and analysis Sets