Work: Sex

Jeffreys Copeland & Haemer

(Server/Workstation Expert, March 2000)



Plus ça change, plus c'est la même chose.
                        --- The French


Vive la différence
                        --- Also the French.


Our question for the month is, ``Why is sex always the same?''

(You may not infer anything from this question about the quality of either Jeff's social life. Shame on you. Now, read on.)

In elementary school, we're taught that one X and one Y chromosome makes you a man, and two X's make you a woman.

This is (mostly) true in humans. Actually it's (mostly) true in mammals. Move outside mammals, though, and it's a brave old world. Birds are just the opposite: roosters are XX, hens, XY. (In the literature, the sex chromosomes from such ``backwards'' systems are called `W' and `Z,' so that a rooster would be WW and a hen WZ, but that's just a mnemonic device.)

Sex in butterflies is done just like sex in birds, but fruit flies are like us.

Well, sort of. Girl flies are XX and boy flies are XY. Fly into the odd corners of the Drosophila personals ads, though, and differences emerge. In mammals, having a Y chromosome makes you a male: people with two X's and a Y -- Klienfelter's syndrome -- are male, people with one X but no Y -- Turner's syndrome --, female, In flies, it's just the opposite. two X's makes you a female: X0's (flies with one X and no Y) are boys, and XXYs are girls.

Sure, this will win you points in Trivial Pursuit (Sex-Determination Edition), but so what? Think for a second: How could you ever turn one system into another?

(And how in the heck will the two Jeffreys turn this into a software column? Patience. We'll get there. Relax and enjoy the ride.)

This is a wonderful puzzle. Sex is very important; species that don't reproduce successfully suffer instant extinction. Yet though flies and butterflies share a common ancestor (which must have had some sex determination scheme) they've managed to evolve completely opposite ways to decide what sex they are. We're much closer to birds than either of us is to insects, but our sex-determination scheme is the same as the fly's investigating the bottle of homebrew next to our terminal. Both are completely backwards from the system used by the magpie squawking outside our window, and the sphinx moth getting ready to pop out of the pupal case we're keeping on our windowsill.

Oh, but life gets weirder.

Praying mantisses, which we enjoy in our gardens, have one X and several Ys: That is, females have two Xs, while males have one X and a handful of distinct Ys: each Y is different, and each male has one Y of each kind.

Other species turn this on its head, and have several X different chromosomes but only one Y: each female may have, say 3 different pairs of X's, while her mate has 3 X's and a single Y.

Some animals, like the voles getting ready to hibernate as we write, have gotten rid of their Y's altogether One sex has two X's and the other has one.

Each of the spiders that invade our office, this time of year, has several X chromosomes. Females might have six, while males have three -- but no Y.

The ants trying to take up residence in our kitchen are odder still: they have no sex chromosomes at all. Females have two of every chromosome; males only have one of each.

But there's constant threads runing through all of this: Despite this wild diversity, there are always exactly two sexes, males and females. One has one sex-chromosome makeup; the other has a second. Also, one sex makes two kinds of gametes, in equal numbers, and the other only makes one. All human (or fly) eggs have an X chromosome, but each Jeff makes two kinds of sperm: X sperm and Y sperm. If we were birds, we'd only make one kind of sperm, but our mates would make two kinds of eggs.

In spiders with three sets of X chromosomes, spider moms always make eggs with three X's, while spider dads make sperm that have either three X's or no X.

Ants, bees, and wasps take this to an extreme. Effectively, every chromosome is an X: An egg has one full set of chromosomes. Fertilized eggs (ones that get an additional full set from dad), become daughters, unfertilized eggs (one that get no set from dad -- effectively an ``empty sperm'') become sons.

(``Stop,'' says the one of us trained as an engineer, ``I'm missing something. If it's an empty sperm, what triggers the `life starts' magic? Or is that a religious question beyond the scope of this column?''

``You're missing nothing,'' the geneticist replies. ``It's done with mirrors. There are lots of interesting consequences, but they're more than we need to set up the problem.'')

The regularity means that when you mate a male and a female, you get two kinds of offspring: sons and daughters. And the production of equal numbers of two kinds of gametes by one sex means that there are the same number of sons as daughters.

A good rule of thinking about nature is, "When something's constant, look closer: it might be important."

Why is sex always the same?



The Exception That Proves the Rule

Here's another good rule of thinking about nature: ``The exception proves the rule.'' If something's odd, look closer, it may help you understand the norm.

During a casual afternoon in the dusty stacks of his local University library, Haemer stumbled on a report that one population of Central American fish -- a swordtail, for you tropical fish types -- has three different flavors of sex chromosomes: an X, a Y, and a Z. Here's how sex determination works:

  1. Each individual only has two sex chromosomes: XY, YZ, XZ, ... but not XXX, XYZZ, or anything else with more than two.
  2. If you carry a Z, you're a female.
  3. Otherwise, if you have a Y, you're a male.
This gives us the following possibilities:
chromosomes     sex
YY              male
XY              male
XX              female
YZ              female
XZ              female


What about ZZ? Can't happen. A ZZ would have to get a Z from mom and a Z from dad. But swordtails with Z's are never dads.

This is very different system with lots of odd pairings. For example, XX x YY gives all sons, while three-quarters of the offspring of XZ x XY will be daughters.

(Yes, this is very strange. It simply adds to our respect for J.B.S. Haldane, the father of theoretical population genetics, who observed that life is not just stranger than we imagine, but stranger than we can imagine.)

Hmm. So why don't more species have this array of options. Or, for that matter, others?


Three Hypotheses
We can suggest three hypotheses for this sexual monotony.

  1. Maybe all equilibrium states have only two sex chromosomes.

    If we start out with a certain proportion of each type and let random mating happen over many generations, what will be the ratios of the different types at equilibrium?

    Perhaps all such equilibria eliminate all but two of the sex chromosomes. If so, we've caught a species in transition from one sex determining system to another.

  2. Maybe there are equilibria with all three chromosomes, but they're unstable.

    This is subtly different from the first hypothesis. To see the difference, consider an XX/XY system, which has a very stable equilibrium. Even if hunters kill off 90% of elk stags in the fall, moving the sex ratio to 10-to-1, the sex ratio of calves the following spring will be 50-50.

    Imagine, however, some other, more complex system that produces reasonable equilibrium frequencies so long as the frequencies of each type stay within a narrow range, but wanders off into never-never-land if there is heavy predation on one type.

    Maybe we've caught a system that will stay like this for a while, but is ultimately fated to become a two-chromosome system.

  3. Maybe there's a stable equilibrium, but the sex ratio isn't 50-50.

    Why would this matter? In the 1920s, Sir R. A. Fisher, father of modern statistics (Fisher invented, for example, the variance), advanced the following, subtle argument:

    Imagine a species with a vast excess of females. The average father has many more children than average mother. Next, suppose one father carries a mutation that gives him a higher proportion of sons than average; such a father will have more grandchildren than the other males of his generation. Since this means he'll pass more copies of his genes on to future generations than his contemporaries, the mutation he carries will spread through the species, increasing the proportion of males in the population.

    If there is an excess of males, the argument goes the other way. These combine to select for systems with a 50-50 sex ratio.

    A normal XX/XY system gives a fifty-fifty sex ratio: half sons and half daughters. Does this choose-two-out-of-the-three-candidates system give us a 50-50 sex ratio? If not, then natural selection will select for changes in the sex determining system.


At last! Questions we can answer with a program. Time for some software.


What do you get when you cross ...

Rather than brute-force simulating the sex ratio, and its changes from one generation to the next, we'll begin by making a small module to do arbitrary Mendelian crosses.

   1   #!/usr/local/bin/perl -w
   2   # $Id: Mendel.pm,v 1.5 2000/01/06 02:39:48 jsh Exp $

   3   package Mendel;
   4   use strict;

   5   use vars qw($VERSION @ISA @EXPORT);
   6   require Exporter;
   7   @ISA = qw(Exporter);
   8   @EXPORT = qw(cross gametes genotypes zygote);
   9   $VERSION = "1.00" ;

  10   use Nhash;

  11   sub cross {
  12   my ($f, $m) = @_;
  13   my %cross;

  14   my @fg = gametes($f);
  15   my @mg = gametes($m);
  16   $f = 1/(@mg*@fg);

  17   foreach my $fg (@fg) {
  18     foreach my $mg (@mg) {
  19       $cross{zygote($fg,$mg)} += $f;
  20     }
  21    }
  22    new Nhash %cross;
  23   }

  24   sub gametes {
  25    split //, shift;
  26   }

  27   sub genotypes {
  28    my ($type, %phenes) = @_;
  29    my @list;

  30    foreach (keys %phenes) {
  31     push @list, $_ if $phenes{$_} eq $type;
  32    }
  33    @list;
  34   }

  35   sub zygote {
  36    my ($mom, $dad) = @_;
  37    return $mom lt $dad ? $mom . $dad : $dad . $mom;
  38   }

  39   1;

  40   __END__

  41   =head1 NAME

  42   Mendel - Simple Mendelian genetics

  43   =head1 SYNOPSIS

  44    use Mendel;

  45    @g = gametes('XY');
  46    print "gametes of 'XY' are @g\n";

  47    @z = zygote('X', 'Y');
  48    print "fertilizing 'X' with 'Y' gives: @z\n";

  49    my %sexes = (XY => 'M', XX => 'F');
  50    my @males = genotypes('M', %sexes);
  51    print "males are @males\n";

  52    $a = cross('AA', 'Aa');
  53    print "crossing 'AA' and 'Aa' gives: $a\n";

  54   =head1 DESCRIPTION

  55    Mendel.pm provides operations of simple Mendelian genetics.
  56    This is where the descriptions of the individual operators go.

  57   =head1 AUTHORS

  58   Jeffrey Copeland <copeland@alumni.caltech.edu>
  59   Jeffrey S. Haemer <jsh@usenix.org>

  60   =head1 SEE ALSO

  61     perl(1) Nhash(1)

  62   =cut

Lines 1-9 are relatively straightforward. You'll find them, or things like them, in many modules. See the perlmod documentation for details.

Line 10 brings in a module Nhash.pm, which we use to handle numeric hashes: hashes in which the keys are strings, but the values are all numbers. We'll go through the code for this in some detail next month. For now, we'll say that our module needs this because the function cross() takes a pair of parental genotypes as its input and returns a hash containing the different types of offspring and their individual frequencies.

The remaining lines define four simple functions:


Does it work? Here's the test program stolen from the documentation, lines 44-53:

#!/usr/local/bin/perl
# $Id: t0,v 1.3 2000/01/06 02:40:36 jsh Exp $

use Mendel;

@g = gametes('XY');
print "gametes of 'XY' are @g\n";

@z = zygote('X', 'Y');
print "fertilizing 'X' with 'Y' gives: @z\n";

my %sexes = (XY => 'M', XX => 'F');
my @males = genotypes('M', %sexes);
print "males are @males\n";

$a = cross('AA', 'Aa');
print "crossing 'AA' and 'Aa' gives: $a\n";
And here's its output:
gametes of 'XY' are X Y
fertilizing 'X' with 'Y' gives: XY
males are XY
crossing 'AA' and 'Aa' gives: (AA => 0.5, Aa => 0.5)


Promises, promises ...

Next time, we'll show you Nhash.pm and then use Mendel.pm to solve the problem we posed. This gives you a whole month to think about it yourself.

Meanwhile, in the corrections department, astute readers M. Leo Cooper and Frank Witte noticed that in our January column we managed to define the most familiar mathematical constant in the world to be 3.1415929... instead of 3.1415926... They managed to catch an error that's been in that code for nearly a decade, and we thank them.

Until then, happy trails.