Posts in Category: software

Video tracking and analysis of sleep in Drosophila melanogaster

Nat Protoc. 2012 Apr 26;7(5):995-1007.
Video tracking and analysis of sleep in Drosophila melanogaster.
Giorgio F. Gilestro

In the past decade, Drosophila has emerged as an ideal model organism for studying the genetic components of sleep as well as its regulation and functions. In fruit flies, sleep can be conveniently estimated by measuring the locomotor activity of the flies using techniques and instruments adapted from the field of circadian behavior. However, proper analysis of sleep requires degrees of spatial and temporal resolution higher than is needed by circadian scientists, as well as different algorithms and software for data analysis. Here I describe how to perform sleep experiments in flies using techniques and software (pySolo and pySolo-Video) previously developed in my laboratory. I focus on computer-assisted video tracking to monitor fly activity. I explain how to plan a sleep analysis experiment that covers the basic aspects of sleep, how to prepare the necessary equipment and how to analyze the data. By using this protocol, a typical sleep analysis experiment can be completed in 5-7 d.

Go to pubmedDownload paper as PDF

pyREM: a crowd trained machine learning approach to automatic analysis of EEG data

pyREM: a crowd trained machine learning approach to automatic analysis of EEG data
Quentin Geissmann, and Giorgio F Gilestro

EEG data are at the basis of a plethora of neuroscientific questions: from sleep to consciousness and attention, many aspects of neuroscience heavily rely on electrophysiological correlates of brain activity. Yet, EEG analysis heavily relies on subjective scoring and interpretation to the point that many neuroscientists consider it an art, more than a systematic tool.
Can we teach this art to a computer?
Attempts at creating an objective way of scoring EEG data have been less than perfect so far, mainly because humans are reluctant about trusting the judgement of a machine, programmed according to hard-coded values and thresholds.

pyREM aims at solving this issue, using a machine learning approach to automatically analyse EEG data. pyREM learns how to classify EEG directly from humans, mimicking all the human’s principles and criteria without any apriori knowledge of what an EEG means. The overall goal of the project is to teach pyREM how 1, 10, 100 or 1000 laboratories score EEG so that the software will be able to automatically grasp and isolate the key fundamental criteria and become, in this way, the universal scorer.

If you are a laboratory interested in being part of this, please get in touch.

If you want to know more, you can

Ethoscopes: An Open Platform For High-Throughput Ethomics

PLOS Biology, 19 Oct 2017; 15(10): e2003026
Ethoscopes: An Open Platform For High-Throughput Ethomics
Quentin Geissmann, Luis Garcia Rodriguez, Esteban J. Beckwith, Alice S. French, Arian R Jamasb, and Giorgio F Gilestro

We present ethoscopes, machines for high-throughput analysis of behaviour in Drosophila and other animals. Ethoscopes provide a software and hardware solution that is reproducible and easily scalable. They perform, in real-time, tracking and profiling of behaviour using a supervised machine learning algorithm; can deliver behaviourally-triggered stimuli to flies in a feedback-loop mode; are highly customisable and open source. Ethoscopes can be built easily using 3D printing technology and rely on Raspberry Pi microcomputers and Arduino boards to provide affordable and flexible hardware. All software and construction specifications are available at

Download PDF

Supplementary material.

Supplementary material 1 – webGL model of the ethoscope.
Supplementary material 2 – instruction booklet for the LEGOscope.
Supplementary material 3 – instruction booklet for the PAPERscope.
Supplementary Video 1 – Introduction to the ethoscope platform.
Supplementary Video 2 – The optogenetics component of the optomotor in action.

Featured in:

Can your lab book do this?

When I was a student I used to be a disaster at keeping lab books. Possibly because they weren’t terribly useful to me since back then I had an encyclopedic memory for experimental details or possibly because I never was much of a paper guy. As I grew older my memory started to shrink (oh god, did it shrink!), I started transforming data into manuscripts and as a consequence I began to appreciate the convenience of going back 6 months in time and recover raw data. Being a computer freak, I decided to give up with the paper lab book (I was truly hopeless) and turned to digital archiving instead. As they say, to each their own!. Digital archiving really did it for me and changed enormously my productivity. One of the key factors, to be honest, was the very early adoption of sync tools like Dropbox that would let me work on my stuff from home or the office without any hassle.

