What You’re Doing Is Rather Desperate

Notes from the life of a bioinformatics researcher

R has a JSON package

with 2 comments

Named rjson, appropriately. It’s quite basic just now, but contains methods for interconversion between R objects and JSON. Something like this:

> library(rjson)
> data <- list(a=1,b=2,c=3)
> json <- toJSON(data)
> json
[1] "{\"a\":1,\"b\":2,\"c\":3}"
> cat(json, file="data.json")

Use cases? I wonder if RApache could be used to build an API that serves R data in JSON format?

Written by nsaunders

November 6, 2009 at 9:44 am

Posted in R, computing, statistics

Tagged with , , ,

Brief notes on Ubuntu 9.04 (jaunty) -> 9.10 (karmic)

with 2 comments

Recording my Ubuntu upgrade experience has become something of a tradition, so here goes.

  • Machine 1 (laptop, LG T1 Express Duo). Largely trouble-free. On-board soundcard not seen on reboot. Fixed (temporarily, lost on reboot) using “sudo alsa force-reload”.
  • Machine 2 (various generic hardware, cobbled together over many years). Upgrade smooth until final restart, when machine froze. Rebooted to a blank screen. Fixed by swapping out ATI video card for old NVidia FX5200. Discovered that rsyslog is running riot due to a hot CPU and is trying to fill up /var/log.
  • Machine 3 (Dell Optiplex GX550). Install froze at “stopping winbind server”. Rebooted with rescue CD, mounted and chroot-ed into Linux partition, tried “dpkg –force-all –configure -a”, but to no avail. Reinstalled in same partition, all is working well.

All in all, not very impressed. Canonical, could do better.

Written by nsaunders

November 2, 2009 at 6:18 pm

Posted in computing, linux

Tagged with , , , , ,

Flickr slideshow in WordPress.com using Vodpod

leave a comment »

Not work-related but fun: How to embed a flickr slideshow in WordPress.com using Vodpod. Vodpod is new to me and quite amazing; I imagine this method will allow you to post any Flash with embed code as a video.

As an example, a slideshow of Lane Cove images from my Flickr account.

posted with vodpod

Written by nsaunders

September 15, 2009 at 11:33 am

Fix Kile for Ubuntu 9.04

with one comment

Ubuntu/jaunty rocks, on the whole. However, to prove that newer does not always equal better, they threw in a couple of shockers. The first is the upgrade from the excellent Amarok 1.4 to the completely-broken 2.0. Head here to repair the damage.

Kile is by far my favourite LaTeX editor and suffered, though not as badly, in the upgrade from 2.0 to 2.1. Reports of various problems litter the web; in my case I see broken toolbar buttons that do nothing when clicked. This fix is much simpler. Just “sudo apt-get remove kile”, scroll to the bottom of the intrepid package page, choose your architecture, download the deb file and “sudo dpkg -i kile_2.0.1-1ubuntu1_i386.deb”. I had no dependency problems and it works just fine.

Finally – open up Synaptic, find kile and from the Package menu item select “lock package”, to prevent future upgrades.

Update: a few days after writing this, an apt-get dist-upgrade upgraded my Kile to 2.1 (despite the “lock package”). However, the broken buttons issue is now fixed for me. Go figure…

Written by nsaunders

September 1, 2009 at 6:36 pm

Posted in computing, linux

Tagged with , , ,

FriendFeed Life Scientists: 14-day summary

leave a comment »

Since I haven’t posted for 14 days, what better (and lazier) way to post something than to surf over to a 14-day summary from the Life Scientists Group and link to the top ten items!

  1. Review process files in the EMBO Journal – but why only for “the majority of papers”?
  2. How XML threatens Big Data. Or not. How JSON might be an alternative – or not.
  3. Solve any computer problem – with this classic XKCD flowchart.
  4. Science reviews the revolution in ’strategic scientific reading’ – are they way behind the curve, or providing a useful summary for the uninitiated?
  5. Best practice in microbial genome annotation – spirited discussion on the nature of best bioinformatics practice.
  6. FriendFeed Life Scientists user survey – no further word on whether this will happen.
  7. 50 Years of Structure – link to a JMB review on the early days of structural biology.
  8. Reflections on Science Online London 2009
  9. Workflow tools that speak SOAP?
  10. Advice on cleaning up a protein sample – a nice example of useful discussion from the group.

