Thursday, March 31, 2016

A simple GUI for analyzing BioDAQ data

The Palmiter lab often monitors food and water intake in response to a variety of stimuli. To quantify these measurements, we house mice in BioDAQ chambers, which will record how much a mouse eats or drinks down to 0.01g. While the chambers are nice, the software that comes with them is terrible. In addition to being slow, it outputs data for each cage separately, which means you get to enjoy combining Excel files. After fighting the software, I decided I could do better, and made a small GUI.

Screenshot of the BioDAQ software. Note the Windows-95 era aesthetic. You can record up to 32 scales at a time. To get a single scale, you have to unclick the other 31! Data for each cage is saved individually.

The GUI

The goal of the GUI was to be able to analyze many cages over multiple days, and output a single file containing the data for further analysis.

The GUI starts by loading a .tab file which contains the feeding data. The code for this was actually easy, as the data is just a tab-delimited text file. (It takes a little longer than I expected, a few seconds, due to datetime parsing.)

Once the data is loaded, the GUI asks the users for information about which cages to analyze, which dates, times, and how to bin the data by time. If you are interested in the data from 10 cages, binned at one hour increments, over 5 days, you can simply input those numbers. Once everything is set, you can then save the data to a .csv, which will have the same base filename as the input data. The .csv will contain columns for:

date and time
cage id
number of feeding bouts
average bout duration (in seconds)
total eaten (in grams)
number of meals
average meal duration (in seconds)
average meal size (in grams)

Left: The GUI. You can choose a range of cages, dates, times, and more. Right: Output CSV for the file given the parameters on the left. There is information for total food eaten, number of bouts of eating, number of meals, and duration for each of those. If a cage or time does not have information, the row will be blank.

If you use BioDAQs to measure feeding, and are similarly frustrated with the software, you can give this GUI a try! You only need to download two python files, BioDAQGUI.py and BioDAQmain.py. To run the GUI, you can use either python 2.7 or 3+ (the Anaconda install should have all the relevant modules). Just open a command prompt, and type:

python BioDAQmain.py

I suggest comparing the output of the GUI to some pre-analyzed data, so you can verify that it works. If you find this helpful, let me know!

3 comments:

  1. Hi Mike, This is PERFECT. Just what my client will need. I'll forward.
    Also, you could do me a huge favor. Can you possibly send me some raw data output files from BioDAQ.
    If such files are under 10MB then send to wilant@gmail.com
    If they are larger, then a Dropbox link would work, or www.wetransfer.com.

    THANKS MUCH IN ADVANCE!

    Wilant van Giessen
    Account Manager (Southeast Region)
    __________________________________________

    Wilant van Giessen, M.Sc.
    Noldus Information Technology, Inc.
    Asheville, North Carolina
    Southeast Regional Office - FL, GA, TN, SC, NC, AL

    phone 703-840-2462 | mobile 828-712-9499
    email wilant@noldus.com | web www.noldus.com | skype Wilant

    ReplyDelete
  2. Hi there! I would really like to use this program, but I am new to Python and I tried everything I could think of but it didn't work. I enlisted a Python veteran, but he also could not get the file to work. He recommended asking you for the file as an .exe. Can you send that to me to try? Thank you!!

    Molly McDougle
    Research Assistant
    John B. Pierce Laboratory
    mmcdougle@jbpierce.org

    ReplyDelete

Note: Only a member of this blog may post a comment.