How close is close enough? Part II Mendel vs 1000 Ideal Worlds Build the world in BioBIKE biobike.csbc.vcu.edu This demonstration is best viewed as a slide show, enabling you to simulate a session and make changes in cursor position more obvious. To do this, click Slide Show on the top tool bar, then View show. Define an ideal genetic world How? - Define genotype male-genotype female-genotype p p Pp p Pp Define an ideal genetic world How? - Define genotype - Define meiosis - Define gamete Define an ideal genetic world How? - Define genotype - Define meiosis - Define gamete - Define joining of gametes to form progeny Define an ideal genetic world How? - Define genotype - Define meiosis - Define gamete - Define joining of gametes to form progeny - Define how color is determined Define an ideal genetic world - Define genotype - Define meiosis - Define gamete - Define joining of gametes to form progeny - Define how color is determined - Define Mendel's experiment 929 crosses Define an ideal genetic world - Define genotype - Define meiosis - Define gamete - Define joining of gametes to form progeny - Define how color is determined - Define Mendel's experiment Go to the BioBIKE Portal biobike.csbc.vcu.edu Go to a public site Your name (no spaces) Enter a log in name Click New Login Function palette Workspace The BioBIKE environment is divided into three areas as shown. You'll bring functions down from the function palette to the workspace, execute them, and note the results in the results window Results window Two very important buttons on the function palette: HELP! On-line help (general) PROBLEM Something went wrong? Tell us! Two very important buttons in the workspace: Undo (return to workspace before last action) Redo (Get back the workspace you undid) male-genotype female-genotype p What now? The first step in making the ideal world is to define what are male- and femalegenotypes. Mouse over the DEFINITION button p p Click DEFINE to bring down the DEFINE function. A DEFINE function box is now in the workspace. Before continuing with the problem, let's consider what function boxes mean. General Syntax of BioBIKE Function-name Argument (object) Keyword object The basic unit of BioBIKE is the function box. It consists of the name of a function, perhaps one or more required arguments, and optional keywords and flags. A function may be thought of as a black box: you feed it information, it produces a product. Flag General Syntax of BioBIKE Function-name Argument (object) Keyword object Flag Function boxes contain the following elements: • Function-name (e.g. SEQUENCE-OF or LENGTH-OF) • Argument: Required, acted on by function • Keyword clause: Optional, more information • Flag: Optional, more (yes/no) information General Syntax of BioBIKE Function-name Argument (object) Keyword object Flag … and icons to help you work with functions: • Option icon: Brings up a menu of keywords and flags • Action icon: Brings up a menu enabling you to execute a function, copy and paste, information, get help, etc Clear/Delete icon: Removes information you entered or removes box entirely • General Syntax of BioBIKE Function-name Argument (object) Keyword object Flag … and icons to help you work with functions: • Option icon: Brings up a menu of keywords and flags • Action icon: Brings up a menu enabling you to execute a function, copy and paste, information, get help, etc Clear/Delete icon: Removes information you entered or removes box entirely • And now back to our show… The DEFINE function asks for two things: the name of the variable to be defined and the value it is to be given. Let's call the variable male-genotype. The value of male-genotype will be "Pp" Click on the variable argument box to open it up for entry… … and type male-genotype (remembering to connect the words with a hyphen), closing the box afterwards by pressing Tab. Tab closes the entry box and automatically opens the next one (if it exists). Type the genotype "Pp" (be sure to include the quotation marks) and press Enter. The definition is now complete. But it will not take effect until the function is executed Click the Action icon. … and click Execute. Notice that a new VARIABLES button appears. We'll use it later to access the newly defined variable. Notice also that the definition is confirmed by showing it in the Results Window Repeat what you did, this time defining female-genotype in the same way Now to define meiosis. Mouse over the DEFINITION button and click DEFINE, just as you did before. Click the name box… …type in meiosis, and press Enter. If you like, you can give a short summary in English what your function does, that is, what is meiosis. To do this, mouse over the summary icon… … click summary, and enter the summary of the function in the text box that appears. Finally, press Enter to accept the summary. How to define meiosis? It requires the diploid genotype of the organism and then chooses one of the chromosomes to go into a haploid gamete. The argument (input) to the function is the genotype. Click the argument box… … and enter the word genotype, a symbol that will represent whatever genotype the function is given. Then press Enter. What does meiosis do? You'll define this by putting the appropriate action into the form box. Click that box…. …how to choose a chromosome at random? BioBIKE has a CHOOSEFROM function that will serve our needs. Mouse over the ALL button… The ALL button provides BioBIKE functions in alphabetical order. Mouse over the C menu item… …and click CHOOSE-FROM. CHOOSE-FROM what? From the genotype! Click the sequence box… … and type genotype and press Enter. The definition of meiosis is now complete. To make it active, mouse over the Action Icon… …and click Execute. Notice that a new FUNCTIONS button appears. We'll use it in a moment to access the newly defined function. Notice also that the definition is confirmed by showing it in the Results Window Try out your new function. Mouse over the FUNCTION button and click Meiosis. Click on the genotype box of Meiosis. Provide it with male-genotype, by mousing over the VARIABLES button and clicking male-genotype. Execute your function as you do any other function, by mousing over the Action Icon… …and clicking Execute. The result of meiosis now appears in the Results Window. Execute the function a few more times to get a feel for what it does. With Meiosis in hand, you can now define the male and female gametes. Bring down a DEFINE box as you have previously and set the variable as male-gamete. (Be sure to remember the hyphen – you can't put spaces within variable names). Then click the value box. We want to define male-gamete as the product of meiosis working on male-genotype. You can bring down a Meiosis box into the value box, but it's easier to cut/paste the box you already have. Mouse over the Action Icon of the Meiosis function in the Workspace. …and click cut. Then mouse over the Action Icon of the value box… …and click paste. Now you can execute the definition. To define female-gamete, click on the word male-gamete, and when the box is open for editing (turns white), change male to female. Press Enter to accept this change. Make the same change to malegenotype and execute the function. Now to define the joining of the male and female gametes to form a progeny. Bring down a DEFINE box, and type progeny as the name of the variable. Click on the value box. We need a function that will join the gametes. Fortunately, BioBIKE has such a function. Find it using the ALL button. To enter the male-gamete and female-gamete into the two arguments of JOIN, click each argument box and find the variable on the VARIABLES menu. Once the function is complete, execute it several times. Why is the behavior different with this function than you saw when you executed Meiosis several times? Now we need to define a function that analyzes a genotype and decides what color it determines. Bring down a DEFINE-FUNCTION box as before and fill in the holes. But how to make the decision? IF the genotype is pp then the flower is white. Otherwise the flower is purple. BioBIKE makes such decisions using the IF-TRUE function, available from the FLOWLOGIC menu. IF-TRUE looks at a condition (in this case whether the genotype is the same as "pp") and THEN does something if the condition is true ELSE it does something else. Let's first consider the condition. Click that box… …and bring down the SAME function, available from the FLOW-LOGIC button, Logical-Comparison submenu. We want to know if the genotype is the same as "pp". Click on x, type genotype, and press Tab. Then type "pp" into the y box. BioBIKE will ordinarily ignore the distinction between upper and lower case. So the difference between "pp" and "Pp" will be ignored… …unless we tell BioBIKE to consider case. Mouse over the Option Icon… …and click CASE-SENSITIVE If the genotype indeed is the same as "pp", THEN the color should be "white". Type "white" in the THEN box. ELSE the color should be "purple". Type "purple" in the ELSE box. (Be sure to press Tab or Enter after each entry) Finally, execute the completed DEFINE-FUNCTION. Bring down a COLOR-OF box from the FUNCTIONS menu, and execute the function a few times with different genotypes (within quotation marks). Are the results as you expect? Now to teach BioBIKE how to do a cross. Bring down a new DEFINE-FUNCTION. Call the function Make-Flower. It will return a flower from a Pp x Pp cross. It won't need any required arguments, but how many functions in the body will be required to do the job? Let's think… We need to define male-gamete and femalegamete. That's two functions. We need to combine them into the progeny. We need to determine the color of the progeny. That's four. So we need four holes. Mouse over the Options Icon of the Body Form… …and click Add two more forms. Then mouse over the Options Icon again and click Add another to get a total of four forms to fill in. Click on the first form and DEFINE malegamete as before (or cut and paste the existing box). Then put DEFINE female-gamete in the second form. Then DEFINE progeny in the third. Then put COLOR-OF progeny in the fourth. Execute DEFINE-FUNCTION . Then bring it down the new MAKE-FLOWER function from the FUNCTIONS button and try it out a few times. When you're satisfied, clear the screen (x in upper right corner). MAKE-FLOWER is good for one cross, but Mendel did 929. We need to repeat the MAKE-FLOWER function 929 times. You can repeat the function that many times by going to the DEFINITION button… 929 crosses … and clicking REPEAT-FUNCTION. Click the function box and fill it with MAKE-FLOWER… not the words but the function. To get the function… … go to the FUNCTIONS button. Then click the number box and fill it with 929. Execute the function to do Mendel’s complete experiment in this ideal genetic world. And there's the results, all 929 of them. How many of the flowers are white? Counting 929 virtual flowers is not something humans are good at, so let the computer do the work… …Bring down the COUNT-OF function from the ALL button. Click the query argument box, and fill it with the word "white" (including the double quotation marks). Count of "white" in what? We need to specify what should be counted. To do that mouse over the Options Icon… …and click the IN option. Again,… Count of "white" in what? In this case, it's the results, i.e. that list of "purple" and "white" flowers. In general, however, we're looking for the count of "white" in the results of Mendel's experiment. To bring Mendel’s experiment (i.e. the REPEAT-FUNCTION box) into the value box, you could cut/paste as before, but this time, try drag/drop. Click under REPEATFUNCTION for a half second and hold the button down… Now drag the box over to the value box… …so that the upper left corner of the dragged box is in the target box (the target box will gain a red outline), then release the mouse button. Now the function is set up to tell you how many flowers in Mendel’s experiment are white. Execute it. In fact, execute it twice. You may get a different answer each time, because if Mendel had repeated his experiment with 929 flowers, he would probably have gotten a different number of white flowers. Each time is potentially different. That’s Mendel’s experiment. Let’s package it as a function to make it easier to manipulate. Call the function MENDELS-EXPERIMENT (no apostrophe’s please!), and give it a summary that will remind you what it does. Mendel’s experiment is precisely the COUNTOF box we just made. To bring that box into MENDELSEXPERIMENT, drag it into the form box of the Body section… …and drop it there. Now execute the function definition to add it to your collection of functions. After doing that, you might want to clear the screen (red X in upper right corner). Then Bring down MENDELS-EXPERIMENT from your FUNCTION button and execute it a couple of times. Each time you execute the function, you will probably get a different number of white flowers counted. That’s the way experiments work. Define an ideal genetic world - Define genotype - Define meiosis - Define gamete We’ve now accomplished everything we’ve set out to do,… except one thing: We still don’t know whether Mendel was right to call his results 3:1. - Define joining of gametes to form progeny - Define how color is determined - Define Mendel's experiment 929 crosses Define an ideal genetic world Recall… he observed 224 white flowers. - Define genotype - Define meiosis - Define gamete A 3:1 ratio predicts 232¼ white flowers. Is that close enough? With our virtual experiment in hand, we’re ready to define what we mean by gametesfinally “close enough”. - Define joining of to form progeny - Define how color is determined - Define Mendel's experiment Purple + 696¾ + Observed: 705 Expected: White = 232¼ = 224 Total 929 929 Define an ideal genetic world - Define genotype - Define meiosis - Define gamete Suppose that Mendel is right. The ratio of purple to white flowers is really 3:1, and his deviant result was just because experiments give different results each time, and 224 is the result he happened to get. If he did it again, he might get 232 white flowers. Number of experiments - Define joining of gametesWell, we now can do it again! If we repeat the to form progeny experiment many times, and his observed value of 224 is common (as in the case below), then - Define how color is Mendel was justified in making his determined approximation. - Define Mendel's Replications in 3:1 world experiment Expected Observed Purple flowers Define an ideal genetic world We have a strategy! Just repeat his experiment gametesand see how frequently we get 224 white flowers (or fewer). Replications in 3:1 world Expected Observed Purple flowers Replications in 3:1 world Expected Number of experiments - Define joining of to form progeny - Define how color is determined - Define Mendel's experiment Number of experiments - Define genotype - Define meiosis - Define gamete On the other hand, suppose Mendel is wrong. In that case his observed value (or worse) will very rarely crop up (as in the other case below). Observed Purple flowers We already have the experiment. All we have to do is to repeat it – say 100 times. You know how to repeat a function. Go to the DEFINITION button and get REPEAT-FUNCTION. Now drag MENDELS-EXPERIMENT into the function box… …and release it. We want to repeat the experiment a lot of times, but too many times and execution will be painfully slow. Insert 100 as the number of times. Then execute the function Well there’s our answer. All we need to do is to count how many times the number of white flowers is 224 or less. But humans weren’t made to count so many numbers. We need to filter away the numbers we don’t want and keep the ones we do. To do this, bring down the FILTER function… …and drag (or copy/paste) the result at the bottom of the screen into the data box…. …and drop it there. We want the filter to discriminate between those numbers less than or equal to 224 and the rest, so the test we want is <= (less than or equal to). Mouse over the choose test icon… …and click <= (less than or equal to). Now type 224 into the value box. …and execute the function. That’s a whole lot better. But still I’d rather not count (estimate, yes; count, no). Fortunately, I have a COUNT-OF function available. All I need to do is go to the Action Icon of FILTER… …and click Surround-with. Now I bring down COUNT-OF, as I have done in the past… …and FILTER is surrounded by the COUNT-OF function. Execute that to get the answer of… 22. 22 times out of a 100 repetitions of his experiment, Mendel would be expected to get a count of white flowers at least as deviant from expectation as he actually observed. Almost. 224 is 8¼ flowers deviant from the expected 232¼ ,… but so is 240½! We should also consider as equally deviant those experiments that give more than 240 white flowers. We could construct from scratch a different filter and count what passes through it, but it’s much easier to copy and modify the current function. So copy it… …and go to the FILE button to paste the copy into the workspace. Now, alter the test so that it is… Now, > (for greater than 240) …and change the threshold value from 224 to 240. Execute… So 22 times out of a hundred Mendel would have gotten a number of white flowers that is too low, at least as deviant as the number he actually got. And 24 times out of a hundred he would have gotten a number that is too high, at least as deviant as the number he actually got. 22 + 24 = 46% of the time… almost half the time. Not so unlikely! Number of experiments Replications in 3:1 world Expected 24% Observed 22% Purple flowers So Mendel WAS right in calling his result 3:1. Or at least his observed value was not out of line with the expected value, given normal variation. Number of experiments Replications in 3:1 world Expected 24% In considering such problems as this one (VERY common!), you generally don’t have access to a computer that can do this simulation. Observed 22% Purple flowers But you do have access to something that’s equivalent… Statistics! Chi-Squared Test And Ei is the expected value Number of experiments Where Oi is the observed value Replications in 3:1 world Expected 24% Observed 22% Purple flowers The chi-squared (X2) test does through an equation exactly what you just did on the computer. Try it! Application of Chi-squared test Chi-Squared Test And Ei is the expected value Number of experiments Where Oi is the observed value Replications in 3:1 world Expected 24% 2 2 (705 – 696¾) (224 – 232¼) + X2= 696 ¾ 232¼ = 0.391 Observed 22% Purple Purple flowers + 696¾ + Observed: 705 Expected: White = 232¼ = 224 Total 929 929 Application of Chi-squared test Chi-Squared Test And Ei is the expected value Number of experiments Where Oi is the observed value Replications in 3:1 world Expected 24% Observed 22% X2= 0.391 Now go to a web site that will translate this number into an area under a curve as in the figure to the left. Purple flowers http://www.fourmilab.ch/rpkp/experiments/analysis/chiCalc.html Scroll down to the calculator… Insert .391 for the X2 value …and 1 for the degrees of freedom (the flower is either white or it is not… one question to answer) …then click Calculate. Chi-Squared Test And Ei is the expected value Number of experiments Where Oi is the observed value Replications in 3:1 world Expected 24% Observed 22% Purple flowers The probability (area under the curve) you get from the X2 test should be within several percentage points from what you got from repeating the virtual experiment… …because that’s what a X2 test is! (so long as you do the experiment an infinite number of times!) Number of experiments Replications in 3:1 world Expected 24% Chi-Squared Test Observed 22% Where Oi is the observed value Purple flowers And Ei is the expected value