Who knows, this could become a semi-regular feature.

Written by nsaunders

August 28, 2009 at 5:03 pm

Improvements to the reference management workflow

with 4 comments

I use Google Reader to subscribe to the RSS feeds from journals that interest me (see my public page). I’m also a big fan of CiteULike as a reference management system.

For a long time I’ve thought: it would be great if GReader handled journal articles more efficiently. Rather than going from link in GReader -> article at journal -> CiteULike bookmark -> back to GReader, how about “post directly from GReader?”

With Google Reader’s new send-to feature, you can do just that. See this forum post for the details. Also, take a look at this how-to for a quick way to post to CiteULike by entering a PubMed PMID, DOI or ISBN identifier in the address bar.

Written by nsaunders

August 14, 2009 at 10:30 am

RSRuby in the IRB console

leave a comment »

rsruby-irb
R is terrific, of course, for all your statistical needs. But those data structures! “Everything is a list.” Leading to such wondrous ways to access variables as “p <- Meta(gds)$platform", or "last <- mylist[[1]][length(mylist[[1]])]".

Sometimes, you want something more familiar. An array, a hash, a hash of arrays. Or, you may need to access R data in the language of your choice – e.g. as part of a Rails project.

In Ruby, IRB is your friend. On the right, an IRB session in which we invoke RSRuby, load the GEOquery library from Bioconductor, fetch a dataset from the GEO database and examine the metadata that describes the experiment. Result: a ruby hash of arrays, where the keys are covariate types (“sample, disease.state, description”) and the values covariate names for each column (sample) in the dataset. Now easy to access using:

columns.each_pair do |key,val|
  # do something with keys
  val.each do |element|
    # do something with values
  end
end

Written by nsaunders

August 6, 2009 at 4:36 pm

How-to: combinations of covariates using Ruby

leave a comment »

I work with people who generate a lot of microarray data. One question that they often ask is: can we find those genes with a two-fold or more change in median expression under two or more different conditions?

For example, let’s say that we have 3 conditions: “normal”, “adenoma” and “cancer”. That gives us 3 pairwise comparisons: normal-adenoma, normal-cancer and adenoma-cancer. Here’s a Ruby solution to the problem.
Read the rest…

Written by nsaunders

July 30, 2009 at 5:08 pm

RSRuby and Rails revisited

leave a comment »

A couple of months ago, I wrote a brief guide to displaying R plots in a Rails application using RSRuby.

It worked at the time – really it did – but since then, I’ve encountered problems. One is that despite sending the plot output to a PNG file, R X11 windows started to pop up on loading the web page containing the plot. Another is the appearance of long error messages related to “stack smashing” on terminating Mongrel server.

Fortunately, I read an excellent guide by Ana Nelson, R on Rails with RSRuby, which convinced me that I was doing things all wrong. So here is an amended version of my R + RSRuby + Rails “Hello World” application.
Read the rest…

Written by nsaunders

July 24, 2009 at 11:15 am

Posted in bioinformatics, computing, rails, ruby

Tagged with ,

Where to share?

with 4 comments

A brief and unscientific survey of social bookmarking buttons provided by journal websites. Take with pinch of salt and/or tongue in cheek.

Share at PLoS

PLoS get it. As you'd expect.

BMC get it too.

BMC get it too.

Even ACS kind of get it.

Even ACS kind of get it.

OUP get the serious options

OUP get it to a degree.

Someone doesn't get it.

Someone doesn't get it.

I know, all bookmarking services provide their own tools, such as bookmarklets. However, I suspect that a button is more convenient for many people: it’s a courtesy and an advertisement for social bookmarking and online reference management tools.

So NPG: is it “we promote sharing” or “we promote sharing so long as you use our service?”

Written by nsaunders

July 3, 2009 at 12:40 pm