samtools/bedtools introduction

I wanted to get intimately familiar with BAM file specification and how aligners work in general. Typically though, you’re dealing with very large files and seeing the effect of SAM/BAM manipulation tools at a record level becomes quite challenging.

Through googling I stumbled across this tutorial – http://biobits.org/samtools_primer.html

I can confidently say that every bioinformatics introductory course should make its students go through this. It has helped me understand FASTA format; how it is aligned into the result SAM/BAM file and subsequent manipulation using samtools and bedtools.

Full credits to the original author. Great work!

Shady past and 3.5 inch floppy disk drives

(If you want to just straight to managing 3.5 floppy disk drives with Mac OS X, skip to the “Setting up your terminal for managing floppy disks from command line” section below, otherwise enjoy reading 🙂

I always thought these days were past me. That I would never need face this creature again. It was a dark fragment of my past filled with pain and corrupted University assignments discovered the day before they were due …

However as the saying goes “Your shady past always catches up with you …”. And today was the day it did!

It was triggered somewhat by the unceremoniously named Cleanup Day. For those outside of Australia, it’s the day of the year when you:

  1. Go hunting for all the crap you’ve accumulated over the last few generations
  2. Evaluate whether to throw it or not
  3. 99% of the time, decide no (The cleanup dudes need jobs right!)
  4. Leave it for someone more sensible in the family to do it instead

In this instance however, both the person ‘evaluating’ and ‘sensible one’ happen to be me. (contrary to every other instance perhaps). During the bulldozing operation, I stumbled upon crates containing the now defunct 3.5 inch floppy drives. Least to say, it triggered a flood of emotions; anger, frustration, hunger (was close to lunch time), nostalgia.

Hauling the crates across to my room, I sat one one of them deciding what to do. I needed to check them for personal stuff naturally before throwing them out.

A couple of years ago (around 2003), I had bought my first laptop (Thinkpad T41 – when they used to make them like bricks!). For some reason I also ended up getting a USB 3.5 inch floppy disk drive (Sony MPF82E-U1). That was around the time when USB MP3 players (iPod was an unknown back then) were becoming mainstream.

Anyone remember these anymore?

Anyway, fast forward to Aug 2012, I had a heap of floppy disks sitting around waiting to be thrown out. The only PC I had at my disposal was my Macbook Pro 15 (Late 2008) + 8 Gb RAM + Mountain Lion ….. and my 3.5 inch floppy disk drive

I was essentially at this point (after plugging in the USB floppy drive)

  1. Inserting the disk
  2. Twiddling fingers until it mounted
  3. Using Finder to drag and drop
  4. Formatting the disk using Disk Utility
  5. Ejecting the disk
Setting up your terminal for managing floppy disks from command line
As you can realise this gets boring very quickly. So I fired up iTerm2.
Making sure I was in the home folder
cd $HOME
Edit your .bash_profile
vim .bash_profile
Now paste the lines below (Feel free to modify them if you like)
alias reload_bashrc=". $HOME/.bash_profile"
alias lsfloppy="sleep 1s; reload_bashrc; ls \"`mount | perl -n -e 'if ($subject = m/.*(\/dev\/disk\d+)\son\s(.*)\s.*msdos.*/i) { print "$2" }'`\""
alias cpfloppy="reload_bashrc; cp -pvR "\"`mount | perl -n -e 'if ($subject = m/.*(\/dev\/disk\d+)\son\s(.*)\s.*msdos.*/i) { print "$2" }'`\""/* $@"
alias floppy_format="sudo diskutil eraseVolume "MS-DOS" UNTITLED "\"`mount | perl -n -e 'if ($subject = m/.*(\/dev\/disk\d+)\son\s(.*)\s.*msdos.*/i) { print "$1" }'`\"""
alias floppy_eject="sudo diskutil eject "\"`mount | perl -n -e 'if ($subject = m/.*(\/dev\/disk\d+)\son\s(.*)\s.*msdos.*/i) { print "$1" }'`\"""
alias floppy_format_eject="floppy_format; floppy_eject"

You can either close and re-open iTerm2 OR run . ~/.bash_profile (to load the alias directives into your current shell session)

The commands are generally pretty self explanatory, but what they let you do is

lsfloppy – List contents of the floppy disk

