Archive for January 2011

Split fasta file into files with one contig per file

csplit does this quite neatly:

csplit -z myfile.fas '/>/' '{*}'

Default output filename is xxNN (where NN is a integer). you can use something other than xx by specifying a prefix with –prefix=PREFIX.

Note, this command assumes that the contig title don’t contain a > except for at the start of the line. You can probably do something like ‘\n>’ or ‘^>’ to insure it must occur at the start of the line.

ö (O with umlaut) on Mac OS X

Amuse and amaze your friends with the ability to type accented characters on a standard UK mac keyboard!

Simply press alt+U followed by the letter of your choice, for example O ööööööööööö see how much that rocks? Of course you do.

Dremel multi chuck disassembly

The chuck on my Dermel broke (while I was using it to fix a Linux laptop!!). I was curious to know what went wrong inside so I hackered it open. Picutres here:

dremel multi chuck disassembly

That “round thing” that pushes this grippers somehow got dislodged I guess the grippers were pushed out far enough to allow a gap which it fell out into… isn’t that interesting!!! !

Using fetchmail with Exchange at the Wellcome Trust Sanger Institute

This a post migrated from my old blog at Linuxjunk:

If you ever go work at Sanger and you’re a UNIX/mutt/pine user get them to put you on the UNIX mail server not the Exchange server, once they’ve set you up on one they’ll never change it… If you’re on exchange it’ll be a world of pain and mutt will take 30mins to open your mailbox over IMAP (fact).

However, if you do find yourself on an exchange server you can use fetchmail to grab your mail and filter it in to a mailbox using procmail. Here’s the fetchmail config I use at Sanger, put this in .fetchmailrc:

set postmaster YOURUSERNAME

poll exchsrv2 with proto imap user "YOURUSERNAME" there with password "YOURPASSWORD" is "YOURUSERNAME" here keep options stripcr
mda "procmail -f %F"

This is my .procmailrc it also forwards to an external address as well as delivering to a local mailbox:

set postmaster YOURUSERNAME
SHELL=/bin/sh
DEFAULT=/var/mail/YOURUSERNAME
LOGFILE=/Users/YOURUSERNAME/procmail.log

MAILDIR=$HOME/mail
DEFAULT=$MAILDIR/inbox

PMDIR=$HOME/Procmail

INCLUDERC=$PMDIR/rc.subscriptions

:0c                     # That's colon, zero, lowercase cee
! [email protected]     # That's exclamation mark, address to forward to

You’ll need to configure postfix or whatever (I’m on a Mac) to relay mail via the local SMTP server as well. For postfix/max stick this in main.cf:

relayhost = mail.internal.sanger.ac.uk