Perhaps the best thing about doing science—at least, the way I’ve managed to fiddle things so far—is that consecutive days are rarely alike. I could be doing siRNA knockdowns one day, a protein prep the next and hundreds of RT-PCRs the following. Some days of course they all happen on the same day.
For the past two days however I have been doing more or less the same thing, but this brings me on to the next best thing about science (the ranking here is purely rhetorical. But feel free to abuse my hospitality by telling me that the ‘second’ best thing is actually your best. Go on. See if I care): which is the potential to learn new stuff.
As I’ve mentioned elsewhere (I just like to say ‘Fisher-Yates Shuffle’, actually) this year I’ve been able to give the old bush perl a thorough seeing to. After a few months globe-trotting back in the lab I’m back trying to make sense of a mixture of binding data, crystal structure and bloody exon bloody microarray bloody data. I like geeking around with code, forcing collections of highly-organized beach sand to do my bidding. It’s a lot easier than raising children, at least.
I’ve been attempting to align a rather fey and seemingly capricious binding motif with splicing patterns in a set of gene transcripts that all have something rather peculiar in common (apart from being in my bloody exon bloody microarray bloody dataset). My perl scripts work quite well, and I can search for the motif(s) and even get the hits to correspond with the genomic coordinate system so that I can get at the exon/intron structure, but I’ve been having a damnable time of it trying to visualize the results in any meaningful way.
The sort of thing I’ve been getting looks like
.......................+..+..+...............+..+...................+...+......+...........+ .........................+...............................+...................................+................. ..........................................................................................+....................... ..........................................+...+..............................+............+...........+..... ....................................................................................+.....................................+............
but going on for thirty thousand characters or more. Sideways.
Drawing a splicing map under that was proving to be problematic; or rather, getting it to fit on screen would have been.
Then, yesterday about tea time, I suddenly had the best idea in the world, ever! (Again).
I thought it would be really neat if, in the three days left to me before I fly to London, I could work out how to draw graphics using perl. Then I could just draw pictures and let my young apprentices do the analysis. How to do that, though? And it hit me.
Postscript.
Postscript is a programming language that tells printers what to print. It’s written in plain text. Which means that perl can write it! So after a bit of googling for postscript tutorials, and a lot of noodling today, I’m rather pleased with constructs such as
sub print_an_exon {
my ($estart, $eend, $offset) = @_; #ex start, ex end
$offset *= $hundred;
my $ebottom = $offset + $one;
my $etop = $offset + $twenty;
$estart = int($estart/$ten);
$eend = int($eend/$ten);
my $exon_to_print = "$estart $ebottom $eend $ebottom $eend $etop $estart $etop esquare\n";
return $exon_to_print;
}
which is called by (for example)
$formatted_string .= print_an_intron($exonends[$ex_count], $exonstarts[$ex_count+1], $transcript_count);
and outputs postscript that looks a little like
0 210 0 201 0 210 ilinedown 0 201 48 201 48 220 0 220 esquare 48 210 844 201 1640 210 ilinedown 1640 201 1653 201 1653 220 1640 220 esquare 1653 210 1791 201 1929 210 ilinedown 1929 201 1944 201 1944 220 1929 220 esquare 1944 210 2123 201 2302 210 ilinedown 2302 201 2315 201 2315 220 2302 220 esquare 2315 210 2355 201 2394 210 ilinedown 2394 201 2414 201 2414 220 2394 220 esquare 2414 210 2440 201 2466 210 ilinedown 2466 201 2473 201 2473 220 2466 220 esquare 2473 210 2517 201 2562 210 ilinedown 2562 201 2568 201 2568 220 2562 220 esquare 2568 210 2716 201 2863 210 ilinedown 2863 201 2998 201 2998 220 2863 220 esquare 2998 210 2998 201 2998 210 ilinedown %End of transcript 2
So. I’ve learned something new today. Can I go home and have a drink now?
And here’s some data, hot off the press!
my $ebottom = $offset + $one;
Sorry to hear about your offset ebottom – hope it clears up soon…
Thank you Stephen. My GP() has prescribed some $ointment.
You’re entitled to your drink, it looks good to this uninitiate.
Now you just need to print with your Postscript onto some Shrinkydink material and make a flow cell with it. Or something like that.
Whee. Don’t get me started—I have enough on my plate already. You know I can’t resist a challenge…
Wow. (That was a “that’s creative!” kind of “wow”, not an “oooh, difficult” kind of “wow”. They’re subtly different.)
It’s pretty bad, actually Eva—I can’t let go. I woke up this morning with plans of how to improve the layout: print the search term(s) and the transcript IDs and the number of hits…
I’m only writing this comment so that I remember what to do when I get into work.
I know a couple of people who happily create plots by editing Postscript by hand. They’re, obviously, just nuts.
“I woke up this morning with plans of how to improve the layout”
At least you slept. I was awake worrying about prime numbers a few days ago. (But I do finally understand why 1 is not prime.)
Everyone should have a hobby…
An esquare sounds like something I used to have in my pencil case when I was a child.
What do you mean ‘used to’, Jenny? Aren’t you still a geek?
‘ilinedown’ is what you can’t do on an aeroplane. Not in economy, anyway.
I used to love my pencil case. I used to love going to the shops just before school started in the autumn — all those perfect sharp pencils and clean notebooks and shiny plastic rulers and crayons and glue.
sniff
stop it. You’re making me all emotional.
That’s cool…little victories like that make ones day worth while.
yah Meagan… and as a bonus the boss ‘likes’ the output.
Go me.
Woo!
I’m giving you a little cheer, sans pom poms (I left them at home today).
Poms poms are good.
Um.
Would that be the same charming boss as Diana, then?
I’m waiting for Eva to point to a link that explains why 1 is not prime to those of us who have forgotten whether they ever learned such a fundamental fact.
I dreamt about criticizing a movie I had watched in my dream with my dead mother. This movie adapted an unnamed Jack London novel, set in San Francisco and featuring Nicole Kidman and a handsome actor too young for her. He was not Hugh Jackman, by the way; all I saw of that was a trailer.
Eh, no Heather, it wasn’t: although you might be forgiven for thinking otherwise. I’m waiting for a certain NN reader (cough) to point Diana in this direction.
Eva can explain herself, without pointing to a link. She’s clever like that.
Well, it’s only if she wanted to save time. I wasn’t calling her didactic or intellectual abilities into question. ;-)
Heather, the number 1 is annoying. I thought it was prime until a few days ago. Like prime numbers, you can divide it up into 1xitself or itselfx1. But 1 doesn’t follow the same rules, because it can also be itselfxitself and that is not allowed for primes. Also, a product of two prime numbers is never prime, so if 1 was a part of the prime numbers group, then all the prime numbers could be written as itselfx[another prime number] and that’s not allowed either. So 1 can’t play.
Thank you for that primer, Eva.
A ‘101’ for prime numbers.
*groan *
What?
Thanks, Eva! Short and sweet.
Just like me :)