I’ve made a variety of important changes to plantae’s foundations. For the curious they are:
Converted the webserver from apache to LightTPD. LightTPD is fast and easy to configure. Plus it has built-in support for FastCGI which makes plantae run much faster.
Set up a Subversion repository. This manages the code for plantae and allows me to track and reverse changes. This will also be very useful if someone else helps with the coding.
Figured out Switchtower to handle plantae’s deployment.
Hooked up a code repository at code.plantae.info using Collaboa. This is how I intend to track feature requests and bugs. Hopefully our users will also use this feature to pass on suggestions.
Hermaphroditism is prevalent in plants but may allow interference between male function (pollen removal and dispersal) and female function (pollen receipt and seed production) within a flower. Temporal or spatial segregation of gender within a hermaphroditic flower may evolve to reduce this interference and enhance male and female reproductive success. We tested this hypothesis using Chamerion angustifolium (Onagraceae), in which pollen removal (male) and pollen deposition (female) were measured directly on hermaphroditic and experimentally produced unisexual flowers. During a single flower visit in the field, bees deposited 159±24 (SE) pollen grains on a stigma and removed 1058±198 grains from each flower. Anther removal did not alter deposition rates. In the laboratory, bees removed 2669±273 pollen grains and deposited 209±72.3 cross-pollen and 120±28.4 facilitated self-pollen grains per visit. The presence of anthers significantly reduced cross-pollen deposition on the stigma. In contrast, pollen removal was not affected by presence of the pistil. These results suggest that within-flower interference affects female function and represents a fitness cost that can be reduced through temporal segregation of gender within the flower.
This book of about 600 pages is written to provide practitioners of pollination biology with a broadly based source of methodologies as well as the basic conceptual background to aid in understanding. Thus, the book reflects the expertise of the assembled a team of internationally acclaimed scientists. Pollination biology enjoys over 200 years of scientific tradition. In recent years, the interdisciplinarity of pollination biology has become a model for integrating physics, chemistry, and biology into natural history, evolutionary and applied ecology. Pollination biology has developed its own techniques and approaches while incorporating ideas, methods, and technology from many facets of pure and applied science.
Protandry, a form of temporal separation of gender within hermaphroditic flowers, may reduce the magnitude of pollen lost to selfing (pollen discounting) and also serve to enhance pollen export and outcross siring success. Because pollen discounting is strongest when selfing occurs between flowers on the same plant, the advantage of protandry may be greatest in plants with large floral displays. We tested this hypothesis with enclosed, artificial populations of Chamerion angustifolium (Onagraceae) by experimentally manipulating protandry (producing uniformly adichogamous or mixed protandrous and adichogamous populations) and inflorescence size (two-, six-, or 10-flowered inflorescences) and measuring pollinator visitation, seed set, female outcrossing rate, and outcross siring success. Bees spent more time foraging on and visited more flowers of larger inflorescences than small. Female outcrossing rates did not vary among inflorescence size treatments. However, seed set per fruit decreased with increasing inflorescence size, likely as a result of increased abortion of selfed embryos, perhaps obscuring the magnitude of geitonogamous selfing. Protandrous plants had a marginally higher female outcrossing rate than adichogamous plants, but similar seed set. More importantly, protandrous plants had, on average, a twofold siring advantage relative to adichogamous plants. However, this siring advantage did not increase linearly with inflorescence size, suggesting that protandry acts to enhance siring success, but not exclusively by reducing between-flower interference.
In self-compatible plants, small populations may experience reduced outcrossing owing to decreased pollinator visitation and mate availability. We examined the relation between outcrossing and population size in eastern Ontario populations of Aquilegia canadensis. Experimental pollinations showed that the species is highly self-compatible, and can achieve full seed-set in the absence of pollinators via automatic self-pollination. We estimated levels of outcrossing (t) and parental inbreeding coefficients (F) from allozyme variation in naturally pollinated seed families for 10 populations ranging in size from 32 to 750 reproductive individuals. The proportion of seeds produced through outcrossing was generally low (mean = 0.29 +/- 0.02 SE) and varied widely among populations (range = 0.00-0.83). Accordingly, estimates of F were large (mean = 0.26 +/- 0.05) and significantly greater than zero in seven populations. As expected, four small populations (N < 40) outcrossed less (0.17 +/- 0.03) than six large populations (N > 90; 0.38 +/- 0. 03). However, parental plants were not significantly more inbred in small than large populations (P = 0.18). There was no difference in the germination of seeds from hand self- and cross-pollinations. However, population genetic estimates of inbreeding depression for survival expressed from seed to reproductive maturity were very high (mean delta = 1 - relative fitness of selfed seed = 0.88 +/- 0.14). The combination of self-compatibility and automatic self-pollination makes the mating system of A. canadensis sensitive to variation in ecological factors that affect the likelihood of cross-pollination.
Historically, dichogamy (the temporal separation of gender in flowering plants) has been interpreted as a mechanism for avoiding inbreeding. However, a comparative survey found that many dichogamous species are self-incompatible (SI), suggesting dichogamy evolved for other reasons, particularly reducing interference between male and female function. Here we re-examined the association between dichogamy and SI in a phylogenetic framework, and tested the hypothesis that dichogamy evolved to reduce interference between male and female function. Using paired comparisons and maximum-likelihood correlation analyses, we find that protandry (male function first) is positively correlated with the presence of SI and protogyny (female function first) with self-compatibility (SC). In addition, estimates of transition-rate parameters suggest strong selection for the evolution of SC in protogynous taxa and a constraint against transitions from protandry to protogyny in SC taxa. We interpret these results as support for protandry evolving to reduce interference and protogyny to reduce inbreeding.
Clonal growth in plants can increase pollen and ovule production per genet. However, paternal and maternal reproductive success may not increase because within-clone pollination (geitonogamy) can reduce pollen export to adjacent clones (pollen discounting) and pollen import to the central ramets (pollen limitation). We investigated the relationship between clone size and mating success using clones of Malus x domestica at four orchards (blocks of 1–5 rows of trees). For each block, we measured maternal function as fruit and seed set in all rows and paternal function as siring rate in the first row of the adjacent block. Expected relations between reproductive success and clone size were generated from simulations and data on pollen dispersal in this species. Siring rate per clone averaged 70\% and did not increase significantly with block size, consistent with simulations of pollen dispersal under pollen discounting. Simulations also indicated that the ratio of compatible to incompatible pollen received by a tree should decline with increased block size and from the periphery to the centre of blocks. However, no significant reductions in female function were detected among block sizes or within blocks. Our results suggest that paternal function may be more sensitive to the effects of clonality than female function.
Protandry (when male function precedes female) can enhance fitness by reducing selfing and increasing pollen export and outcrossed siring success. However, responses to selection on protandry may be constrained by genetic variation and correlations among floral traits. We examined these potential constraints in protandrous Chamerion angustifolium (Onagraceae) by estimating genetic variation in male-phase duration and associated floral traits using a paternal half-sib design and selection experiment. Narrow-sense heritability of male-phase duration was estimated as 0.23 (SE +- 0.04) and was positively correlated with floral display. The selection experiment shortened male-phase duration 0.8 SD from the parental average of 17.0 h and lengthened it by 2.0 SD. Furthermore, fixed floral longevity caused a negative association between male- and female-phase durations. These results suggest that selection on male-phase duration is not limited by genetic variation. However, changes in male-phase duration may influence pollinators through correlated changes in floral display and reduced opportunities for pollen receipt during female phase.
Mating by outcrossing plants depends on the frequency and quality of interaction between pollen vectors and individual flowers. However, the historical focus of pollination biology on individual flowers (floricentrism) cannot produce a complete understanding of the role of pollination in plant mating, because mating is an aggregate process, which depends on the reproductive outcomes of all of a plant’s flowers. Simultaneous display of multiple flowers in an inflorescence increases a plant’s attractiveness to pollinators, which should generally enhance mating opportunities. However, whenever pollinators visit multiple flowers on an inflorescence, self-pollination among flowers can reduce the pollen available for export to other plants (pollen discounting) and increase the incidence of inbreeding depression for embryos and offspring. Therefore, the size of floral displays that maximizes mating frequency and quality generally balances the benefits of attractiveness against the costs of self-pollination. This balance can shift considerably if different flowers serve female and male functions at one time (sexual segregation) and flowers are arranged in inflorescences so that pollinators visit female flowers before male flowers. However, the effectiveness of sexual segregation depends on the extent to which a particular inflorescence architecture induces consistent movement patterns by pollinators. In general, the consistency of pollinator movement patterns varies with inflorescence architecture and differs between pollinator types. Such variation creates many options for the evolution of the diverse inflorescence characteristics within angiosperms, which can be appreciated only by moving beyond a floricentric perspective of the role of pollination in plant mating.
Pollen and ovules experience diverse fates during pollination, pollen-tube growth, fertilization, and seed development, which govern the male and female potential of flowering plants. This chapter identifies these fates and many of their interactions, and considers their theoretical implications for the evolution of pollen export and the production of selfed and outcrossed seeds. This analysis clarifies the importance of pollen quantity and quality for seed production, including the opportunity for poor pollen quality to cause misidentification of pollen limitation. Our analysis emphasizes the asymmetry of pollen and ovule fates and considers its consequences for reproductive evolution. We also identify ovule limitation as a constraint on seed production, which has paradoxically not been recognized before, but is an implicit assumption of previous theoretical analysis of mating-system evolution. Ovule limitation increases the diversity of possible reproductive policies. In addition to ovule limitation, we consider the implications of pollen and resource limitation for the evolution of self- and cross-fertilization. Resource limitation occurs only if plants produce more ovules than they can mature into seeds, which allows a mixture of selfing and outcrossing to be an optimal mating system in some circumstances. The chance of mixed mating being optimal is eroded by trade-offs between self- and cross-pollination, but they do not alter the optimal combination of selfing and outcrossing, should mixed mating be favoured. Our analysis illustrates the key role played by interactions between genetic and ecological influences on reproductive performance in the evolution of plant reproduction.
Robert F. Kennedy, Jr. gave a speech at the Sierra Club’s National Convention and Expo on September 10, 2005 in San Francisco. The transcript is available and I recommend it highly. He describes the relations among business, politics, and the environment; making a strong case for the importance of free-markets and democracy to environmental protection.
In my investigations of ovule fates, I’ve needed to estimate regression parameters from discontinuous functions. A general term for such estimates is breakpoint regression. OFStatisticalEstimates.pdf demonstrates an approach using R for such estimates in the context of seed-ovule ratios. The code includes a mechanism for generating seed-ovule data that illustrate the types of functions that need to be considered.
Sean Rice’sEvolutionary Theory is an excellent journey through the mathematical foundations of evolutionary biology. The book covers a wide array of theory, including single locus models, drift, Price’s Theorem, game theory, and multilevel selection. Despite the often intense content, the book is written with a great, economical style that is easy to read. More importantly, the consistent presentation of such a broad collection of theory highlights the unifying principles of evolution.
This book serves as a great primer on evolutionary theory and, no doubt, I will be refering to it often as a reference text. Evolutionary biology has benefited greatly from a strong theoretical basis. Rice’s book continues that tradition.
I recently lost control of my email. The combination of mailing lists, alerts, table of content notifications, and actual email from friends and colleagues was reaching a few hundred emails a day. The insanity had to stop! Here’s how I regained control.
Goals
Before describing my solution, let’s consider what a good email system should provide?
Notifications of relevant new messages.
A process for keeping track of important and unanswered messages.
Automatic archiving with excellent search capabilities.
Portability and easy access.
Strategy
I implemented my strategy as I switched to a Gmail account, which required that I catalogue and cancel all of my email subscriptions. Rather than re-subscribing to these, I redirected as many as possible to NetNewsWire. Many journals now provide feeds for their table of content alerts (e.g., Nature) and most of the important newsgroups are available through Gmane. The advantage of news feeds over email alerts is that I can easily group the alerts and choose when to refresh the subscriptions. Typically, I refresh my feed subscriptions in the morning as I caffeinate. I can simply flag important threads or articles for followup later if necessary and my Inbox is no longer cluttered.
Switching to Gmail also immediately solved several other issues with email. First, I no longer worry about storing and archiving email. All of it stays on Google’s servers. Second, this also solves the problem of deciding which messages to keep. Previously, for every new message I had to decide whether to delete it forever or store a copy. Although this only takes a few seconds for each message, when you receive hundreds of messages this can add up. Now, I don’t worry about it. I know that with the combination of Gmail’s search capabilities and my Mac’s Spotlight technology, I can find messages almost instantly. Third, Gmail is available from any webbrowser – now, so is my email.
That’s great so far, but I still have a variety of unfiltered email and I want to only be alerted to important or relevant messages. This is where Mail.app’s smart mailboxes and rules become important. The most important rule is that a message from someone who is not in my Address Book is immediately redirected out of my Inbox. I’ve also implemented a variety of aliases that allows easy filtering of email from my Inbox. All of these filtered messages are gathered together in a folder which I, generally, peruse once a day.
Now I’m left with an Inbox containing only messages from people that I know. As new mail arrives, any mail that survives my filters is sent to Growl and an unobtrusive notification apprises me of the sender and subject. I can then choose to ignore the message if I’m busy or switch to Mail and read the message if it appears to be important.
As I process my messages, I implement the GTD workflow: if responding takes less than two minutes, I respond; otherwise, the message is flagged for follow-up. Finally, I have two smart mailboxes: flagged messages; and messages received today. Since I’ve asked Mail to group messages by thread, today’s messages also pull in all of my previous correspondence on the subject. Messages in these two mailboxes are what appear in my main message window. When I switch to Mail all I see are flagged, and therefore important, messages and current conversations.
This all may seem elaborate, but I find it works well.
The current setup at home is that I’ve added all of our music (several thousand songs) to our Mac Mini and then send it through AirTunes to the home stereo. The complication is that the stereo and computer are at opposite ends of the house. Ideally, I can use my iBook to control the Mac Mini without needing to walk down the hall, but how?
One solution is to use VNC, which allows complete control of the Mac Mini. Essentially, the iBook becomes a remote keyboard, mouse, and display. However, I generally only want to either toggle iTunes between play and pause or skip to the next track. Loading up a VNC client and interacting with iTunes directly seems excessive in this case.
An alternate approach I have taken relies on a Terminal session and osascript. The first step is to log into the Mac Mini:
$ ssh Nexus.local. -p 22
Then I can toggle between play and pause with:
$ osascript -e 'tell application "itunes" to playpause'
or skip the current track with:
$ osascript -e 'tell application "itunes" to nexttrack'
I keep the Terminal session active and have added the osascript commands to Textpander so that I can quickly control iTunes remotely.
Recently, I needed to combine several pdf files into one. The The Tao of Mac has a discussion of how to do this and I’m posting the code I used here so that I can find it again later.
gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=out.pdf -c save pop -f *.pdf
Running this from a directory containing only the pdfs to be combined produces out.pdf.
I have used this diagram of evolutionary ecology in a wide variety of contexts. In the hope that it may be useful to others, I have made it available to anyone interested. The OmniGraffle source file is available as EvolEcol.graffle.
In collaboration with Jana and Steve Vamosi, I have started a new project called Plantae. The goal of this project is to create a community website for the collection of evolutionary and ecological data for plant species. An early prototype of the project is available and we welcome feedback on all aspects of the project.
Although the current implementation is rather rough. I hope to make some rapid progress on the design and function of the site in the new year.
Now that intelligent design is back in the Canadian news, we should consider (again!) the consequences of teaching intelligent design in the classroom.
Intelligent design makes two postulates:
Complexity cannot be explained by science.
Given 1, complexity comes from an intelligent designer.
Now, consider a science exam in any subject and the danger of intelligent design being taught in school becomes apparent.
Physics question: Why does the earth orbit the sun?
ID answer: Because of the unnamed intelligence.
Science answer: General relativity.
Geology question: What creates mountains?
ID answer: The unnamed intelligence.
Science answer: Plate tectonics
Biology question: Why are all species on Earth connected through common descent?
ID answer: The unnamed intelligence did it.
Science answer: Evolution.
Don’t be fooled that the creationist agenda ends with biology. They intend to reduce science education to: That’s really complicated; God did it.
KANSAS CITY, KS—As the debate over the teaching of evolution in public schools continues, a new controversy over the science curriculum arose Monday in this embattled Midwestern state. Scientists from the Evangelical Center For Faith-Based Reasoning are now asserting that the long-held ‘theory of gravity’ is flawed, and they have responded to it with a new theory of Intelligent Falling.
‘Things fall not because they are acted upon by some gravitational force, but because a higher intelligence, ‘God’ if you will, is pushing them down,’ said Gabriel Burdett, who holds degrees in education, applied Scripture, and physics from Oral Roberts University…
Some evangelical physicists propose that Intelligent Falling provides an elegant solution to the central problem of modern physics.
‘Anti-falling physicists have been theorizing for decades about the ‘electromagnetic force,’ the ‘weak nuclear force,’ the ‘strong nuclear force,’ and so-called ‘force of gravity,” Burdett said. ‘And they tilt their findings toward trying to unite them into one force. But readers of the Bible have already known for millennia what this one, unified force is: His name is Jesus.’
Mating by outcrossing plants depends on the frequency and quality of interaction between pollen vectors and individual flowers. However, the historical focus of pollination biology on individual flowers (floricentrism) cannot produce a complete understanding of the role of pollination in plant mating, because mating is an aggregate process, which depends on the reproductive outcomes of all of a plant’s flowers. Simultaneous display of multiple flowers in an inflorescence increases a plant’s attractiveness to pollinators, which should generally enhance mating opportunities. However, whenever pollinators visit multiple flowers on an inflorescence, self-pollination among flowers can reduce the pollen available for export to other plants (pollen discounting) and increase the incidence of inbreeding depression for embryos and offspring. Therefore, the size of floral displays that maximizes mating frequency and quality generally balances the benefits of attractiveness against the costs of self-pollination. This balance can shift considerably if different flowers serve female and male functions at one time (sexual segregation) and flowers are arranged in inflorescences so that pollinators visit female flowers before male flowers. However, the effectiveness of sexual segregation depends on the extent to which a particular inflorescence architecture induces consistent movement patterns by pollinators. In general, the consistency of pollinator movement patterns varies with inflorescence architecture and differs between pollinator types. Such variation creates many options for the evolution of the diverse inflorescence characteristics within angiosperms, which can be appreciated only by moving beyond a floricentric perspective of the role of pollination in plant mating.
Harder L.D., Jordan C.Y., Gross W.E. & Routley M.B., 2004, Beyond floricentrism: the pollination function of inflorescences. Plant Species Biol. 19: 137–148 [link][Floricentrism.pdf]
Clonality is very common in flowering plants, but its consequences for sexual reproduction have rarely been explored. While clonal growth can increase the number of flowers a plant produces it may also limit reproductive success through pollen discounting (reduction in pollen exported to adjacent clones) and pollen limitation (failure of outside pollen to reach the centre of a clone). Using clones of domestic apple (Malus x domestica) that ranged from 1 to 5 orchard rows wide, we found that the patterns of siring success were consistent with the presence of pollen discounting, but we failed to detect evidence for pollen limitation. The results suggest that paternal function may be more sensitive to the effects of clonality than female function.
Routley M.B., Kron P. & Husband B.C., 2004, The consequences of clone size for paternal and maternal success in domestic apple (Malus x domestica). Am. J. Bot. 91: 1326–1332 [link][PDF] AppleCloneSize.pdf
Dichogamy, the temporal separation of gender within a flower, is widespread throughout the angiosperms, occurring in over 250 families. There are two forms of dichogamy: protandry, in which male function precedes female function, and protogyny, the converse. Dichogamy has traditionally been interpreted as a mechanism to avoid inbreeding. However, recent evidence indicates that this inbreeding-avoidance hypothesis cannot completely explain the evolution of dichogamy. An alternate hypothesis is that dichogamy acts to reduce interference between gender functions. Interference can occur within a flower or between flowers on an inflorescence and result in substantial reductions in male and female reproductive success. To date there are very few tests of this interference-avoidance hypothesis or, in fact, investigations of the evolution of dichogamy in general. My Ph.D. thesis was a comprehensive evaluation of the evolutionary significance of dichogamy, including functional, genetic, comparative, and theoretical analyses of this important floral character.
This Claytonia species is protandrous. The flower on the left is in male phase with its anthers shedding pollen and the stigma closed and unreceptive. The flower on the right is approximately one day older and is in female phase. The stigma is open and receptive and the anthers have moved away to the side and are empty of pollen.
Functional analyses
As an evaluation of the fitness consequences of protandry, we tested the interference-avoidance hypothesis with enclosed, artificial populations of Chamerion angustifolium (Onagraceae) by experimentally manipulating protandry and inflorescence size and measuring pollinator visitation, seed set, female outcrossing-rate, and outcross siring-success. Protandrous plants had a marginally higher female outcrossing rate than adichogamous plants, but similar seed set and visitation rates. More importantly, protandrous plants (blue points) had, on average, a twofold siring advantage relative to adichogamous plants (red points). However, this siring advantage did not increase linearly with inflorescence size, suggesting that protandry acts to enhance siring success, but not exclusively by reducing between-flower interference.
To better understand the function of protandry, we analyzed single bee visits to pairs of C. angustifolium flowers in the field and the lab. The patterns of pollen removal and deposition revealed two major consequences of simultaneous hermaphroditism. First, the presence of anthers impeded pollinator’s access to the stigma. Second, pollinators spent more time foraging on hermaphroditic flowers, relative to female flowers. Protandry allows pollen to be exported in the absence of this within-flower interference and can enhance both male and female reproductive success through reductions in pollen discounting and facilitated selfing, respectively.
Genetic analysis
The genetic basis of dichogamy may have important implications for its evolution. Consequently, we conducted genetic analyses of protandry in C. angustifolium using a paternal half-sib design and an artificial selection experiment. We found moderate heritability (h^2^=0.27) for the duration of male phase. An analysis of plants from the artificial selection experiment showed no genetic correlation between male-phase duration and aspects of floral size. However, we estimated a positive genetic correlation between male-phase duration and floral display size. In addition, we detected a negative correlation between male- and female-phase durations which creates the opportunity for fitness trade-offs between male and female function.
Phylogenetic analysis
To gain a broader perspective on the evolution of dichogamy, we used a current, well resolved phylogeny of the angiosperms to conduct a comparative analysis of dichogamy and self-incompatibility. Using paired-comparisons and maximum-likelihood correlation analyses, we found that protandry is positively correlated with self-incompatibility and protogyny with self-compatibility. These results support a role for interference avoidance in the evolution of protandry and inbreeding avoidance in the evolution of protogyny, suggesting that the two forms of dichogamy provide different functions. In addition, dichogamy changes character states throughout the phylogeny, allowing rapid responses to changing ecological circumstance.
Theoretical analysis
We developed a conceptual model to synthesize the effects of male-phase duration, inflorescence size, and inbreeding depression on pollen import and export. The relative fitness of protandry is strongly affected by the combination of floral display size and inbreeding depression. Furthermore, the trade-off between male- and female-phase durations produced a fitness landscape much more favourable to the evolution of protandry.
Conclusions
Collectively, this research suggest that protandry enhances male fitness through reductions in both within- and between-flower interference, while protogyny reduces inbreeding. This work has revealed unexpected fitness benefits to protandry and helps to explain the wide taxonomic and ecological distribution of this trait in flowering plants.
Routley M.B. & Husband B.C., 2005, Does sexual segregation reduce within-flower interference? In preparation [draft]
Routley M.B. & Husband B.C., 2005, Responses to selection on male-phase duration in Chamerion angustifolium. J. Evol. Biol. J. Evol. Biol. 18:1050-1059 [link][pdf]
Routley M.B., Bertin R.I. & Husband B.C., 2004, Correlated evolution of dichogamy and self-incompatibility: a phylogenetic perspective. Int. J. Plant Sci 165: 983-993 [link][pdf]
Routley M.B. & Husband B.C., 2003, The effect of protandry on siring success in Chamerion angustifolium (Onagraceae) with different inflorescence sizes. Evolution 57: 240–248 [link][pdf]
The outcrossing rate is a fundamental attribute of plant populations that determines population genetic structure, individual plant fitness, and ultimately speciation rates. The outcrossing rate can be influenced by population size through reductions in both mate availability and pollinator service. We investigated the effect of population size on the outcrossing rate in 10 populations of Aquilegia canadensis in Southern Ontario, Canada.
Across a range of sizes from 32 to 750 reproductive individuals, we found that small populations (n < 35, red line) had a significantly lower outcrossing rate than large populations (n > 90, blue line).
Given the high estimate for inbreeding depression in this species (0.88 ± 0.14), small populations may experience a rapid decline in population-level fitness that can lead to local extirpation. The consequences of human-induced habitat fragmentation suggest that such local extinctions are common due to this demographic effect.
Routley M.B., Mavraganis K. & Eckert C.G., 1999, Effect of population size on the mating system in a self-compatible, autogamous plant, Aquilegia canadensis (Ranunculaceae). Heredity 82: 518–528 [link][PopulationSizeT.pdf]
As I use R for data analysis and simulations, I become more comfortable and proficient with the R/S syntax and style of programming. One important insight is the use of vector assignments in simulations. I have often read that using such assignments is the preferred method, but until recently I had not realised the importance of this statement. To illustrate the use of vector assignments and their advantages, consider two models of the style illustrated below:
Model 1:
value1List <- seq(1:10)
value2Function <- function (value1) {
ifelse(value1 < constant1, constant2, constant1)
}
tableDimension <- length(value1List)
outputTable <- NULL
outputTable <- data.frame(value1=numeric(tableDimension),
value2=numeric(tableDimension))
n <- 1
for (value1 in value1List) {
outputTable[n, ] <- c(value1, value2Function(value1))
n <- n + 1
}
Model 1 is how I originally approached R programming. It begins with declaration of a sequence for value1 and a function declaration to calculate value2 from each value1. I then declare a table to capture the output and fill it with zero values. The main loop of the program consists of replacing the rows of the output table with each value of value1 and the calculated value2. I use the variable n to keep track of the next row in the table. The function rbind() could also be used to generate the table, but it’s use for large datasets is quite inefficient.
Model 2 takes the approach of constructing each column of the output table in sequence. It begins by repeating the values of the value1List and then creates the value2 column through a vector assignment. No control structures or function calls are required in Model 2.
How is this important? Model 1 seems intuitive (at least to me) while the syntax of Model 2 is opaque at first glance. However, consider this figure:
On the x-axis is the number of data points in the output table on a log scale. The y-axis shows how long the model takes to calculate these values. Model 1 is the blue line. Model 2 is the red line. This illustrates two important points:
* Model 1 is always slower than Model 2.
* As the size of the dataset increases, Model 2 remains fast while Model 1 rapidly consumes all of the computer resources.
This is why vector assignments should be used when programming with R. Just to be clear, the models described here are simple abstractions of the types of models used to generate this figure.
A particular challenge with maintaining a weblog is the uploading and resizing of images. The process involves choosing the correct images, creating large & thumbnail sized versions, uploading these images to the webserver, and posting the appropriate code into the weblog post. In the spirit of my last few posts, image2web is an applescript I use to automate this process:
--user-specific variables
property theAlbum : "Marked"
--contains the images to be uploaded
property theBasePath : "the:path:to:the:local:images:" as alias
--the local path to the weblog
property tagBaseUrl : "[www.your.website.org/path/to//...](http://www.your.website.org/path/to//blog/images/)"
--the url to the weblog images
---declare globals
property htmlText : ""
--stores the image tags & is copied to the clipboard
tell application "Finder"
set theList to name of every folder of theBasePath
end tell
--choose which weblog category the images belong to
set theCategoryList to choose from list theList
with prompt "Choose the post's category:"
set theCategory to first item of theCategoryList
tell application "Finder"
set theCategoryFolder to folder theCategory of theBasePath
end tell
--I use a smart album that collects photos with the checkmark tag
tell application "iPhoto"
activate
select album theAlbum --so we can see which images are involved
set theImages to every photo of album theAlbum --collect the images
repeat with thisImage in theImages
set thisImage to get image path of thisImage
my processImage(thisImage, theCategoryFolder)
--resize & generate the thumbnail
set theResult to the result --avoid declaring more globals
set thePhotoName to item 1 of theResult
set theMainImagePath to item 2 of theResult
set theThumbnailImagePath to item 3 of theResult
my uploadImage(theMainImagePath, theThumbnailImagePath) --upload the image
my makeTag(theCategory, thePhotoName) --create the appropriate html
end repeat
set the clipboard to htmlText --pass the html code to the clipboard
end tell
on processImage(thisImage, theCategoryFolder)
set theResult to display dialog "Enter the name for " & thisImage & ":" default answer ""
set thePhotoName to text returned of theResult
tell application "Finder"
set theDestinationPath to POSIX path of (theCategoryFolder as string)
set theMainImagePath to (theDestinationPath & thePhotoName & ".jpg")
set theThumbnailImagePath to (theDestinationPath & thePhotoName & "-thumb.jpg")
do shell script "/usr/local/bin/convert -resize 640x480 +profile \" * \" " & "\""
& thisImage & "\"" & " " & theMainImagePath
---use extra quotes to protect against spaces in path names
do shell script "/usr/local/bin/convert -resize 240x240 +profile \" * \" " & "\""
& thisImage & "\"" & " " & theThumbnailImagePath
end tell
return {thePhotoName, theMainImagePath, theThumbnailImagePath}
end processImage
on uploadImage(theMainImagePath, theThumbnailImagePath)
set theMainImage to POSIX file theMainImagePath
set theThumbnailImage to POSIX file theThumbnailImagePath
tell application "Transmit"
open theMainImage
open theThumbnailImage
end tell
end uploadImage
on makeTag(theCategory, thePhotoName)
set htmlText to htmlText & ""
--show the thumbnail & link to the full-size image
end makeTag
The CBC has begun an experiment with podcasting. I’m impressed with the progressive approach to technology that the CBC has adopted and hope they expand the experiment to more of their programs.
Quirks & Quarks is the CBC’s excellent science program. I usually download the mp3 archives of the show on the weekends and listen while I walk Ceiligh.
Of course, loading up the Quirks & Quarks webpage, finding the archives, downloading the mp3s, and adding them to iTunes takes at least a few minutes. Computers are much better and handling such tedium.
The “Astronomy Picture of the Day” is a source of fantastic images. To take advantage of this resource, I went looking for a way to automatically set the current image as my Desktop background. A quick Google search turned up a perl script at www.haroldbakker.com. Although this was a great start, I wasn’t completely happy with the implementation of this script and decided to write my own.
The apod.pl script is written in perl and both sets the Desktop background and copies a description of the image to the Desktop as an html file. You can add the script to your Script menu and run it as appropriate. Even better, download the runApod.scptapplescript and have iCal set the Desktop at a convenient time. I’ve set up my computer to run the perl script early each morning so that I have a new Desktop background each day. Note that runApod.scpt expects apod.pl to be in “~/Library/Scripts/apod/”.