Tuesday, 13 December 2011

spider: an R package for species identity and evolution


spider: Species identity and evolution is an R package developed by the Lincoln University molecular ecology lab group to do a range of analyses that various lab members wanted to run that were not yet implemented in R. In particular, the package provides functions for conducting sliding window analyses on DNA sequences, the calculation of identification efficacy of a library of reference DNA sequences, and the segregation of distance matrices into their inter- and intra-specific components.

The above are the main attractions, and the ones that we tend to write about when promoting it in places like the 4th International Barcode of Life Conference. There's a bunch of other neat utilities in there also though. A couple of the ones that I particularly enjoy are tiporder(), which returns the tip labels in the order in which they appear on the tree; paa() which conducts population aggregate analysis on a dataset; and rosenberg() which calculates Rosenberg's probability of monophyly for the nodes on a tree.

Spider is available on CRAN, and R-Forge, the latter providing opportunities to report bugs and to collaborate in the future development of the package should you desire to do so.

Vanuatu Caddisflies

A recently published paper by Kjell Johanson revises the caddisfly fauna of Vanuatu, descibing 12 new species and providing a key to the species currently known from the archipelago. It is an important contribution to the knowledge of the caddisfly fauna of the region, as most of the previous work done on the fauna of the region is several decades old.

A couple of things stood out to me in this paper. The first is that Orthotricha has not been recorded from any other oceanic Pacific islands. These are small (2-3 mm wing length) creatures, and it is likely that they just haven't been collected elsewhere in the Pacific. The second was their discovery that a female of Triplectides australis had a large number of larvae inside her abdomen. While I was hitherto unaware that ovoviviparity occurred in caddisflies, it turns out that this has been known since 1890, the first instance of it being confirmed by Prof. Wood-Mason in the following manner:
I threw the insect alive into a liqueur-glass of whiskey that happened to be ready at hand.

Adult caddisflies tend to be overlooked by the general public, usually being confused as small, fairly dull-looking moths. Their larvae are aquatic where they form an important part of the macro-invertebrate fauna of streams, and can be useful as indicators of water quality and stream health. Unfortunately, very little biological information is recorded in the paper, and larvae are not considered. In part this is due to Malaise and light traps providing the bulk of the material that was considered in the revision. Discovering and describing larvae and their habitats is a natural application of the taxonomic effort of this paper.

References

Johanson KA, Wells A, Malm T, Espeland M. 2011. The Trichoptera of Vanuatu. Deutsche Entomologische Zeitschrift 58(2): 279-320.

Wood-Mason J. 1890. On a viviparous caddis fly. Annals and Magazine of Natural History 6th series, 6: 139-141.

Friday, 18 November 2011

TVNZ streaming America's Cup races live

Good news for New Zealand sailing fans: TVNZ is now streaming the AC45 world series matches live. Check out the sailing news page of their website to be directed to the links. Replays can be accessed by clicking through their OnDemand links, but the price paid is having to endure a Microsoft ad before getting into the actual footage. Access to the full replays on YouTube is once again delayed for viewers from NZ, but hopefully will be available in a week or so.

Unfortunately, coverage of the San Diego races has been a bit of a debacle. A lack of communication regarding the course, time of live streams, and delays in the posting of full replays have left a fans with a sour taste in their mouths. I am personally annoyed that the full replays for Port Cities Challenge that kicks off the event are not available. Let us hope that the organisers are learning valuable lessons so they don't make these mistakes again.

Wednesday, 2 November 2011

Using Sweave with Beamer: A note on fonts

Recently, I've been preparing a poster using the LaTeX packages Beamer and beamerposter. The poster discusses a bunch of R stuff that I've been doing lately, so I successfully used Sweave to incorporate R code into the poster. However, I had some trouble with package names that I wanted to typeset as small caps. The package names looked the same as the rest of the text. A bit of sleuthing around revealed Sweave as the culprit. In the Sweave.sty package, on line 20, it calls the deprecated LaTeX package "ae", which for some reason doesn't recognise small caps. Changing the package to "lmodern" made small caps turn up correctly within the text.

