A software for sleep analysis in Drosophila

Portfolio

The DAMslice class

Processing and storage of raw data is described in a class called DAMslice described in a file called pysolo_slices.py. The DAMslice object also contains some of the basic functions to manipulate the data. Here I will briefly list the public functions and properties of DAMslice. Some of them are treated with further detail in other pages. DAMslices are the hearth of pySolo as they contain the data you are going to manipulate in every analysis. You should NEVER modify an existing DAMslice but you are welcome to write your own slices and to make them inheriting from DAMslice. Open the file and have a look at it to start having an idea of how things work. Also, the following code will open an existing dad file and do some operation on the DAMslice. Use it as a starting point:

#!/usr/bin/env python
from pysolo_lib import *
filename = ‘/data/Work/sleepData/test4.dad’
allDAMs = LoadDADFile(filename) #allDAMs is a list of DAMslices
fake_tree_selection = [0,0,0,-1,-1] #see the tree coordinates section in the documentation
g, m, d, f = fake_tree_selection[1:]
cSEL = allDAMs[g]
fs, fe = cSEL.getFliesInInterval(m, f)
ds, de = cSEL.getDaysInInterval(d)
t0, t1 = 0, 1440
ax, s5, s30 = cSEL.filterbyStatus(ds,de,fs,fe,t0,t1, status=5)
print ax.shape
#ax, s5 and s30 are all numpy masked 3-dimensional arrays
#containing
#ax -> activity count
#s5 -> sleep for 5 mins
#s30 -> sleep for 30 mins

Functions returning some basic information about the DAMslice.

getHeader()

Return the initial information about the DAMslice as a list
the first argument in the list is the class name
the second argument in the list must be a list with the following parameters
[mon, sch, ech, genotype, comment, smont, sd, emont, eday, year, version]

getTotalDays()

Return the number of days recorded in this DAMslice

getTotalFlies()

Return the total number of flies recorded in this DAMslice

getMonitorFlyName(f, d=None)

given the fly position in the matrix
returns the name of the monitor and the channel the fly was in

getGenotype()

Return the genotype name

getDatesRange()

Return a 3-dimensional list composed of three list of the same size:
the list of days, the list of months, the list of year
eg: [[30,31,1,2],[12,12,1,1],[2007,2007,2008,2008]]

getChannelsMonitorsRange()

Return an array composed of two arrays of the same size:
the list of channel numbers (1-32) and the list of monitor numbers (1-60)
Example: [[1,2,3,4,5,6,7],[5,5,5,5,5,5,5]]

getFliesInMon(mon)

Return the first and the last fly belonging to the monitor mon

getRangePerMon(mon)

Return the list of channel names (1-32) within a given monitor

getDate(day, format = ‘mm/dd’)

Return a string with formatted Date for for the Nth day in current DAMslice
format can use: m, mm, d, dd, yy, yyyy and / as separator

getMonitorName(m, d=None, f=None)

Return a string with the number of the monitor currently selected.
If all monitor are selected will return the string ‘all’

getChannelName(m, f, d=None)

Return a string with the number of the DAM currently Channel.
If all channels are selected will return the string ‘all’

getFliesInInterval(m, f, d=None)

Return the tuple f, f1 as int values
If all flies are selected f=0, f1=self.totFlies-1

getDaysInInterval(d, m=None, f=None)

Return the tuple d, d1 as int values
If all days are selected d=0, d1=self.totDays-1

Functions setting the data records.

After you initialize a DAMslice object, you need to set the data. Activity of the fly for the given day is compulsory. Response and lights depend on the kind of experiment / data we are manipulating

setFly(d, f, activity)

Set the raw data for fly f at day d
Then calculates the 5min sleep bins and the 30min sleep curve
activity is a list of bins spanning the day (default length = 1440)

Status related functions:

Flies Possible Status are:

-1 – Inactive Baseline

-2 – Inactive SD

-3 – Inactive Recovery

-4 – Inactive None

-5 – Make Inactive

0 – Toggle Status (active/inactive)

1 – Active Baseline

2 – Active SD

3 – Active Recovery

4 – Active None

5 – Make Active

setFlyStatus(d, d1, f, f1, status = 0)

Change the status of the flies f to f1 for days d to d1.

allinStatus(mon=None, day=None, fly=None, status=-5)

Return true if all the flies in the interrogated category have the same status

filterbyStatus(d, d1, f, f1, status=5, use_dropout = True, useFilter = True, min_alive = 0, max_alive = 1440)

This function filters the fly raw data by fly status and returns the distribution
of the fundamental values in the selected population.

Comments are closed.

pySolo sign up form


Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur excepteur sint occaecat cupidatat non

pySolo login form