cpfloppy <destination> – Copy contents of the floppy disk to <destination>

floppy_format – Formats the floppy disk

floppy_eject – Ejects the floppy disk

floppy_format_eject – Formats and ejects the floppy disk

Basically, these commands saved me hours. I’m sure there’s other ways of making those alias commands even more compact (I’m no shell script guru) but I found this worked best for me. Feel free to post any other tips you might have. (Although I can’t imagine too many floppy disk users out there anymore!)

Apple vs Samsung saga – nicely summarised

This video comes as close as possible to summarising the Apple vs Samsung saga in a nutshell

Having said that, there was another bit of evidence that is supposedly damaging to Samsung. This is the now infamous memo where Samsung’s senior UX designer is telling off his subordinates on having a crappy UI experience – contrasting the difference between iPhone / Samsung as heaven and earth.

If you read the memo however (as in a standard non-lawyer citizen), it merely comes off as constructive criticism from a manager who was trying to compete in an increasingly lucrative market.

While the email itself is not damaging, I do however think that the pressures that the email might’ve imposed on individuals responsible for the phone hardware / UX design; might’ve led them to adapt aspects from iPhone. At this point, this is pure speculation on my part and I’d like to see a bit more evidence before forming an objective opinion (bias aside)

Terminator Salvation

200906080218.jpg

Went and saw Terminator twice !!!! Yesterday and Today (Warning: Spoilers below)

I loved the first two Terminators… (well the 2nd one…mostly). In my mind there were quite a few factors that made it stand out

  1. The Terminator was a proper character. The director (James Cameron … also known for directing Aliens/Titanic) made the terminator more than just a tin can with legs and hands attached.
  2. You could relate to the main characters. Sarah Conner, Young John Connor, Terminator (Arnie) .. and to some level T-1000(the melting man)! You could tell what the main characters felt like, the struggles they were going through, the tension at various points when T-1000 would get an arm’s length close to the Connors and Arnie (T-800) would be there just in time – to fight to keep those two alive.
  3. You could feel the internal struggle that both the Connors were going through – particularly that they were both getting more dependant/attached to T-800, while at the same time realising that it originated from the same machines that was trying to kill them.
  4. You could feel the Terminator becoming more human over the course of the 2 hour movie… while at the same time not forgetting that it’s a machine ! (Which I think is quite an achievement …)

However…. with Terminator Salvation.. this is what I saw

  1. John Conner (i.e. Christian Bale) – This was terribly portrayed. It could be the writers and/or the acting, but in brief. I thought Bale performed the same voiceovers that he had used for Batman. (short brief raspy voice) … In fact all he would’ve had to do is put on the batsuit & he’d fit right in !
  2. Marcus Wright (i.e. Sam Worthington) – This one was much better done. He appeared even more human than Connor and had a lot more sentences to speak!
  3. The trouble with the two points above… is that wasn’t the movie supposed to be highlighting Connor’s fight!!!!! It did everything but that. The whole role of Connor appeared to be rather insignificant and it certainly wasn’t convincing enough.
  4. And what’s the deal with Connor’s wife being shown as pregnant…but not a single word was uttered about this. (I mean.. didn’t they feel like discussing at any point how difficult it would be to raise a kid in a post-apocalyptic world ! … unless they were expecting to enrol him in the nearest available kindey ..!)
  5. Admittedly, the terminators themselves were well done. It would great to be able to see close ups of T-600 and for them to come up with a story as to how T-800 could’ve come about. However, the introduction of a CG animated Arnie just to please fans was probably the silliest thing they could’ve done. The scene where the door blows off and he’s standing behind it (with liquid nitrogen ‘smoke’ fuming around him) was probably the comical highlight of the whole movie. I was almost expecting him to go ‘Hastalavista Baby!’ at some point.
  6. At the end of the movie, the only character I thought I understood and began to care about was Marcus Wright. He was the only character whose history was somewhat portrayed, what he was thinking about, his internal struggle and his quest to retain his human-ness. Every other character seemed to be an add-on with their role seemingly ‘fitted’ around whatever Marcus needed to achieve.

Having said all this.. my recommendation is as follows

Rating: 5/10

(Would recommend DVD rental to only die-hard Terminator fans, otherwise wait till it comes out on free to air TV. Hint: I’ve not mentioned going to the movies to see this)