Unfortunately, my problems had not yet been solved completely. I had mentioned the package names in the titles which were set in bold. I thus had created a fairly commonly encountered bugbear with LaTeX—the non-compatibility of bold and small caps in computer modern font. While there are workarounds for this (see this Stack Exchange and TeX FAQ for more details), unfortunately these solutions did not work with Beamer.

So, I set about finding a font that both looked alright, and would accomodate bold and small caps. I found that using helvetica would be fine, but had to be loaded after Sweave to work. As my Sweave block kept placing the \usepackage{Sweave} immedediately before \begin{document}, I resorted to calling helvetica in the Sweave file itself.

The relevant lines in of the Sweave.sty (lines 18-21) file. Before:
\ifthenelse{\boolean{Sweave@ae}}{%
\RequirePackage[T1]{fontenc}
\RequirePackage{ae}
}{}%
After:
\ifthenelse{\boolean{Sweave@ae}}{%
\RequirePackage[T1]{fontenc}
\RequirePackage[scaled]{helvet}
}{}%

Wednesday, 19 October 2011

Microscopy mounting media II

Today I found a brilliantly written, hugely informative, and well-illustrated guide to Safe Microscope Techniques for Amateurs, written by Walter Dioni. It is a series of four articles, originally published in Micscape, the magazine of the Microscopy UK organisation.

"Safe Microscope Techniques for Amateurs" discusses liquid media, solid media, mixed media and glycerin jellies. All techniques are explained clearly and several suggestions for equipment or readily available appropriate subsitutes are given. In summary, the series is an excellent introduction to microscope mounting techniques and gives some very useful tips for making good microscope mounts.

Sunday, 2 October 2011

Old codes

The International Code of Zoological Nomenclature is the document that details the rules of how the scientific names of animals are managed. It's a complex document with a rich history, and it is necessary to consult previous editions for correct knowledge as to the reasoning behind some of the provisions of the code. Old editions tend to be fairly hard to come by, but thankfully the Biodiversity Heritage Library has them digitised and on the interweb for all to enjoy. Thus, it holds copies of the first (1961), second (1964), third (1985), and fourth (current, 1999) editions are all available. The current edition is also available from the official website as an indexed html version.

Wednesday, 28 September 2011

Jetsetting Dragonflies

Muhammad Mahdi Karim Image: Muhammad Mahdi Karim

Not only not are dragonflies some of the best aeronauts of the insect world, some also have the greatest endurance. A couple of years ago, it was discovered that the globe skimmer dragonfly (Pantala flavescens) migrates from India to South East Africa via the Indian Ocean islands of the Maldives and the Seychelles, and back via East Africa. That's a grand total of around 18 000 km. That's a fair bit further than the 11 000 km I recently traveled from New Zealand to South Africa. It is considered that the round trip takes place over several generations, but it's still an amazing phenomenon.

For more information, there's news reports from Wildlife Extra and the Daily Mail; and a blog post from National Geographic. There's even a graphic on DeviantArt celebrating the journey. To hear it from the horse's mouth (so to speak) watch a video of Charles Anderson himself talking about his findings.

Tuesday, 20 September 2011

Beamer themes

I enjoy using Beamer for my presentations. Initially, the limitations it imposes (particularly on graphics placement) are irksome, but after a while you realise that they actually help you create better presentations faster. I've tried 'quickly' putting together something in PowerPoint since starting to use Beamer and found it so fiddly that I went straight back and did it all in Beamer. However: I still find the themes and colour schemes provided in the base distribution of beamer to be less than ideal, and disobey the university's guidelines for presentations. As I garner the skills to start preparing my own themes, a list of customised Beamer themes will provide inspiration and guidance. In particular, I like the look of the Torino theme.

