## Happy (late) October 1st

China just had their national day (called GuoQinJie I’m told) on October 1st. It was their 60th anniversary so there was a pretty big parade. Which is actually a bit frustrating since I was in Tienanmen Square last October 1st and there was nothing but a bunch of tourists milling around (the rest of the trip was great anyway so no big deal). Apparently if you’re ever planning on visiting Beijing on National Day, you need to make sure it’s in a year ending in 9 or 4. Anyway, my wife came across this pretty cool time lapse video of the parade (the video page has it in HD):

## Tab Indented Standard Input Redirect in Bash

I managed to forget how to redirect standard input (when you want to feed a bunch of lines to a program) in a bash script while still indenting and had to go digging around for it. So I figured I'd make a note here so I don't forget again and for anyone else in the same boat. It's just <<- instead of <<. For example if you want to keep indentation within a loop:

BASH:
1. for i in 1 2 3 4;do
2.     cat<<-EOF
3.         This is loop \$i
4.         More advanced stuff could go here
5.     EOF
6. done

You can use whatever you want to indicate the end of the input instead of EOF if it floats your boat (as long as you use the same thing both times) but unfortunately <<- doesn't work with spaces for indentation (although I'm a tab man myself).

## The Birds and the Bees of Leatherbacks

When I was writing up the last post on the Great Turtle Race, I came across this Wikipedia page that has details on every Colbert report ever (what doesn't Wikipedia have?). It included this quote on Stephen Colbert's leatherback:

Stephen is unhappy at the fact that Stephanie Colburtle The Turtle did not win The Great Turtle Race, after being bested by another turtle named Billy. He claims Billy is a male, and demands a re-race. (After explaining that one can tell the sex of a turtle by the concavity of its plastron, Stephen says that he checks the plastron on "all [his] dates, and if it's not concave, [he is] outta there." However, a concave plastron denotes a male turtle.)

Now I'm not totally sure the concave plastron bit works with leatherbacks since they're more barrel-shaped than turtle-shaped but I guess it's possible. But on the topic, I just thought I'd share a couple tips for determining leatherback sex.

First, is it on a beach? If so, it's female. Healthy male leatherbacks never return to land after their initial crawl from the nest to the ocean. That makes research programs that catch turtles at sea the only way to look at male leatherbacks.

Second, does it have a long tail that trails well behind the shell? Then it's a male. Leatherbacks (and other sea turtles) store their penis in their tail. The tails of female turtles barely extend past their shell. The tails of male turtles, shall we say, hang low and wobble to and fro. I couldn't dig up a picture of a male leatherback but here's a picture of a male green sea turtle tail (from seaturtle.org courtesy of Daha Diew and Alain Gibudi) that should give an idea (that's its rear flippers in the left edge of the picture).

And now you know.

## Great Turtle Race

I'm a bit late on this one (I don't know how I managed to miss it since I had to put the data together) but National Geographic and Conservation International had a Great Turtle Race with a bunch of leatherback turtles tagged by my old adviser. They took data from turtle tracked from Nova Scotia to South America and had a big two-week event watching which turtle reached the Caribbean first. They have a pretty cool animation of the satellite tracking (although of course not quite as good as mine) and some cute leatherback artwork (complete with leathery back instead of shell, although why are they green?).

That site also has the first leatherback game I've ever seen. The artist did a really good job since the view is pretty much identical to the view we get from a shoulder mounted turtleCam. Unfortunately, the game turtle handles like a tank which really doesn't do justice to the maneuvering ability of leatherbacks. They're huge animals but in the water they're really quite graceful and they can turn on a dime (as I quickly found out when we were trying to catch them).

Anyway, it looks like the turtle named Backspacer (it's weird to see all the interesting names since we always call the turtles by their tag ID number), sponsored by Pearl Jam, yes that Pearl Jam, won the race. Turtle Cali won the diving portion of the race and received an Iron Turtle Award. Here's a nice post-race summary and also Olympic swimmer (and turtle coach) Jason Lezak's take on it. It's great to see so much public interest in leatherback turtle tracking and National Geographic and Conservation International did a great job promoting and running the event.

## Displaying Code in LaTeX

gioby of Bioinfo Blog! (an interesting read by the way) left a comment asking about displaying code in LaTeX documents. I've sort of been cludging around using \hspace's and \textcolor but I've always meant to figure out the right way to do things so this seemed like a good chance to figure out how to do it right.

LaTeX tends to ignore white space. This is good when you're writing papers but not so good when you're trying to show code where white space is an essential part (e.g. Python). Luckily there's a builtin verbatim environment in LaTeX that is equivalent to html's <pre>. So something like the following should preserve white space.

\begin{verbatim}
for i in range(1, 5):
print i
else:
print "The for loop is over"
\end{verbatim}

Unfortunately, you can't use any normal LaTeX commands inside verbatim (since they're displayed verbatim). But luckily there a handy package called fancyvrb that fixes this (the color package is also useful for adding colors). For example, if you wanted to highlight "for" in the above code, you can use the Verbatim (note the capital V) environment from fancyvrb:

\newcommand\codeHighlight[1]{\textcolor[rgb]{1,0,0}{\textbf{#1}}}
\begin{Verbatim}[commandchars=\\\{\}]
\codeHighlight{for} i in range(1, 5):
print i
else:
print "The for loop is over"
\end{Verbatim}


If you really want to get fancy, the Pygments package in Python will output syntax highlighted latex code with a command like: pygmentize -f latex -O full test.py >py.tex The LaTeX it outputs is a bit hard to read but it's not too bad (it helped me figure out the fancyvrb package) and it does make nice syntax highlighted output.

Here's an example LaTeX file with the three examples above and the pdf it generates if you're curious.