Wednesday, September 28, 2011

Why symbiosis is not a good example of group selection

[ In a Google+ post, someone asked whether symbiosis was a good example of group selection. I responded in a comment, and another comment asked me to expand my response a little bit in my own post. So here is a copy of that post (with a few more hyperlinks). ]

Part 1: What is group selection?

Typically "group selection" doesn't cross species boundaries. That is, group selection refers to the proliferation of a particular form of a gene, otherwise known as an "allele", due to its benefits to groups of individuals which share that allele despite the individual costs of having that allele. It may help to consider the basic group-selection argument for the evolution of altruism (i.e., the evolution of behaviors that are costly to an individual and yet beneficial to a different unrelated individual). Before that, consider why we wouldn't expect altruistic alleles to have strong representation in a population.

For every gene or group of genes, there can be many different variations (alleles). Some of those variations will be deleterious to an individual, and so you would expect the relative representation of those deleterious variations to decrease over generations. So imagine if one of those alleles encoded an altruistic trait that caused an individual to do something costly for the benefit of another (e.g., helping a stranger understand group selection with no expectation of future payoff). Individuals with that allele are suckers. Those without that allele instead focus on tasks that return direct benefit to themselves, and that direct benefit would payoff with greater productivity of offspring that share that non-altruistic allele. When an altruist met a non-altruist, the benefit from the altruist would increase the non-altruist's alleles representation in the next population while decreasing its own alleles' representations. So we would expect that altruistic alleles would fade away into obscurity. Moreover, the benefit from all of the altruists would diffuse across the variety of alleles rather than being concentrated on just the altruistic ones.

However, what if that altruistic allele also encoded a behavior that would seek out others with that same allele. This non-random association means that each individual who helps another does actually help to increase the productivity in that allele. That is, even though there is a cost to the individual doing the altruistic task, the benefit going to the other individual is felt by the other copy of the same allele in the different (and unrelated) person. So when these altruists group together, altruistic benefits do not diffuse. They are captured within the group. Moreover, the group's synergy can cause it to be more productive than the remaining groups of non-altruists. Consequently, the altruistic allele not only persists in the population, but its representation can grow because there is a differential benefit between altruistic and non-altruistic groups. It is this differential benefit between groups that is group selection.

Part 2: Symbiosis and Mutualism

A symbiotic relationship between members of different species is not group selection (in general) because it does not posit that there is a mutual allele that may be deleterious in an individual but beneficial in a group. That is, there is no group synergy that is mitigating individual costs by generating benefits elsewhere that help to support alleles that would otherwise naturally decay. When species are mixed within a population of interest, the analysis is a bit different because alleles cannot flow across the species barrier (except for special cases).

For example, consider an allele that existed across species (e.g., an allele for a gene shared between humans and bonobos), the speciation in general would prevent the sort of group selection gains because there would be no way for increased numbers of alleles in one species to transfer to the other species. Imagine that altruists in one species seek out altruists in the other species. The result could lead to more increases in the altruist representation in one species than another, and so there would be an altruist surplus. Those surplus altruists would have no choice but to associate with non-altruists in the other species. However, if the group was all of one species, then there would not be surplus altruists. Altruistic benefit need not diffuse across non-altruists too.

However, most examples of symbiosis are not altruistic. Instead, they are mutualistic. That is, the behavior does benefit another, but that is a possibly unavoidable side effect of an action that benefits the individual doing the behavior. For example, if I'm driving through a parking lot looking for an empty space to park, I am revealing information to my competitors (other drivers) about where empty spots are not. I don't want to help the competing drivers, but it is unavoidable because they can see me go down an isle of the parking lot and not find a spot. Consequently, they do not go down that same isle. Of course, I use their searching behavior to inform my choices of the next isle. So we are doing "cooperative search" only because the behaviors have mutual benefits. The same goes for many symbiotic relationships among individuals of different species.

Consider a remora ("sharksucker"). It's a small fish that essentially attaches to another host (fish, whale, turtle, etc.). It can receive nutrients from on or around the host. It can also be protected from predators that avoid the host. In some cases, the host could eat the remora, but the remora is so small that it may not be worth the effort. Some hosts actually receive a small benefit (cleaning, for example) from the remora. Regardless, the remora experiences very little cost and plenty of benefit. Moreover, the host experiences very little cost and possibly some benefit. So there's no surprise that this behavior evolved. You don't need any fancy mathematical model to show how this is possible – when the benefits align like this, it's natural to assume that it is going to be favored by natural selection.

Part 2.5: Symbiosis and Co-evolution

Having said all of that, symbiosis can lead to elegant examples (or at least suggestions) of co-evolution, which describes how a change in one species can lead to a change in other species. In particular, natural selection on different species creates a feedback across species. One species is the ecological background for another species, and so as each species changes it creates new niches (and destroys old ones) for other species. So the evolution of one species can guide the evolution in another. But I think this post is long enough. :)

More information

Wikipedia does a pretty good job on these particular subjects. Check 'em out there.

( I have also mirrored this content on a post on my website. )

Tuesday, September 20, 2011

Duplex Printing from the Command Line to an HP LaserJet Printer

My department has several HP LaserJet printers available to access within the department via LPR and SMB. However, if you are working from a personal laptop connected to the university wireless, those servers will not be available to you. Instead, you must print by piping your documents through SSH to a department server that does have access.

Unfortunately, doing duplex printing (i.e., two-sided printing) to an HP LaserJet printer from the command line is not trivial. So, using the GSview documentation as a guide, I put together a small bash script (available for download as hplj_duplex_print) that does the trick.
#!/bin/bash

