Monday, 18 July 2011

Quote: GK Chesterton from 'Orthodoxy'

Let us suppose we are confronted with a desperate thing—say Pimlico. If we think what is really best for Pimlico we shall find the thread of thought leads to the throne or the mystic and the arbitrary. It is not enough for a man to disapprove of Pimlico: in that case he will merely cut his throat or move to Chelsea. Nor, certainly, is it enough for a man to approve of Pimlico, for then it will remain Pimlico, which would be awful. The only way out of it seems to be for somebody to love Pimlico: to love it with a transcendental tie and without any earthly reason. If there arose a man who loved Pimlico, then Pimlico would rise into ivory towers and golden pinnacles; Pimlico would attire herself as a woman does when she is loved. For decoration is not given to hide horrible things: but to decorate things already adorable. A mother does not give her child a blue bow because he is so ugly without it. A lover does not give a girl a necklace to hide her neck. If men loved Pimlico as mothers love children, arbitrarily, because it is theirs, Pimlico in a year or two might be fairer than Florence.


Chesterton GK. 1908. Orthodoxy. Image, New York (2001 Edition)
Chapter V: The Flag of the World. Page 66.

Saturday, 16 July 2011

New Zealand Weevil Image Database now online

Etheophanus sp.
In the last couple of days, the TFBIS funded New Zealand Weevil Image Database has been put online. The project involves taking high-quality photos of representatives of every weevil genus (including the Etheophanus sp. shown above) known from New Zealand. It is a great effort, and one that I will make full use of in my research. Not only will it help assisting others to identify NZ weevils, but it will also serve as a useful aid for overseas workers wanting to become familiar with the diversity of weevils in this country, and help in the efforts to produce a coherent classification of the world weevil fauna. Mainly though, it is a splendid showcase of the diversity and beauty of the weevils in NZ, and shows some of the extraordinary forms of many of our species. My picks for the most bizarre are Stephanorhynchus, Geochus, Ectopsis and Colabotelus.

Monday, 2 May 2011

Building R packages for Windows when you don't use it.

Are you a non-windows user wanting to share your R package with others who do use windows? There's a handy utility (http://win-builder.r-project.org/)that allows you to upload your .tar.gz file and it checks it, builds it, and sends you a link to download a nice, shiny .zip file to give to your mates. Problem solved.

Friday, 22 April 2011

Subversion

To start a new project on R-Forge, I've had to starting coming to grips with Subversion, the widely used program for source code versioning. To help me, I've found this tutorial very helpful for learning the "Subversion lifecycle" and the general use of the program. The Subversion book is a wonderful resource, but I'm currently not yet at the stage where my knowledge of the thing is at the level required to understand it properly.

Wednesday, 20 April 2011

Simplifying polygon shapefiles in R

Recently I downloaded the Crosby Code shapefile from Landcare Research's LRIS server for use in some publications I'm preparing. This shapefile is incredibly detailed, far more so than what I require. This detail means that it takes a while for the map to be plotted each time. As detail is less important for me than speed of plotting, I decided to try and simplify the map.

Tuesday, 12 April 2011

Pseudoscorpions


Pseudoscorpions are reasonably common, though inconspicuous, creatures that are found in a range of environments, particularly soil and leaf litter. They are predacious, feeding on things like springtails, bark lice and other invertebrates that they catch with their pedipalps.

I've been interested in pseudoscorpions for quite some time, though I have not yet deliberately retained specimens or allowed myself time to look at them. I recently stumbled across a site that contains a lot of useful information for the budding pseudoscorpion enthusiast. The pseudoscorpion site contains information on how to collect, preserve and identify these usually overlooked creatures.

For those interested in the New Zealand fauna, Max Beier published a key to the species of New Zealand and Norfolk Island in 1976 It is available online here on the Bugz Bibliography of New Zealand Insects Online. Beier also published on the pseudoscorpions of Micronesia, also available on Bugz.

NB: Bugz unfortunately does not provide completely stable URLs for the papers in the database. If the direct links to the papers do not work, search Bugz manually for access to the papers.


References:
Beier M. 1976. The pseudoscorpions of New Zealand, Norfolk and Lord Howe. New Zealand Journal of Zoology 3(3):199-246

Beier M. 1957. Pseudoscorpionida. Insects of Micronesia 3(1):1-64

Tuesday, 29 March 2011

Two R functions for working with DNA alignments

Recently I wrote a couple of small functions as a result of work done by myself and others in my lab group. The first is a function that determines what sites in a sequence alignment are ambiguous (i.e. not A, G, C or T).
require(ape)
data(woodmouse)

is.ambig <- function(x){
   x <- as.matrix(x)
   bases <- c(136, 72, 40, 24)
   ambig <- apply(x, 2, FUN=function(x) sum(as.numeric(!as.numeric(x) %in% bases)))
   ambig > 0
}

is.ambig(woodmouse)
This function utilises the bit-level coding scheme that Emmanuel Paradis developed for encoding sequences in R. The unambiguous bases A, G, C and T have the numeric values 136, 72, 40 and 24 respectively. This function figures out which sites don't have these values and returns a vector of TRUEs and FALSEs, TRUEs being ambiguous bases.

The second function is an implementation of Tajima's K, published as equation A3 in Tajima 1983
tajima.K <- function(x, prop = TRUE){
   res <- mean(dist.dna(x, model="N"))
   if(prop) res <- res/dim(x)[2]
   res
}

tajima.K(woodmouse)
This function calculates the mean number of sites that are different between any two sequences. As a default, it returns the result as a proportion of the length of the alignment. Setting prop = FALSE will return the result as the actual number of sites.

References:
Tajmia F. 1983. Evolutionary relationship of DNA sequences in finite populations. Genetics 105: 437-460.