---
author: einar
categories:
- KDE
- Linux
- Science
comments: true
date: "2009-03-31T17:33:09Z"
header:
  image_fullwidth: banner_other.jpg
slug: gene-search-applet-suggestions-and-code-review-needed
tags:
- bioinformatics
- KDE
- Linux
- Science
title: 'Gene search applet: suggestions and code review needed'
disable_share: true
wordpress_id: 594
---

In the past months I've always wanted to write a small Plasma applet to aid me in some boring tasks as a bioinformatician. One example (for the non-scientific crowd out there) is when I find a specific gene out of my analysis work which I want to take a look at. I am often lazy, so instead of firing up the browser to look at the online resources, I wanted to write something which could access said resources programmatically.


<!--more-->


I found a way thanks to the [Biopython project,](http://biopython.org) which offers a Python module to access the resources of the [National Center for Biotechnology Information (NCBI)](http://www.ncbi.nlm.nih.gov) by providing an interface to their [EUtils](http://www.ncbi.nlm.nih.gov/entrez/query/static/eutils_help.html). Since the back-end was already taken care of, almost, at least, I sought to write a small Plasma applet. Which is what I'm presenting today. It's written in Python, and uses the Python ScriptEngine to work. Currently, it searches the "Gene" database at NCBI by inputting the "Entrez Gene IDs", that are numerical IDs that uniquely identify a gene record, and returns name, official symbol,  organism, and a description if it's present. It does not support anything else (see below).

The code lives in [a git repository at github](http://github.com/cswegger/plasma-genesearch/tree/master). **WARNING: **The code may be a complete mess (I'm not too well versed in GUI stuff, I mostly do text file manipulation) If you are so daring, you can obtain and install it in a very simple manner:




[bash]git clone git://github.com/cswegger/plasma-genesearch.git
cd plasma-genesearch
zip -r ../plasma-genesearch.plasmoid *
plasmapkg -i ../plasma-genesearch.plasmoid[/bash]




After that you will see an "Entrez Gene Searcher" in your add applets dialog. Once added, it'll look like this:

![Gene searcher image]({{ site.url }}/images/2009/03/plasma-genesearch1.png)

Pretty horrible, isn't it? Well, once you get past that, you can input an ID (only IDs will work for now) in the text field (which doesn't clear the text: see further on) and push "Go!". The following is an example with ID 10000, which corresponds to the human gene _AKT3_:

![Gene search results image]({{ site.url }}/images/2009/03/plasma-genesearch2.png)

"Search again" will bring you back to the search form.

Now, what has this to do with Planet KDE? Well, I'm asking for some code review from the community, if it's possible, and suggestions to improve the horrid default look. I am especially interested in layouting, since I did not quite understand how it works, I mean, it should not work and it _does...._

Other things that need to be improved are:

  * The Plasma.TextEdit is not cleared upon clicking. Is there a signal I can catch for that, so I can connect it to clear()?
  * Proper searching. Bio.Entrez already does this: what I need is  a way to display the records properly. 
  * A way to link the names to URLs, and have them open in Konqueror. 

That should be it. I hope to work on it some more next weekend....