Thursday, 15 September 2011

Extracting comments from PDFs

I received a reviewer's response from one of my submitted papers a while ago, and have delayed working on it because they had written their comments in the PDF using "sticky notes". Unfortunately, these notes don't print very well. I like to be able to read things off the computer, so this presented a problem. Thankfully, PDFs encode their sticky note comments in ASCII-formatted text, which meant that I was able to extract the comments using the beautiful linux command line:
grep -o --text /Contents\([^/]* review.pdf | tee comments.txt
This single line resulted in a nice text file for me to print as I please.

Wednesday, 14 September 2011

1 2 3 steps to publishing a scientific comment

For a humorous, yet ultimately disturbing tale, check out Rick Trebino's How to publish a scientific comment in 1 2 3 easy steps, then wonder how scientific journals managed to achieve the power over the research process that they currently have.

Tuesday, 13 September 2011

Quote: GK Chesterton from 'Orthodoxy'—Nature

The essence of all pantheism, evolutionism and modern cosmic religion is really in this proposition: that Nature is our mother. Unfortunately, if you regard Nature as a mother, you discover that she is a step-mother. The main point of Christianity was this: that Nature is not our mother: Nature is our sister. We can be proud of her beauty, since we have the same father; but she has no authority over us; we have to admire, but not to imitate. This gives to the typically Christian pleasure in this earth a strange touch of lightness that is almost frivolity. Nature was a solemn mother to the worshippers of Isis and Cybele. Nature was a solemn mother to Wordsworth or to Emerson. But Nature is not solemn to Francis of Assisi or to George Herbert. To St. Francis, Nature is a sister, and even a younger sister: a little, dancing sister, to be laughed at as well as loved.


Chesterton GK. 1908. Orthodoxy. Image, New York (2001 Edition)
Chapter VII: The Eternal Revolution. Page 115.

Monday, 12 September 2011

post-installation script error solved

Had some problems today with aptitude getting its knickers in a knot, returning the error
dpkg: error processing install-info (--configure):
subprocess installed post-installation script returned error exit status 1
. This blog post helped to solve the problem simply and easily with the commands:
sudo rm /var/lib/dpkg/install-info.postinst
sudo aptitude reinstall install-info
Many thanks to azimout!

Sunday, 11 September 2011

Alternately coloured line environment with fancyvrb

Recently, while typing up an R tutorial, I used the LaTeX fancyvrb package to create two environments—one coloured blue for R commands, and one coloured red to display R output. This worked well for large blocks of each type. Then I decided I wanted to display a number of one-line commands and output alternately. Looking up the fancyvrb package documentation, it was easy to get alternate colours. The problem was, it did it globally. My environments for input and output also went psychedelic.

After a bit of messing around, I discovered the following solution. My red environments remain red, my blue environments stay blue, and alternate colours only turn up when I want them to!


\documentclass{article}
\usepackage{fancyvrb}
\usepackage{color}

\newcommand{\ChangeLine}[1]{%
\ifodd\value{FancyVerbLine}%
\textcolor{blue}{#1}\else\textcolor{red}{#1}\fi}

\DefineVerbatimEnvironment{blueEnv}{Verbatim}{formatcom=\color{blue}}{}
\DefineVerbatimEnvironment{redEnv}{Verbatim}{formatcom=\color{red}}{}
\DefineVerbatimEnvironment{alternate}{Verbatim}{formatcom=\renewcommand{\FancyVerbFormatLine}{\ChangeLine}}{}


\begin{document}

\begin{Verbatim}
aaaaaaaaaaa
bbbbbbbbbb
cccccccccccc
ddddddddddddd
\end{Verbatim}

\begin{blueEnv}
aaaaaaaaaaa
bbbbbbbbbb
cccccccccccc
ddddddddddddd
\end{blueEnv}

\begin{redEnv}
aaaaaaaaaaa
bbbbbbbbbb
cccccccccccc
ddddddddddddd
\end{redEnv}

\begin{alternate}
aaaaaaaaaaa
bbbbbbbbbb
cccccccccccc
ddddddddddddd
\end{alternate}

\end{document}

Thursday, 1 September 2011

Guardian article about academic publishing

I agree with a lot of this article in the Guardian. Especially:
Reading a single article published by one of Elsevier's journals will cost you $31.50. Springer charges €34.95, Wiley-Blackwell, $42. Read 10 and you pay 10 times. And the journals retain perpetual copyright. You want to read a letter printed in 1981? That'll be $31.50.
I get especially annoyed with the said letter was published in 1881, and therefore out of copyright yet they still charge you for it.

Sunday, 28 August 2011

Yet another estimate of the number of species on earth

This week in PLoS Biology, paper was published that estimates the number of species on earth being around the 8 million mark (give or take 2 million). This study takes a rarefaction-type approach, seeing how the rate of discovery of higher taxa is decreasing, and extrapolating from that to the species level, resulting in the figure of 8.7 million with an error range of 1.3 million.

This study is nothing new—there's been a number of estimates published over the past two decades that attempt to give a number to the total diversity of life on earth. While this one does appear to be a bit more robust, all these studies are based on various assumptions, and have given some very different figures. There seems to be some sort of convergence on the 10 million mark, but at the end of the day, we just don't know.

I guess the value of these papers are that they make public how far we have to go before we know the most basic thing about the other organisms that share the world with us. I still surprise people when I tell them my tales of discovering new species, the general belief being that we know essentially all there is to know about biology. However, unless there are some useful outcomes (e.g. increased funding or employment) from them, I view these papers with a certain cynicism. We know the task ahead of us is huge. It'd be great to be able to dive into it whole-heartedly and without needing to worry about the finances.

The paper did alert me to the World Taxonomist Database, a register of taxonomists from around the world and encompassing all taxa. The register gives contact details for each of the researchers in the database, as well as their taxonomic and geographic interests. It's a very handy resource.

Friday, 26 August 2011

Harvard's Caribbean Insects


Harvard University has has an interest and presence in the Caribbean for the past 150 years. As you can imagine, they've accumulated a lot of information on the biota of the region. They've made a sizable portion of their entomological knowledge available on the Caribbean Insects @ Harvard Entomology webpage, which is very nice of them. of particular interest are is the insect and plant database which you can search to find specimen information, or cool photos, like the image of Eurhinus festivus suturalis above. They've also made a whole lot of papers available through their taxonomic literature database, though unfortunately I was unable to access the database for some reason or another. Finally, they've made a number of posters of different taxa available, and very kindly sent me copies of their beautiful weevil and bark beetle ones. Good on them for creating all this cool stuff!

Mounting insect specimens in resin

I do a number of school presentations throughout the year, and am frequently asked if I can bring a few specimens to show the students. I am usually fairly loathe to do so, because of the fragility of most specimens, and the fact that the majority of my specimens are fairly small and therefore not especially exciting. Getting into work today, I saw a couple of resin-encased beetles I have received as gifts and had a brainwave. A quick search for instructions for how to do it revealed a number of tutorials. The one by Dalchem is useful, as is the guide provided by Complete Paints.

Wednesday, 24 August 2011

Rings and starships: A new shark embraces pop culture


I couldn't let this one go past without commenting on it. Today in Zootaxa, a description was published today that has references to two highly regarded elements of pop culture in the past 50 years. Gollum suluensis is a deep water shark from the Philippines whose name calls to mind Gollum from The Lord of the Rings, and Captain Sulu from Star Trek.

Before latin scholars point out that the -ensis suffix to the specific name refers to a place not to a person, I will clarify the specific name actually refers to the Sulu Sea. The generic name though is genuine. Established in 1973 by Leonard Compagno, the original description gives this explanation for the name:
Gollum (treated as a masculine noun), named for the antihero of J. R. R. Tolkien's Lord of the Rings trilogy, to whom this shark bears some resemblane in form and habits.
Appropriately enough, the type species lurks around New Zealand.

References
Compagno LJV. 1973. Ctenacis and Gollum, two new genera of sharks (Selachii: Carcharhinidae). Proceedings of the California Academy of Sciences 4(39): 257–272.

Last PR, Gaudiano JP. 2011. Gollum suluensis sp. nov. (Carcharhiniformes: Pseudotriakidae), a new gollumshark from the southern Philippines. Zootaxa 3002: 17-30.

Monday, 22 August 2011

Bohumiljania of New Caledonia


Today in Zootaxa a paper was published describing a number of species in the leaf beetle genus Bohumiljania from New Caledonia. Unfortunately, these species aren't going to win many prizes in the beauty stakes—they're all pretty nondescript, generic looking chrysomelids (See the picture of Bohmiljania aoupinie above). However, it belongs to a group (the Spilopyrinae), that displays a classical Gondwanan distribution pattern so it will be of interest to those people who are interested in the biogeography of New Caledonia. These beetles tend to be found in mountainous areas, and all known hostplants are in the Myrtaceae.

Incidentally, this is Zootaxa's 3000th issue. Pretty good going for a journal that celebrated its 10th birthday on 28 May this year.


Reference:
Reid CAM, Beatson M. 2011. Revision of the New Caledonian endemic genus Bohumiljania MonrĂłs (Coleoptera: Chrysomelidae: Spilopyrinae). Zootaxa 3000: 1-43. The full 6 MB article is here

Friday, 19 August 2011

Faraday Institute

Today I went to a talk by John Wood, based on the question "Is Man a Machine?". The talk in a nutshell discussed the uncertainty inherent in scientific measurement and human perception, the difference between man and machine being freedom, and that Christ sets us free to question, to investigate and to think.

He also directed us to the Faraday Institute for Science and Religion, particularly the recently developed resource Test of Faith. This resource contains interviews with a number of leading scientists and theologians discussing the connections between the two fields and what they each can offer. In addition, the Faraday Institute website itself contains a large number of audio and video recordings of lectures discussing the interface between religion and science, and published documents on the subject also.

Thursday, 18 August 2011

Invertebrate Macro Photography


Earlier this year, I met up with up-and-coming New Zealand nature photography Bryce McQuillan, who specialises in macro photography of invertebrates, particularly spiders. He puts the majority of his photos on Flickr and are well worth checking out.

Nature photographers are uniquely able to capture and portray the beauty and wonder of the natural world, and communicate it to the public in a way that can be broadly appreciated. The photos of the chalcidoid wasp above and the entomobryoid springtail below demonstrate this. These invertebrates are minute and incredibly beautiful. They are common and widespread, but their small size means that most people are not aware of them. The adage of one picture being worth 1000 words is particularly relevant in this situation.

Bryce's favorite group are spiders, which are particularly needy in the PR department. His photographs are able to capture their beauty and personality in such a way that even those who have no natural fondness for spiders are able to see beyond their "creepy-crawly" facade.

And this is why nature photographers are so important. Photos are an acccessable medium that people are easily able to understand and relate to. They are vital in the communication of the importance of biodiversity to the general public.

Tuesday, 16 August 2011

Book review: "Every Living Thing" by Rob Dunn


The subtitle of this book, "Man's Obsessive Quest to Catalog Life, from Nanobacteria to New Monkeys" caught my eye as I was looking through a book sale table. Being one of those who desires to contribute to this quest, I was delighted to find it. The book is an enjoyable overview of selected personalities whose lives and work define (for the author) the growth of our knowledge of biodiversity. Their stories are told with understanding and humour.

Starting with indigenous knowledge of biota, he introduces us to Linnaeus and Leeunwenhoek before describing modern scientists whose work has increased our appreciation for the diversity of life and expanded our understanding of its limits. The journey described is one that progresses from a focus on the species with greatest impact on daily life, to an understanding that "the rest of life does not revolve around us, nor is it like us (p. 247)". Comparing this discovery to the Copernican revolution, he argues that there remains the need for humility in assessing our knowledge and acheivements in discovering the natural world.

A major theme of the book is the obsessiveness that drives the scientists who are described. Being one who shares a similar outlook, I can sympathise with the men and women described. Indeed, I find myself wishing I could be (to a certain extent) in their shoes. However, I don't know if someone who doesn't have the same drive and desires would find the portrayals heroic or pathetic. As the author describes,
"If systematists are socializing, it means, to many of them, simply time they are not looking at the organisms they really love. The obscurity of the things on which taxonomists work does not lessen their focus. In fact, it may heighten it. To dig into their subject, they have to dig so far in, focus so intensely, that the rest of the world seems farther and farther away." (p. 101)
Balance is important, and many of the best taxonomists I've met understand that. But it is hard, when there's so many fascinating and beautiful creatures out there not to succumb to the temptation.

In summary, "Every Living Thing" is an accessible and enjoyable book that tells the story of a few of the personalities who have contributed to the classification and discovery of the organisms we share this world with.


Dunn, R. 2009. Every Living Thing. Man's Obsessive Quest to Catalog Life, from Nanobacteria to New Monkeys. HarperCollins, New York.

Monday, 15 August 2011

America's Cup revamped


The America's Cup World Series had it's first winner today, and of course I'm happy because Team New Zealand won it. I've always been keen on the America's Cup, but I dare say that the latest revamp of the competition has me excited. The boats look cool, go fast, and having them essentially identical between competitors makes the competition less an arms race and more a test of sailing. The Russell Coutts/Dean Barker rivalry is still In addition, having a lead up to the main event with regattas in multiple locations will make the competition more accessable and will hopefully diminish the (valid) criticisms that the America's cup was becoming merely a distraction for the rich. Sure, there's still an awful amount of money being spent on the water there, but at least it looks cooler now... It's been in Portugal for the last week or so, and is moving to Plymouth, UK in mid-September.

Watch the replay of the 14 August fleet race here

Monday, 8 August 2011

tlmgr not available for Ubuntu

One of the hardest things about LaTeX is the way it manages packages. Doing it manually is (in a word) annoying. When I was on windows I loved MikTeX for the ease by which it downloaded and installed extra packages, and I was disappointed when this functionality wasn't available on Ubuntu. Lately though I discovered that TeXlive had a similar package manager called tlmgr, and I started getting excited. When installing TeXlive though, I was dismayed to find that tlmgr did not work. A bit of a google search later I found that this was reason:
There is no way that a second package manager independent of the normal packaging infra structure (apt here, or rpm, or whatever) can work, because it will break the main system.

TeX Live Manager is currently only for system trees. THere is a patch in the dev repository for activating user mode, so that tlmgr can be used to manage TEXMFHOME, but it has not been worked on since quite some time (Norbert Preining on launchpad.net)

I take this to mean that there's only room in Ubuntu-town for one package manager, and synaptic is it. This is fair enough I guess, but it is still unfortunate.

Norbert goes on to say "get your hands dirty and help coding!" Unfortunately, my perl is non-existent, so I'll have to give it a miss until such a time as I actually have some idea what I'm doing.

Sunday, 7 August 2011

Quote: James Hannam on science and religion

One of the best quotes I've seen recently about the interface between science and religion. It's constructive and promotes dialogue, unlike a lot of the rhetoric that unfortunately gets more publicity.
"Nonetheless, today, science and religion are the two most powerful intellectual forces on the planet. Both are capable of doing enormous good, but their chances of doing so are much greater if they can work together. The award of the Templeton Prize to Lord Rees is a small step in the right direction."

James Hannam on the "Soapbox Science" blog.

Pressing plants

Weevils feed on plants, with many species being very picky about the plants they eat. These host interactions are very important for understanding the ecology of both the weevils and the plants. When collecting therefore, it is important that the plants from which weevils have been collected are identified and noted. Therefore, as a weevil guy, it is important that I have a fair understanding of plant identification.

A key aspect of the process is knowing the proper way to collect, preserve and label plant specimens. Searching the internet has revealed good guides on the University of Florida Herbarium webpage and a PDF produced by the Herb Society of America.

It's not too arduous—pressing plant material can be done by placing the material under a few big books. Much more important is knowing what to put on the label. Plant specimens tend to be mounted on large (A3) sheets of paper, giving a lot of space to write pertinent information. Therefore, major additional categories from that on insect labels include its frequency (is it rare, common, or something in between?), and details of the plant's height, growth habit and description of aspects of the plant that disappear when pressed (e.g. colour of flowers, smell and sap). There's also the space and ability to provide exact locality data and more detailed habitat information than is possible with insect labels.

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.

Sunday, 27 February 2011

Freely available Digital Elevation Models for New Zealand

For people wanting to view aspects of New Zealand's amazing topography, a number of Digital Elevation Models are freely available from Geographx, a company specialising in producing New Zealand geographic information and atlases. Thanks Geographx!

Thursday, 17 February 2011

Amphibious caterpillars in Hawaii


The Hawaiian Islands are renowned for their unique biota that display a number of bizarre adaptations that do not appear elsewhere in the world. Widely known examples of these include the predacious caterpillars in the genus Eupithecia, and the wekiu bug (Nysius wekiuicola) that lives on Mauna Kea eating insects that are blown to them on the wind.

Recent work by Daniel Rubinoff and Patrick Schmitz have added another example to the list: amphibious caterpillars. In a paper published in March in PNAS they describe the ecology of some recently discovered 12 currently undescribed species of the moth genus Hyposmocoma that are able to develop equally well both in and out of water. Intriguingly, a phylogenetic tree hypothesizing the evolution of these insects suggest that this amphibious trait arose independently at least four times, an unexpected result for a specialised trait such as amphibiousness.

The major driving force for the development of this unique lifestyle in Hawaii is believed to be due primarily to a lack of competition. Hawaii lacks the major aquatic insect orders of the stoneflies, mayflies and caddisflies (the latter two represented by introduced species only), leaving Hawaii's freshwater environments unexploited. Hyposmocoma has stepped into the breech.

In addition to the written paper, the authors have provided movies showing the caterpillars moving in and out of the water. They are provided as supplementary information to the paper and available on the PNAS website here and here. Unfortunately, a David Attenborough documentary this isn't. There is no informative commentary spoken with a British accent, but it is an interesting watch nonetheless.

References:
Rubinoff D, Schmitz P. 2010. Multiple aquatic invasions by an endemic, terrestrial Hawaiian moth radiation. Proceedings of the National Academy of Sciences of the United States of America 107(13):5903-5906

Zimmerman EC. 1957. Insects of Hawaii. Volume 6, Ephemeroptera-Neuroptera-Trichoptera and Supplement to Volumes 1 to 5. University of Hawai'i Press.

Monday, 24 January 2011

GIS Shapefile of DOC-administered land

The New Zealand Department of Conservation, fondly known as DOC is the department in charge of the bulk of New Zealand's publically owned land. Their best known pieces of real estate are the 14 national parks that conserve some of New Zealand's most iconic landscapes and least modified habitats. Less well known are the legion of scenic reserves and conservation areas that make up a substantial portion of our property. These smaller reserves are no less interesting, and tend to protect small but important areas of near-natural habitat, or intriguing aspects of New Zealand history. Until now, the main way of finding out about them is by stumbling across them while on a road trip, or by word-of-mouth. However, now DOC has released a GIS shapefile that shows the boundaries of all the conservation estate, along with information on what acts of parliament they're protected under and how large the reserve is.

It is important to note that this shapefile only shows those reserves in DOC's ownership and management. Thus, it does not show community-initiated reserves such as Maungatautari Ecological Island or QEII Covenants; nor does it show reserves owned by city councils, like the Auckland Regional Parks or Christchurch's Port Hills Reserves.

Wednesday, 19 January 2011

Koleopterologische Rundschau

The Austrian entomological journal Koleopterologische Rundschau is an excellent serial that is focussed on beetle taxonomy. It publishes a single issue a year, but this issue is filled to the brim with interesting and informative papers on beetles of all families from Europe and the world. Issues prior to 1990 (Volumes 1-59) are freely available online. PDF versions of papers published since then are also available, but at a cost. Unlike some other outfits though, this cost is actually reasonable; being around 1 Euro per paper.

Saturday, 15 January 2011

The Lay of Gudrún (stanzas 100–101)

At the dark doorways
They dinned and hammered;
there was clang of swords
and crash of axes.
The smiths of battle
smote the anvils;
sparked and splintered
spears and helmets.

In they hacked them,
out they hurled them,
bears assailing,
boars defending.
Stones and stairways
streamed and darkened;
day came dimly —
the doors were held.

The Lay of Gudrún, stanzas 100–101.
JRR Tolkien and Christopher Tolkien. (2009). The Legend of Sigurd and Gudrún. Harper Collins.

Friday, 14 January 2011

Changing phylogeny tip labels in R

During the process of molecular systematic research, specimens are given code names and numbers to keep track of data through the pipeline. These can contain a lot of information of relevance to the researcher, but unfortunately are meaningless to others who aren't as involved with the data. On publication, it is necessary to change the names from the code to a label that is more widely understood. This process can be tedious and fiddly, particularly when it needs to be done multiple times.

The following is a simple R-based solution for changing the tip labels of phylogenetic trees. First, we need to create a tree and a dataframe containing both the specimen codes and the ultimate labels.
library(ape)
tr <- rtree(5)
d1 <- c("t1","t2","t3","t4","t5")
d2 <- c( "paste(italic('Aus bus'), ' top')", "paste(italic('Aus bus'), ' bottom')", "paste(italic('Aus cus'), ' middle')", "paste(italic('Aus cus'), ' north')", "paste(italic('Dus gus'), ' south')" )
d <- as.data.frame(cbind(label=d1, nlabel=d2))

The code in the nlabel column contains code defining a plottable expression that enables scientific names to be formatted as italics. In my work, I saved this table as a separate file which I call with read.table("file.txt", header=TRUE, sep="\t", stringsAsFactors=FALSE, quote=""). The quote argument is important as it carries the nested quotes through into the dataframe properly.

The business of actually changing the tip labels is done with the following lines:
tr$tip.label<-d[[2]][match(tr$tip.label, d[[1]])]
tr$tip.label<-sapply(tr$tip.label, function(x) parse(text=x))

The first line enters the expressions for the new labels in the correct order. The second line converts the character string into a printable expression.

Plot the tree and voila!

Thursday, 13 January 2011

Ubuntu translations

A key part of the Ubuntu philosophy is their emphasis on making computers usable in one's language of choice:
We believe that every computer user should be able to use their software in the language of their choice.

The wiki page provides an entry point for those interested in contributing translations to the project. The process is managed through a project launchpad. Of most interest to me are the Samoan, Maori and Marshallese translations.

Tuesday, 11 January 2011

Origami


Origami is pretty amazing. While my skills have never progressed beyond the traditional crane, I am always amazed at how people can make a square of paper into something amazing. This website shows a particularly spectacular gallery including the origami cicada pictured above. What's really cool is that it also includes a diagram of the folding patterns for each model. All that's needed is the interpretation of said diagrams, and the time to do it!