declare -a input_file
if test $# -eq 0; then
    input_file=("-")
else
    input_file=("$@")
fi

( echo -e "\e%-12345X@PJL JOB"
  echo "@PJL ENTER LANGUAGE = POSTSCRIPT"
  echo "<< /Duplex true /Tumble false >> setpagedevice"
  gs -sDEVICE=psmono -sPAPERSIZE=letter -q -sOutputFile=- \
    -dNOPAUSE -dBATCH "${input_file[@]}"
  echo -e "\e%-12345X@PJL EOJ"
  echo -e "\e%12345X"
  ) | lp -d your_HP_printer_spool_name
You should replace the your_HP_printer_spool_name with your printer's spool name. You might want to tweak some of the options (details below), but the general structure will remain the same. The opening and closing escape sequences communicate to the HP LaserJet printer that a PostScript file is coming. Then the setpagedevice PostScript directive instructs the printer to use its duplex module.

Regarding tweaking:
  • Again, make sure to change your_HP_printer_spool_name to your spool name. You may also want to change lp to lpr, but you will likely have to change -d to -P then.
  • You may want to change the gs (GhostScript) options to suit your purposes. For example, you can change the psmono device to one of the other GhostScript devices like psgray or psrgb.
  • The Tumble switch determines whether to do short-edge (true) or long-edge (false) duplex printing, and so this script defaults to the latter case. If you prefer vertical flipping, change the /Tumble false to /Tumble true. You might also make this a configurable command-line switch on the script.

Thursday, September 01, 2011

"Dark Matter is an Illusion" summary in National Geographic News gets something a little wrong

There was an interesting article from National Geographic News yesterday:
"Dark Matter Is an Illusion, New Antigravity Theory Says"
by Ker Than
I thought I'd post a link to the primary source here. I also wanted to point out that the explanation Ker Than gave got something really important wrong and consequently diminished the elegance of the proposed theory.

Here's the primary source:
"Is dark matter an illusion created by the gravitational polarization of the quantum vacuum?"
by Dragan Slavkov Hajdukovic
Astrophysics and Space Science 334(2):215--218
DOI: 10.1007/s10509-011-0744-4
Ker Than, the National Geographic News reporter, got it a little mixed up in this part of the NatGeo article:
All of these electric dipoles are randomly oriented—like countless compass needles pointing every which way. But if the dipoles form in the presence of an existing electric field, they immediately align along the same direction as the field.

According to quantum field theory, this sudden snapping to order of electric dipoles, called polarization, generates a secondary electric field that combines with and strengthens the first field.
This electric analogy states that electric dipoles align and strengthen electric fields, but that's incorrect. Electric dipoles weaken surrounding electric fields. In particular, the positive end of the dipole goes toward the "negative end" of the field and the negative end of the dipole goes toward the "positive end" of the field. So the two fields subtract from each other, not reinforce. This is summarized in the primary source (that I'll quote below).

[ note that magnetic dipoles align and reinforce surrounding magnetic fields because there are no magnetic monopoles. That is, magnetic field lines are continuous; they don't terminate. Consequently, magnetic dipoles are torqued to align their fields. Electric dipoles are driven by the motion of their monopolar ends ]

What Ker Than missed was that in this model of "gravitational charge", it is the case that opposites repel and likes attract. That's why you (matter) are attracted to earth (also matter). However, anti-matter and matter would repel each other. Moreover, if you had a matter–antimatter virtual pair (as quantum field theory says you do in a vacuum of space), that dipole would align because its "positive" end would be pulled toward the positive end of the gravitational field (and vice versa for its negative end). This alignment would strengthen the resulting field.

Here's the relevant snippet from the bottom of the first column of page 2 of the article:
In order to grasp the key difference between the polarization by an electric field and the eventual polarization by a gravitational field, let's remember that, as a consequence of polarization, the strength of an electric field is reduced in a dielectric. For instance, when a slab of dielectric is inserted into a parallel plate capacitor, the electric field between plates is reduced. The reduction is due to the fact that the electric charges of opposite sign attract each other. If, instead of attraction, there was repulsion between charges of opposite sign, the electric field inside a dielectric would be augmented. But, according to our hypothesis, there is such repulsion between gravitational charges of different sign.

Why GMail's show-if-unread is NOW useless with nested labels

Once upon a time, when they were both in "GMail Labs", the show-if-unread feature and nested labels features worked together seamlessly.
  • nested labels: You could create a nested label (like a subfolder) by adding slashes in folder names. You would create two folders called "Parent/ChildA" and "Parent/ChildB", and they would be displayed as "ChildA" and "ChildB" underneath a single "Parent" that you could collapse and expand.
  • show-if-unread: Only labels that had unread messages in them would show up in the left bar. To see all of your labels, you could use the "more" link which would show you a full list.
In the case where a nested label had unread messages in it, it would show up in its flat form (if I recall correctly) in the list. So you'd see "Parent/ChildA" but "ChildB" would still be nested under "Parent" in the "more". That was fantastic.

However, eventually both labs features became integrated into production GMail, and they messed it all up. Now, ostensibly to avoid revealing the slash form and to avoid having parent labels repeated in both the unread and read lists, they've made it impossible to apply show-if-unread to nested labels. Consequently, if any nested labels have unread messages in it, the parent and all of its nested labels show up in the unread list. So you get things like this (click for larger):
Obviously, that defeats the whole purpose of show-if-unread. I'm forced to look at all of those read nested labels just because some of their "sublings" are unread.

So Google has gone from taking two nice features and combining them into one terrible and useless and awful thing.