The first animals to evolve on Earth did not have nervous systems. They spent their days and nights sitting on the sea floor, passively filtering water for food particles, a lifestyle that continues in their extant descendants: the sponges. Their lifestyle does not require movement or the ability to sense and respond to the environment, making a nervous system a useless ornamentation.
Clearly, movement and sensation can be beneficial, and the next group of animals to evolve perform these deeds, and quite beautifully. This lineage gave rise to the jellyfish and comb jellies of today, which control their movements using a network of neurons distributed diffusely throughout their bodies (called a "nerve net"). They do not have brains; they do not even have clusters of neurons or major nerve trunks. Thus, although they can sense touch and detect chemicals, they cannot decipher where a given stimulus is. For this reason, these animals respond to stimuli with a reflexive movement of the entire body, regardless of where on the body the stimuli was detected.
Then about 590 million years ago, give or take a large margin of error, the Earth witnessed the dawn of bilateral animals; that is, animals exhibiting one, and only one, plane of symmetry, endowing them with not only a top and a bottom, but a left and a right, and a front and a back (as opposed to jellyfish, which have only a top and a bottom). "Bilateria," as this group is called, includes most extant animal species, from leeches and butterflies to sea squirts and kittens.
One of the consequences of bilateralism is cephalization, which is the evolutionary trend toward concentrating sensory structures and nervous tissue at the anterior (front) end, which is whichever end tends to lead during movement. This cluster of nervous tissue (e.g., the brain, or "ganglia" in most other species) needs to connect to the rest of the body in order to control movement and collect additional sensory information, thus necessitating some sort of nerve trunk (e.g. the vertebrate spinal cord). The net result of this concentration of nervous tissue in discrete parts of the body is a centralized nervous system (CNS).
How and when did the centralization of the nervous system occur? We know that jellyfish and comb jellies did not have centralized nervous systems, but extant Bilateria do (I'll get to the exception, hemichordates, later on). To understand the complexity of reconstructing evolutionary history, it's important to understand a little about how the Bilateria are classified. Recent phylogenetic studies have grouped Bilateria into three main branches: he deuterostomes, which consists primarily of chordates (e.g. fish, amphibians, mammals, birds, jawless fish, etc) and echinoderms (e.g. sea stars, sand dollars, sea cucumbers, etc), and two branches of protostomes, Ecdyzoa (insects and roundworms (e.g. nematodes)) and Lophotrochozoa (molluscs and annelid worms (e.g. earthworms and leeches)). At some point in history, these three bilateral branches all had a common ancestor, and the name of this hypothetical beast is Urbilateria (the slide on the right is from a presentation I did of this paper).
Urbilateria represents a crucial position in our evolutionary history, marking not only the origin of Bilateria, but also the last common ancestor of the deuterostomes and protostomes. Thus when trying to understand the evolution of Bilateria-specific traits, such as a CNS, it is of critical importance to paint a clear and comprehensive picture of Urbilateria.
In order to reconstruct ancestral forms such as Urbilateria, which fossil remains are unspecified or unknown, biologists draw inferences from comparative analysis, using different extant lineages. For example, a characteristic present in fruit flies, nematodes, and mice was most likely present in their last common ancestor (Urbilateria). Conversely, a characteristic present in one lineage (e.g. mice) but not the others (fruit flies and nematodes) was most likely an evolutionary innovation of the former (mouse) lineage. One crucial point is the characteristics must bear some sort of similarity between lineages, or a common evolutionary origin is unlikely. For example, our eyes are markedly different from the compound eyes of fruit flies, so our eyes must have evolved independently from those of the fruit fly, indicating that Urbilateria did not have eyes (although it may have had some sort of light sensor/photodetector).
What about the nervous system of Urbilateria? How was it organized (if at all), and how complex was it? Which characteristics of the nervous systems of today's animals are novelties of their personal evolutionary lines, and which have been retained these hundreds of millions of years? The extant species of Bilateria have CNSs, but there is one key difference: in deuterostomes, the central nerve cord is on the dorsal (back) side, while in both branches of protostomes, the nerve cord is on the ventral (belly) side. This difference has made the reconstruction of Urbilateria's nervous system quite difficult and controversial, but there are two main hypotheses.
The first is called the inversion hypothesis, and was proposed by the zoologist Anton Dohrn in 1875. He theorized that Urbilateria was a worm-like creature with a ventral nerve cord, and that the protostomes retained this orientation, whereas an ancestor of the deuterostomes turned itself upside down and gave rise to animals with dorsal nerve cords. The other hypothesis is known as the gastroneuralia-notoneuralia hypothesis, and predicts that Urbilateria had a diffuse nervous system. After branching off from one another, the deuterostomes and protostomes independently evolved CNS's on opposite sides of the body.
For over a century, these hypotheses have been reasserted and rejected time and time again, as people find striking similarities (supporting a common origin) and crucial differences (supporting an independent origin) between the development of the CNS in vertebrates and fruit flies. So what is the significance of these similarities and differences? What does it all mean? Here we get to the main rub of evolutionary biology: in essence, it is a question of probability, and is exasperatingly subjective. The overall probability of an independent versus common origin has to be estimated, and that estimation is based on putative homologies between different branches. Thus, one must determine the degree of similarity at which two structures may be deemed the result of evolutionary conservation.
Not unexpectedly, when one is tracing hundreds of millions of years of evolutionary history, there are many question marks. One concept that is important to grasp is that those hundreds of millions of years have not treated all lineages equally; some animals have evolved more than others. Across Bilateria, the rates of gene loss and gene alteration are remarkably asymmetrical. By comparing the genomes of Bilateria with genomes of animals that diverged before Bilateria (e.g. jellyfish), one can determine how much a Bilaterian animal has evolved from the last common ancestor. For example, a gene present in humans but not fruit flies, but which is present in jellyfish, must have been present in Urbilateria but lost in the lineage that gave rise to fruit flies. By doing this sort of analysis between man, fruit flies, and nematodes, geneticists discovered that the genome of man had changed the least of the three. Both fruit flies and nematodes, then, underwent periods of rapid rates of molecular evolution, with large gene losses, meaning that we have many genes that were lost along their lineages.
For those familiar with research in developmental biology, something a bit disturbing is now evident. The model organisms used in this field are fruit flies, nematodes, mouse, zebrafish, African clawed frog, and sea urchins. The first two are members of Ecdyzoa, while the rest are deuterostomes, leaving the entire branch of Lophotrochozoa unexplored. Given the rapid rate of evolution of the Ecdyzoa, it's clear that piecing together evolution by merely comparing vertebrates to insects is severely limited. In fact, comparisons with pre-Bilaterian animals has demonstrated that the Lophotrochozoans retain more ancestral features than both the Ecdyzoans and deuterostomes, and have more gene conservation with vertebrates than any Ecdyzoan.
In the most recent issue of Cell, Alexandru Denes of Detlev Arendt's lab explored the CNS of a member this hitherto ignored branch, Platynereis durmerilii, an adorable marine ragworm which has deviated little from the Urbilaterians, prompting Dr. Arendt to call it a "living Urbilateria." Platynereis lives in the same environment that Urbilateria would have (shallow marine waters), has a "prototypical" invertebrate nerve cord (arranged like a rope ladder instead of a hollow cord like ours), and undergoes an "ancient" type of cell division in its earliest stages as a blastula (spiral cleavage).
The development of all animals with any sort of tissue specification (i.e. anything but sponges) is controlled by genes that specify what a given cell in the embryo will become (e.g. skin, muscle, nerve, etc). The developing nervous system then undergoes further specification, in which "neural specification genes" divide the primordial CNS into different regions; the progeny of one region will control muscle movement, the progeny of another will convey sensory information, etc. This group looked for these genes by using a method called in situ hybridization, and found that between vertebrates and Platynereis, the domains of eight different genes have largely identical spatial relations to each other (the picture on the left is the authors' cartoon version of the expression patterns; the bottom is the middle of the CNS, moving up goes outward toward the side of the CNS). Moreover, similar neuron types emerge from the corresponding domains, and send axons to similar destinations! The CNS of Platynereis is actually more similar to the vertebrate CNS than the latter is to the fruit fly's, indicating that the CNS of both vertebrates and Platynereis are likely to be more similar to the ancestral form than that of the fly.
The striking similarities between these two animals, separated by hundreds of millions of years of evolution, implies a common evolutionary origin from an equally complex ancestral pattern. In other words, Urbilateria must have had these same sets of genes, in the same spatial orientation, patterning its nervous system, which must have likewise been centralized. Of course, this is still a matter of probability, but it seems highly unlikely that such a complex arrangement of genes could have been recruited independently to specify evolutionarily unrelated cell populations.
The question now is how this inversion happened. Flipping over is not trivial; there are many differences between up and down, and this potential burden is one of the major impediments to acceptance of the inversion hypothesis. "Down" is the sea floor, which combined with gravity becomes the source of friction; "Up" is the source of falling objects and other dangers, as well as sunlight. An inversion of the body axis would have thus involved a significant change in lifestyle, which is difficult to imagine, but not unprecedented.
Many animals swim "upside down," such as brine shrimp and upside-down catfish, both of which are more efficient feeders in this orientation. Perhaps in a few hundred million years, natural selection will reshape the other anatomical details to fit these new lifestyles, dorsal will become ventral, and zoologists will thus classify them as having their nerve cords on the opposite side as their closest relatives. To some extent, this process has already begun with the catfish. Most fish have light underbellies and dark backs, to aid in camouflage. The upside-down catfish, on the other hand, actually has a dark "underbelly" and a light "back," to help it camouflage in its preferred orientation. Thus, for the catfish, swimming upside down began as a behavioral change, which made its genome permitting of certain genetic changes (i.e. coloration and a propensity and eventual instinct for swimming on its back).
It is not unreasonable, then, that the evolutionary trend towards a dorsalized nerve cord began as a change in a behavioral trait, and was later followed by genetic evolution. A similar sequence of events was likely involved in the animal invasion of the land and flying.