As soon as I started having students, though, I realized that I needed a different system to share data and results with the lab. After a bit of experimentation that led nowhere, I can now finally say I found the perfect sharing tool within the lab: a blog content manager promoted to shared lab book (here). This is what it looks like:

A screenshot of our lab book in action

This required some tweaking but I can say now it works just perfectly. If you think about it, a blog is nothing less than a b(ook) log and so what better instrument to keep a lab book log? Each student gets their own account as soon as they join they lab and day after day they write down successes and frustrations, attaching raw data, figures, spreadsheets, tables and links. Here some of the rules and guidance they need to follow. Not only can I go there daily and read about their results on my way home or after dinner, but I can quickly recall things with a click of the mouse. Also, as bonus, all data are backup’d daily on the Amazon cloud and each single page can be printed as PDF or paper if needed. As you can see in the red squares in the above picture, I can browse data by student, by day, by project name or by experiment. That means that if I click on the name of the project I get all the experiments associated to it, no matter who did them. If I click on a experimental tag (for instance PCR) I get all the PCRs run by all the people in the lab.

Except for the protocols, all contents are set to be seen only by members of the lab. However, inspired by this paper, I decided that the project will be then flagged as public as soon as the results will be published.

Patches for Nautilus “move to trash” bug

Warning, this post contains a geek rant.

If you use the nautilus or nautilus-elementary filemanager (the default file manager in any gnome-based linux distro, including Ubuntu), you are probably aware of the annoying bug with file deletion.

Like any other file manager, nautilus allows you to delete your files using keyboard shortcuts: permanently (hit <Shift-Delete>) or temporarily by moving them to the trashbin (hit <Delete> on your keyboard). Removing files is always a critical action so any other file manager will make sure that you don’t do it accidentally: the file manager in MacOS, finder, will require you to hit the key combination <AppleKey+Delete>, difficult to perform by mistake. Microsoft Explorer, Konqueror, Thunar and many others will ask you to confirm that you really want to trash files with a dialog box.

Unfortunately nautilus lacks this ability: if you, your toddler or your cat accidentally hit the Delete key on the keyboard while a file or folder is selected, they go into the trashbin without warning. If you are not looking at the screen while this happens, the item is well gone. Obviously, this flaw was pointed out already long time ago. Users started asking for a fix already in 2004 (that is seven years ago!) and lots of people wanted to get that fixed: see for instance here, here, here, here, here, here

Surprisingly, reactions of the gnome developers to this problem were of two kinds: “I don’t think this is a real problem”[¹] or “I don’t think you are proposing the perfect solution”[²].  Back in 2009, I accidentaly lost some file and wrote a patch to fix this bug. The patch simply gave the user the option to activate a warning dialog if they wanted to. I figured “people who want the dialog will enable it and be happy, people who don’t will leave it alone and keep discussing about what is really truly the best solution for the next 7 years“. Believe it or not, the problem still exists,  so I thought of raising the issue once again (this time, I also proposed a patch to change Delete in Control-Delete).

Guess what: even after 7 years and hundred of people begging for a fix, we are sitting on the same attitude:

This is a real problem, but I don’t think the solution is a windows-like alert dialog. […] An animation with the file becoming red and/or flying to the trash would be a nice addition.

Or maybe a small cluebar with an embedded undo button would already be enough. I like how Google does it in its webapps.

What if deleted files were visible as some ghost-like-icon in the directory they used to be? And it could be possible to turn on/off the visibility of deleted files? And you can have your animation then as well; of an icon that dies.

I think your use case is a real concern, and something we should fix indeed, but as others said in this thread, I don’t think a confirmation dialog is how we want this to be implemented, especially when it carries a new preference with it.

