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[][length(mylist[])]".
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
Posted in bioinformatics, computing, R, ruby, statistics