Friday 22 January 2010

Highly diverse weevils in northern New Guinea

New Guinea is an amazing place. It is one of the final frontiers of exploration, particularly in the biological realm with highly diverse rainforest that cover huge areas and a nearly unbelievable range of habitats from hot, humid mangrove swamp forests to 4,000 m high mountains and glaciers. The diversity of the island astounds everyone who works there and the amount remaining to be discovered absolutely boggles the mind.

A case in point was published late last year, when research on Trigonopterus weevils from the Cyclops Mountains was published. This research was headed up by Alexander Riedel and they looked at the congruence between clades revealed by cytochrome c oxidase 1 (COI) DNA sequences and morphological variation. They found 51 morphospecies which were all congruent with COI data. What is incredible though is the genetic distances within this group. Uncorrected distances between species were incredibly high, the lowest being 16.5% and a mean of 20.5%. Within species variation ranged from 0% (not too surprising), to a whopping 8.8%. To put this in context, a 2% genetic distance is usually bandied about as being the point at which you're thinking that you've got two different species.

This diversity is particuarly impressive when one considers that these results are derived from a single transect in a relatively low area in one mountain range. The authors justifiably expect that more extensive sampling will produce many more species.

Not only are they incredibly diverse, these weevils are also tough. Being cryptorhynchine weevils, their rostrum can fold up into a groove in their thorax when they're disturbed. Unlike most other cryptorhynchines though their elytra are fused together and to the thorax, making them able to withstand extremely high pressure and ensuring that they are very difficult to dissect. This is a problem when dissections are necessary to fully characterise and identify these beetles.

It's a very interesting paper on a really cool group of weevils. Check out the supporting information for habitus photos of the morphospecies and get an idea of the morphological variation in the group.


References:

Riedel A, Daawia D, Balke M. 2010. Deep cox1 divergence and hyperdiversity of Trigonopterus weevils in a New Guinea mountain range (Coleoptera, Curculionidae). Zoologica Scripta 39(1): 63--74.

Haplotype names in R

Emmanuel Paradis, the mastermind behind 'ape' has struck again. This time he brings us the 'pegas' package, the Population and Evolutionary Genetic Analysis system. This package has a function that collapses the haplotypes (unique DNA sequences) in a DNA alignment, something which is extremely useful in various analyses and in the calculation of genetic diversity.

library(ape)
library(pegas)
data(woodmouse)

x<-woodmouse[sample(15, size=110, replace=TRUE), ]

h<-haplotype(x)

h

attr(h, "labels")

Unfortunately, the haplotypes are rather opaquely numbered by Roman numerals and makes it difficult to figure out where these samples came from. The attribute function above tells you which sequences in x make up which haplotypes in h but it's a bit tedious, particularly when dealing with large data sets. To combat this, I've written a function to label each of the haplotypes with the name given in the original DNAbin object:


haploName<-function(hap, dat){
dat<-as.matrix(dat)
nam<-dimnames(dat)[[1]]
for(i in 1:dim(hap)[1]) attr(hap, "dimnames")[[1]][i]<-nam[attr(hap, "index")[[i]][1]]
hap
}

haploName(h, x)
'hap' is the haplotype/DNAbin object obtained from running haplotype, while 'dat' is the original DNAbin object.

Let me know how it goes...

Thursday 7 January 2010

Earthquake maps


There's been a number of earthquakes in the Solomon Islands over the past few days, including one that caused a tsunami to partially destroy the village of Baniata on Rendova, Western Provence. You can see exactly how many earthquakes have occurred there by heading over to http://maps.google.com and pasting into the search box this url: http://www.sdjbrown.110mb.com/equake.kml.

I created that map using data from the USGS Earthquake Hazard program and whipping up an R script to create the KML file. Up to that stage it was pretty easy. Creating the different icons was a little more difficult and required a crash course in the kml specifications, how they differ in Google maps and where to find icons for use in the map (and here too). All in all, it required too much playing around than I should really afford at the moment, but I ended up learning a lot of stuff. There's a number of other things which could be done with this setup, but I probably should go back to doing something important....

Wednesday 6 January 2010

Transitions and transversions in R

A couple of months ago I wrote the following R function to calculate the number of transitions and transversions between DNA sequences in an alignment. The function is fairly slow (an alignment of ~100 sequences, 800 bp in length takes around 30 seconds to run) thanks to the double for loop, however in this case I shall plead Uwe's Maxim: "Computers are cheap and thinking hurts".

In other R news, there's a cool site, R-bloggers, that is a portal to a number of other blogs that deal with R. It's great to see what other people manage to do in R and a good way to learn about its capabilities.

Happy New Year!

library(ape)

#Input: dat---an object of class 'DNAbin'

titv<-function(dat){
mat<-as.matrix(dat)
res<-matrix(NA, ncol=dim(mat)[1], nrow=dim(mat)[1], dimnames=list(x=names(dat), y=names(dat)))
for(i in 1:dim(mat)[1]){
for(j in 1:dim(mat)[1]){
vec<-as.numeric(mat[i,])+as.numeric(mat[j,])-8
res[i,j]<-length(grep("200|56",vec)) #Transitions
res[j,i]<-length(grep("152|168|88|104",vec)) #Transversions
}
}
res
}

#Example

data(woodmouse)

ti<-titv(woodmouse)
tv<-t(ti)

tv[lower.tri(tv)] #Number of transversions
ti[lower.tri(ti)] #Number of transitions

#Saturation plot
dist<-dist.dna(woodmouse)

plot(ti[lower.tri(ti)]~dist)
points(tv[lower.tri(tv)]~dist, pch=20, col="red")