Personality i like my delete and it would felt awkward if the delete didn’t delete anything.

We will rather keep the hole than having a solution we don’t like. Little does it matter if any other browser is actually using that solution or if lots of people want to see the thing fixed.

This attitude is amazingly complicated to understand for my simple brain. For me, getting things done means finding the meeting point between the optimal solution and the best outcome. If my car gets a flat tire on the way, I will accept any new tire a rescuer would give me and I won’t be sitting 7 years waiting for one that really matches the other three. And I like to think this is not Linux true philosophy either.

Anyway, here you can download the patches to fix this issue.

I am using the second one on nautilus-elementary (which also sports a very convenient Undo feature).

Edit 1 April 2011. To much of my pleasure, the patch has now been accepted and from next version on, Control<Delete> will be the shortcut to send stuff to trash. No more accidental  deletions! Open Source wins again.

Edit June 2011. If you arrive to this page because you freaked out finding the new nautilus behaviour, this is how to get back to the old key combo


1. You are all familiar with the “how many people it takes to change a light-bulb?” jokes.
The one about software developers goes like this:

Q: How many developers does it take to change a lightbulb?
A: The lightbulb works fine on the system in my office. NOT REPRO.

2. The one about C++ programmers goes like this:

Q: How many C++ programmers does it take to change a lightbulb?

A: You’re still thinking procedurally. A properly-designed lightbulb object would inherit a change method from a generic lightbulb class, so all you’d have to do is send it a bulb.change message.


Videocapture for linux

If you did some hacking with a webcam and python, you probably ended up using the Videocapture module by Markus Gritsch. Unfortunately, the module does not work on any operative system other than windows, which could be a problem if you wish to make your application platform independent. So, here you will find a linux version of Videocapture. It has been tested on ubuntu distributions. It will run as long as you have installed

  • python 2.5 (maybe others too)
  • PIL – the python imaging library
  • opencv

You can download it here. Some functions are actually not active (namely those that would call the configuration panels). It should work on mac too. Please, if you try it on a mac, let me know how it went.



If you are a Linux user you probably already know and appreciate that (amazingly) simple piece of software that is googlizer. If you don’t know what I am talking about: googlizer is a tiny gnome applet that sits in your taskbar; everytime you click on it, it will start a google search using the text in your clipboard as query. Just select the text using your mouse to copy it in the clipboard, then click on the G icon of googlizer and voila, your google search is already waiting for you in your favorite browser.

Being myself a ubuntu user I love the googlizer but sometimes I need to work on computers running windows OSs. I decided to invest 20 minutes of my time (while waiting the confocal to do its work) to make a windows clone of Googlizer.

You can dowload it from here (it’s free, as in free beer of course). To completely emulate X copy&paste functions you may want to consider using True X-Mouse Gizmo as well.
Is written in Python then compiled to exe using py2exe and the installer is build using Inno Setup. In case you are interested in the source, here you’ll find the python code for wingooglizer, the py2exe setup file and the iss inno script.

WinGooglizer works fine on windows xp, sp3. I guess it will work on any Windows OS. Enjoy and let me know how it works for you.

Journal Filtered Pubmed


General Science

Cell Nature Science
Neurobiology Journals
Neuron Nature Neuroscience J. of Neuroscience
Nature reviews in Neuroscience Trends in neurosciences
Development and C.B. Journals
Development Genes and Development Current Biology
Nature Cell Biology Developmental Cell J Cell Biol.
Embo Journal J Biol Chem.
Genetics and Medicine
PLoS Genet. Nature Genetics
Immunology Journals
Immunity Blood Nature Immunology
J. of Immunology Immunology


From this page you can easily interrogate the PubMed database by restricting your queries to only certain journals. This feature is not available on the Pubmed site. Check the box next to the group category to include all the journals belonging to that category or select the journals one by one.
The list is currently restricted but it will grow and eventually it will be possible to customize it with per user settings. This page requires javascript and it has been tested on Firefox and Internet Explorer. Please let me know if you encounter problems with it or just drop me a line if you want me to include new categories and new journals.   

