Archive

Archive for the ‘Cool Tools’ Category

PubmedPDF updated

May 25th, 2010

I have just committed a major update to biogeek’s script to fetch pdf-reprints of papers indexed in Pubmed. It is available on github here .

The first version required the Camping rubygem, but I have decoupled that dependency, cleaned up the code a bit and added a few tests.

Morten Cool Tools, ruby

Barcodes with checksums

October 30th, 2009

A small neat GUI for generating barcodes which incorporates some error checking. A very useful tool for multiplexing strategies.

Click to continue reading “Barcodes with checksums”

Troels Cool Tools , ,

Practical RNA structure visualization with VARNA

September 6th, 2009

VARNA (Visualization Applet for RNA) (http://varna.lri.fr/) is a new tool for RNA secondary structure visualization and it has a lot going for it: open source, pretty structure rendering, export to svg/jpg/eps, interactive inspection of structure with change of layout algorithm (linear/circular/radial). And most importantly: it is so simple to use that it is actually practical! If you are a teacher/student in a class covering RNA structure you should really have a closer look at VARNA. As a researcher, it is very easy to store dynamic VARNA-enabled RNA secondary structures on your computer – and in some situations this is really what you want.

Click to continue reading “Practical RNA structure visualization with VARNA”

anders Cool Tools, Geek stuff ,

Automation with Fsniper

May 21st, 2009

Fsniper is a great, easy-to-use tool to automatically watch over your folders/files and perform a given action every time there is new file in the folder or a change is made to any of the files. For example, I develop some websites locally, but I also test them on a remote test server. To make sure my local machine and remote server are always in sync I simply have fsniper watch over my web directory and have it run rsync every time a change in this directory occurs. This is just one simple example, fsniper is actually so flexible that only your imagination sets limit to what you can do. Read more to see how to get started using fsniper…

Click to continue reading “Automation with Fsniper”

elfar Cool Tools, Geek stuff ,

Wordpress plugin for listing Pubmed publications

February 20th, 2009

For this homepage we wanted to list all our publications as easily and automagically as possible. First, I simply made a Pubmed search, registered the results as an RSS feed and used a wordpress RSS plugin to display our publications. This was nice and simple but there is a catch, whenever we publish something new the RSS feed would be updated to only contain the most recent publication and all our previous publications would disappear and we would have to register the RSS feed again every time a new publication was out there to list all our publications.

Of course we could easily adapt the nice ruby pubmed code that Anders just wrote about to list our publications. Still, I wanted a nice, faster, integrated solution, so I decided to write a simple wordpress plugin in PHP to do the job. It is really quite simple, I just use the “file” function in PHP to read a URL, into a string variable, where I give the search term we want to query Pubmed for. Then I split the string, using a regular expression, to give me an array with one publication in each position (except the first and partly the last). The Wordpress plugins has some nice features to customize the output using css and an admin interface to the plugin, but if you do not use wordpress you could put the following function into your PHP file.

function PubmedList($searchterm) {
  	//Add the search term to the URL
	$url = 'http://www.ncbi.nlm.nih.gov/sites/entrez?Db=pubmed&Cmd=search&dispmax=500&Term='.$searchterm;
 
	//Read the search result into the $html variable
	$html = implode('', file($url));
	//Add the ncbi server prefix to the local links
	$html = str_replace('href="/pubmed/','target="_blank" href="http://www.ncbi.nlm.nih.gov/pubmed/',$html);
	$html = str_replace('href="/sites/','target="_blank" href="http://www.ncbi.nlm.nih.gov/sites/',$html);
	//Split the $html into the different papers, the first and last element will have to be corrected
	$papers = preg_split('/<div class="rprtNum".*?<\/div>/',$html);
 
	//Remove the end on the last element so it only holds that last paper
	$tmp = split('<div id="PaginationNode2"',end($papers));
	array_pop ($papers);
	array_push($papers,$tmp[0]);
	$first = 0;
	$antal = sizeof($papers) - 1;
 
	echo "<br /><h3>There are " . $antal . " published papers</h3><br />&nbsp;<br />\n";
 
	//Add some divs that were missing since you regard the first element
	echo '<div class="pubmed"><div class="rprt">'."\n";
        foreach ($papers as &$p){
	    //Don't print the first element since that is everything before the first paper
	    if($first){
	       echo $p ."\n";
	    }else{
	       $first = 1;
	    }
       }
}
</div></div></div>

Then you could call this function using something like this:

PubmedList('Torarinsson+E[Author])+AND+(2003%2F01%2F01[PDAT]+%3A+3000[PDAT]');

Which would list all my papers since 01/01/2003.

NB: To get a good search query, visit Pubmed and search for what you want (for example using “Advanced search”), once you have the results you want to click “Details” and then on “URL”, which will take you to the page, but this time displaying the search term you want in the address bar after Term=

elfar Cool Tools, Web ,

PubMed keyword statistics

February 17th, 2009

Today we have made a handy little web-service available: given a query (PubMed keywords), visualize the number of articles in PubMed over time. This is also a good time to demonstrate how such a task can be achieved with a minimal effort using Ruby. By using the Ruby packages (gems) Gruff and Bio::PubMed we can do it in less than 20 lines of should-be-readable-code. Here we search for PubMed articles published in the years 2000-2009 and containing the terms ‘miRNA OR microRNA’:

#!/usr/bin/ruby
 
require 'rubygems'
require 'gruff'
require 'bio'
require 'date'
 
picture_size = "450x450"
picture_file = "papers.png"
query = "miRNA OR microRNA"
years = (2000 .. Date.today.year).to_a
 
papers = years.map{|y| Bio::PubMed.esearch(query,
                                   {:mindate => y,
                                     :maxdate => y,
                                     'rettype' => 'count'})}
 
g = Gruff::Line.new(picture_size)
g.theme_keynote
g.title = "Query: #{query}"
g.data("papers",papers.map{|x| x.to_i})
yearlabels = Hash.new
years.each_with_index{|y,idx| yearlabels[idx]=y.to_s}
g.labels = yearlabels
g.hide_legend = true
g.y_axis_label = "# papers"
g.write(picture_file)

We could also come up with something more sophisticated, for example extracting the journal name for each PubMed entry in the search:

# ...
Bio::PubMed.esearch("mirna or microRNA",
                                 {:mindate => y, :maxdate => y}).each do |pmid|
  article = Bio::MEDLINE.new(Bio::PubMed.efetch(pmid).first)
  journal = articel.journal
# ...

Following the first example, we could make a graph for each of the 5 journals with most articles in the time interval:

anders Cool Tools, Geek stuff, biogeek webservice

Genome visualization

February 16th, 2009

genometoolsThe Center for Bioinformatics at University of Hamburg recently published, and made available, a C library for plotting genomic data. Furthermore, they also provide Python, Ruby and Lua bindings to their library. Check it out here.

Also, if you use Ruby you might want to check out Bio::Graphics for visualizing genomic data.

elfar Cool Tools ,

WAR

February 10th, 2009

The growing interest in non-coding RNAs in recent years has given rise to many different programs focused on aligning and predicting the secondary structure of ncRNAs. It can be difficult for a user to determine which one to use, to judge the different predictions, and sometimes even to run the programs. Therefore I and Stinus Lindgreen, implemented a webserver which provides users with an easy way to run the top methods available simultaneously, and get a combined, simple view of the predictions, which can be downloaded in various formats for further analysis. Additional measures are calculated for each program to make it easier to judge the individual predictions, and a consensus prediction taking all the programs into account is also calculated. The webserver will run globally and locally, where the local version simply uses CMfinder [Yao et al., 2006] to cut out the local regions that will then be fed to the other programs globally as usual.

war_flow3

The consensus is in itself a heatmap indicating how well the multiple alignment programs included agree on the prediction. This can be very valuable when studying unknown multiple sequences to find if they have well defined, reliable, sequence and structure conservation. Check out this example output.

elfar Cool Tools, Web , ,

Simple ROC curves

January 21st, 2009
Example plot

If you happen to perform some machine learning, you might be interested in this simple and elegant tool by Tobias Sing et al. to visualize your SVMs (for example; e1071 is a great R package for SVMs) performance. You can install it by simply typing (as root in R) install.packages(”ROCR”) or download it and follow the instructions here http://rocr.bioinf.mpi-sb.mpg.de/. This package is very easy to use and there are nice PDF and PPT files on their website with examples and so on. You can plot simple ROC curves with a prediction and label vector, but you can also plot you 10-fold cross-validation and more complex plots. So, simple and great looking, informative plots, check it out.

elfar Cool Tools , , ,

R GUI for Linux/MAC

January 21st, 2009

Although, after spending several using Linux, you learn to prefer command line stuff over GUIs, they can still be nice to have, especially for programs you use rarely or if you’re a newbie. So for those you, for example, who want to migrate from Windows to Linux, and are not comfortable using command line, there is a nice R GUI, written in JAVA, that works well for linux, at least it was a breeze installing on my Ubuntu 8.10. It’s called JGR (Java GUI for R) and you can read about how to install it (and R and Java as well, although be aware that there are regularly new version of those so google recent guides on how to install those on your system) here http://jgr.markushelbig.org/JGR_on_Linux.html

elfar Cool Tools , ,