The most hideous Apple screenshot of all time

I haven’t posted much about Leopard since WWDC, but I just today felt compelled to post this:
Leopard Spotlight menu
It’s an absolute interface abomination on at least three counts:

  • the menu bar is transparent, which is a pretty bad idea,
  • the Spotlight icon is still black despite the menu being selected and
  • while the actual menu highlight is blue, the space surrounding the Spotlight field is graphite (I wonder which setting is actually active in the Appearance pref pane)

Such interface anomalies are, of course, to be expected in beta builds of software, I was just so surprised to find this particular one gracing Apple’s website.


Since I’ve been doing a lot (OK, 400 lines) of Perl scripting this week, I’ve spent quite a lot of time in TextWrangler from Bare Bones Software. I do have a license for TextMate (from MacHeist) and have used it a little in the past, but I’d heard that TextWrangler had built-in FTP/SFTP support this week and, since it’s free, I thought I’d give a go.

Mac OS X users are spoilt for choice when it comes to graphical text editors. We’ve got TextMate, skEdit, SubEthaEdit, TextWrangler, BBEdit, Smultron, the new kid on the block Coda and many others. And, of course, there’s always Apple’s offerings of TextEdit for simple text-editing and XCode for (mainly) Carbon and Cocoa apps.

Of all these apps (aside from Apple’s own), only TextWrangler and Smultron are free, while the others cost between $25 and $125. Being a student on a tight budget, I’m always looking out for a bargain, so TextWrangler seemed like an obvious place to start.


For those of you who used BBEdit Lite and thought it was a bit underpowered, do not be put off TextWrangler — it’s considerably more powerful. It has support for SFTP/FTP (including bookmarking), syntax colouring and function navigation for over 20 languages (with per-language settings), completely customisable keyboard shortcuts, file bookmarks, tabs (of the draw variety), grep-powered text searching (with PCRE 5.0 support), multiple clipboards… the list goes on.

For me, these features have made TextWrangler a joy to use. The ability to just Cmd-S, switch to my SSH session in Terminal and run the freshly uploaded script immediately is brilliant. The syntax highlighting makes code considerably easier to read and the text searching is as powerful as your knowledge of regular expressions. The Text menu is particularly feature-packed with the likes of “Prefix/Suffix Lines…” and “Process Lines Containing…”, allowing extraction of regexp-matched lines to the clipboard or a new file. The “#!” menu is great as well, containing useful “Check Syntax”, “Run in Terminal” and “Run in Debugger” commands for local development.

While I’ll probably give TextMate a try again in the coming weeks (mostly for its excellent “snippet” support), for the moment I’m extremely happy Wrangling my Text.

BASHing biology

Just a quick post from work… I’ve recently been using UNIX stalwarts sed, tr and grep quite regularly to manipulate DNA sequence files, so I thought I’d post a few handy little commands for your perusal.

To strip out all the annotations in a FASTA file, leaving just the bare, unseparated sequences:
grep -v '^>' sequence.fasta | tr -d "[:space:]"
To then output the total length of the sequences, simply append | wc -c.

To calculate the total number of sequences contained in a FASTA file:
grep '>' sequence.fasta | wc -l

To read out a DNA sequence, capitalise it and group the bases into threes (i.e. codons):
cat sequence.seq | sed s/.../\&\ /g | tr "[:lower:]" "[:upper:]"

To obtain the complement of a sequence, use tr as follows:
cat sequence.seq | tr TACGtacg ATGCATGC
For the reverse complement, append | rev.

I’ve also found the pbcopy and pbpaste utilities to be particularly useful. To grab the reverse complement of a sequence copied from, say, a web page, just type the following:
pbpaste | tr TACGtacg ATGCATGC | rev | pbcopy
This takes the sequence currently on the clipboard and replaces it with its reverse complement. There’s a caveat here, which is that rev only reverses each line of the input, not the entire input. As such, if you’ve copied a sequence containing line breaks, you’ll need to add a tr -d “[:space:]” to remove the white space before invoking rev.