Fancy Pull-quotes (v0.85)

Simply download the plugin, unzip it and copy the php file in the plugin directory of your wordpress installation. Then activate it from the admin panel and you are ready to go. The plugin is fully customizable from a page in the admin control panel.Note: if you are upgrading the plugin from an older version I recommend to first click the “restore all options to default” link.

How to use.
Simply surround the text that you want to see as pull-quote by the following tags: <!--pull--> and <!--/pull-->. The plugin will automatically scan your post for the text included with these tags and treat it as pull-quotes. Getting those
effects is
as easy as that!
Getting those nice effects is as easy as that! If you don’t like the tags as they are or if you want to change the look of the pulled quote, you can do it from the control page in the admin panel of wordpress. The quote is formatted using a CSS definition: if you are an advanced user (i.e. if you know a bit of CSS) you can hack the CSS style in every part.

Detailed instruction.

Open and Close tags: you can define which tag to be used as markers for the pulled quote. Default are <!–pull–> and <!–/pull–>. These tags are transparent by default meaning that if you check the “Mirror quote” option you can activate or inactivate the plugin at any time without changing the layout of your posts.

Background Color: Choose background color. Use same color as your normal background to make it transparent.

Text Color: Choose text color. You can use hexadecimal values (for instance: #0AFF44)

Max Width: specifies the maximal width allowed

Pullquote position: pullquote position in the page (left or right)

Border color, size, style: define border properties

Mirror quote: leave unchecked if you want to use a quote that won’t show in the text of your post (for instance: if you want to have the pullquote to appear at the very top of your post you can uncheck the “mirror quote” checkbox and insert the pulled quoted as first thing in your wordpress post)

Current version of the plugin is 0.85, released on 4.19.2007. The plugin has been tested and working WP 2.0.x and 2.1.x. If you have other experience on other versions of WP please leave a comment here and I’ll udate this paragraph.

The plug-in is released under GPL license, meaning it’s free. If you like it or if you need help feel free to leave a comment here. (did you note that I installed some ads on this page? maybe you can find a couple of minute to check if there is anything interesting to you…)
Take a look also to my other plugin, Alt-to-Legend.


Alt to Legend (v0.50)

This is a neat Plugin!This is a neat Plugin!
Simply download the plugin, unzip it and copy the php file in the plugin directory of your wordpress installation. Then activate it from the admin panel. You can customize the behavior of Alt-2-Legend from a new panel that will appear under the ‘Option’ page in the admin panel.

How to use.
Once your plugin is installed, it is ready to use. Simply insert an image in your post as you normally do and provide a description in the title textbox of the popup window. The text specified in the alt field or title field (your choice) will appear under the image. You can then decide the relative position of the images in the posts under the option page in the admin panel. Image can float always left, always right or according to the align parameter (meaning different post by post if you wish so).

Current version of the plugin is 0.5, released on 5.10.2009. The plugin has been tested only on WP 2.7.1. If you have other experience on other versions of WP please leave a comment here.

The plug-in is released under GPL license, meaning it’s free. If you like it or if you need help feel free to leave a comment here – and hopefully I will get some monetary feedback from the people who will find interesting ads to click on.

-First release

-Add a preview pane in the admin panel
-Add a easy-update link in the admin panel
-Set the width of the box sourrounding the image as big as the image itself

-Fixed the ‘use no border’ bug
-Use local/relative URI for images hosted on localserver (solves error:
getimagesize(): URL file-access is disabled in the server configuration )
-Image can float constantly left, constantly right or left/right according to the align parameter

-Fixed several bugs
-Add the padding and margin settings to adjust border of the image

-Works with an unlimited number of images -Image box will fit also when image is resized using the width parameter

-Will work only if image tag contains the magic word “alt2legend”.
E.g.:<img src="image.jpg" alt="This is a caption" alt2legend />
Also, included in wordpress plugin repository.
Take a look also to my other plugin, fancy-pullquotes.