Locomotor data demo MWP


This script demonstrates how to use the zanscript language to write a behavioural assay to measure locomotion for a small model organism, such as Drosophila, larval zebrafish or Daphnia. Normally this type of experiment is done in a standard-sized well plate that fits in the experimental chamber of the MWP unit.

It is advisable to read through first the Tutorials for zanscript, in particular view the video in the tutorial for Using logdata, logcreate, logrun.

Top

Script outline

This script demonstrates how you can use the LOGCREATE, LOGDATA and LOGRUN commands to collect summarised results data from an experiment in the MWP unit.

In particular this script demonstrates how a script with two zones may work with the MWP unit. The script records the movement of singly-housed animals in a 24 multi well plate. The well plate is illuminated with a white light during the trials.

The results data will give overall distance moved, in both the whole arena and in the two different zones, as well as distance moved in time_bins. As the results data is recorded in time bins - DEFINE TIME_BIN 10 records in 10 sec time bins - non movement can be calculated in time bins.

IMPORTANT - you must have an arena and detector asset downloaded in the Assets directory, in the case of this script you need the following assets named:

  • "arenas24"
  • "dualzones24"

Whilst familiarising yourself with scripting, it is advisable to use the script below in tandem with the Zanscript syntax manual.

Top

Full script

This script demonstrates how you can use the LOGCREATE, LOGDATA and LOGRUN commands to collect summarised results data from an experiment in the MWP unit.

In particular this script demonstrates how a script with two zones may work with the MWP unit. The script records the movement of singly-housed animals in a 24 multi well plate. The well plate is illuminated with a white light during the trials. The results data will give overall distance moved, in both the whole arena and in the two different zones, as well as distance moved in time_bins. As the results data is recorded in time bins - DEFINE TIME_BIN 10 records in 10 sec time bins - non movement can be calculated in time bins.

IMPORTANT - you must have an arena and detector asset downloaded in the Assets directory, in the case of this script you need the following assets named:

  • "arenas24"
  • "dualzones24"
INCLUDE zsys 
DEFINE TIME_BIN 10 
DEFINE PRETRIAL_TIME 0 
DEFINE TRIALS 30 
 
SET(GPO6,1) 
SET(GPO7,1) 
SET(GPO8,1) 
 
SET(TILE_SIZE,5) 
SET(DETECTOR_THRESHOLD,6) 
SET(SEARCH_DISTANCE,10) 
SET(SEARCH_STEP,3) 
SET(FILTER_RADIUS,3) 
 
SET(AUTOREF_MODE,1) 
SET(AUTOREF_TIMEOUT,10) 
 
 
ACTION MAIN
 
 SET(COUNTER1,COUNTER_ZERO)
 LOAD(ARENAS,"arenas24")
 LOAD(DETECTORS,"dualzones24")
 
 LOGCREATE("TEXT:|TEXT:|TEXT:|TEXT:TIME|TEXT:TRIAL|TEXT:TEMPERATURE")
 LOGAPPEND("TEXT:VARIABLE") 
 LOGAPPEND("TEXT:A1|TEXT:A2|TEXT:A3|TEXT:A4|TEXT:A5|TEXT:A6")
 LOGAPPEND("TEXT:B1|TEXT:B2|TEXT:B3|TEXT:B4|TEXT:B5|TEXT:B6")
 LOGAPPEND("TEXT:C1|TEXT:C2|TEXT:C3|TEXT:C4|TEXT:C5|TEXT:C6")
 LOGAPPEND("TEXT:D1|TEXT:D2|TEXT:D3|TEXT:D4|TEXT:D5|TEXT:D6")
 LOGRUN()
 
 AUTOREFERENCE()
 LIGHTS(ALL,OFF)
 WAIT(PRETRIAL_TIME)
 LOGDATA(DATA_SNAPSHOT,"BEGIN_EXPT")
 INVOKE(MONITOR_MOVEMENT,TRIALS)
 
 LOGDATA(DATA_SNAPSHOT,"END_EXPT")
 LOGDATA(DATA_SELECT,"BEGIN_EXPT")
 LOGDATA(DATA_DELTA,"END_EXPT")
 INVOKE(WRITEFINALDATA,1)
 
 LIGHTS(ALL,OFF)
 
COMPLETE
 
 
ACTION MONITOR_MOVEMENT
 
 SET(COUNTER1,COUNTER_INC)
 LOGDATA(DATA_SNAPSHOT,"BEGIN")
 WAIT(TIME_BIN)
 LOGDATA(DATA_SNAPSHOT,"END")
 LOGDATA(DATA_SELECT,"BEGIN")
 LOGDATA(DATA_DELTA,"END")
 INVOKE(WRITEDATA,1)
 
COMPLETE 
 
 
ACTION WRITEDATA
 
 LOGCREATE("TEXT:|TEXT:|TEXT:|RUNTIME|COUNTER1|TEMPERATURE1|TEXT:ZONE1_DISTANCE")
 LOGAPPEND("ZONE_DISTANCES:A-24,Z1")
 LOGRUN()
 
 LOGCREATE("TEXT:|TEXT:|TEXT:|RUNTIME|COUNTER1|TEMPERATURE1|TEXT:ZONE2_DISTANCE")
 LOGAPPEND("ZONE_DISTANCES:A-24,Z2") 
 LOGRUN()
 
 LOGCREATE("TEXT:|TEXT:|TEXT:|RUNTIME|COUNTER1|TEMPERATURE1|TEXT:ZONE1_TIME")
 LOGAPPEND("ZONE_TIMERS:A-24,Z1")
 LOGRUN()
 
 LOGCREATE("TEXT:|TEXT:|TEXT:|RUNTIME|COUNTER1|TEMPERATURE1|TEXT:ZONE2_TIME")
 LOGAPPEND("ZONE_TIMERS:A-24,Z2")
 LOGRUN()
 
 LOGCREATE("TEXT:|TEXT:|TEXT:|RUNTIME|COUNTER1|TEMPERATURE1|TEXT:ZONE1_COUNT")
 LOGAPPEND("ZONE_COUNTERS:A-24,Z1")
 LOGRUN()
 
 LOGCREATE("TEXT:|TEXT:|TEXT:|RUNTIME|COUNTER1|TEMPERATURE1|TEXT:ZONE2_COUNT")
 LOGAPPEND("ZONE_COUNTERS:A-24,Z2") 
 LOGRUN()
 
 LOGCREATE("TEXT:|TEXT:|TEXT:|RUNTIME|COUNTER1|TEMPERATURE1|TEXT:ARENA_DISTANCE")
 LOGAPPEND("ARENA_DISTANCES*")
 LOGRUN()
 
 LOGCREATE("TEXT:")
 LOGRUN() 
 
COMPLETE
 
 
ACTION WRITEFINALDATA
 
 LOGCREATE("TEXT:|TEXT:|TEXT:|RUNTIME|TEXT:EXPT_TOTAL|TEXT:|TEXT:ZONE1_DISTANCE")
 LOGAPPEND("ZONE_DISTANCES:A-24,Z1")
 LOGRUN()
 
 LOGCREATE("TEXT:|TEXT:|TEXT:|RUNTIME|TEXT:EXPT_TOTAL|TEXT:|TEXT:ZONE2_DISTANCE")
 LOGAPPEND("ZONE_DISTANCES:A-24,Z2")
 LOGRUN()
 
 LOGCREATE("TEXT:|TEXT:|TEXT:|RUNTIME|TEXT:EXPT_TOTAL|TEXT:|TEXT:ZONE1_TIME")
 LOGAPPEND("ZONE_TIMERS:A-24,Z1")
 LOGRUN()
 
 LOGCREATE("TEXT:|TEXT:|TEXT:|RUNTIME|TEXT:EXPT_TOTAL|TEXT:|TEXT:ZONE2_TIME")
 LOGAPPEND("ZONE_TIMERS:A-24,Z2")
 LOGRUN()
 
 LOGCREATE("TEXT:|TEXT:|TEXT:|RUNTIME|TEXT:EXPT_TOTAL|TEXT:|TEXT:ZONE1_COUNT")
 LOGAPPEND("ZONE_COUNTERS:A-24,Z1")
 LOGRUN()
 
 LOGCREATE("TEXT:|TEXT:|TEXT:|RUNTIME|TEXT:EXPT_TOTAL|TEXT:|TEXT:ZONE2_COUNT")
 LOGAPPEND("ZONE_COUNTERS:A-24,Z2")
 LOGRUN()
 
 LOGCREATE("TEXT:|TEXT:|TEXT:|RUNTIME|TEXT:EXPT_TOTAL|TEXT:|TEXT:ARENA_DISTANCE")
 LOGAPPEND("ARENA_DISTANCES*")
 LOGRUN()
 
 LOGCREATE("TEXT:")
 LOGRUN()
 
COMPLETE


Top

Script explanation

You can amend this script (as explained below) for a smaller well plate, e.g. for 6 wellplate, 12 wellplate, 48 wellplate, 96 wellplate.

INCLUDE zsys
DEFINE TIME_BIN 10
DEFINE PRETRIAL_TIME 0
  • INCLUDE zsys in every script
  • The two DEFINE commands enable you change the time values in seconds as used in the script, e.g. if you want to collect summarised data in 1 second time bins you would replace 10 with 1 accordingly: DEFINE TIME_BIN 1
DEFINE TRIALS 30

This DEFINE command details the value for TRIALS when used in the script. At the moment 30 trials will be conducted, this can then easily be changed so that each experiment runs more or less trials.

SET(GPO6,1)
SET(GPO7,1)
SET(GPO8,1)

These SET commands turn on the three different overhead LED lights in the experimental chamber.

  • The first part in the brackets determines the light: GPO6 is the red LED light, GPO7 is the green LED, GPO8 is the blue LED.
  • The second part in the brackets determines the strength of the light, i.e. 1 is full strength.

For a demo on using the overhead lights in the MWP unit see the support page, Lights demo MWP.

SET(TILE_SIZE,5)
SET(DETECTOR_THRESHOLD,6)
SET(SEARCH_DISTANCE,10)
SET(SEARCH_STEP,3)
SET(FILTER_RADIUS,3)

The SET commands above define the animal model tracking requirements, which are dependent on animal size.

For more details on adjusting the tracking requirements see the Tutorial for zanscript.

SET(AUTOREF_MODE,1)
SET(AUTOREF_TIMEOUT,10)

The two SET commands above define the auto reference tracking requirements. If the animals you are using will take a while before they move for the first time, increase the value for the command AUTOREF_TIMEOUT which is currently set to last 10 seconds.

SET(COUNTER1,COUNTER_ZERO)
LOAD(ARENAS,"arenas24")
LOAD(DETECTORS,"dualzones24")
  • The SET command above tells the unit to set COUNTER1 at zero, COUNTER1 will be used later in the script to count the trials - as found under the ACTION MONITOR_MOVEMENT, where the command - SET(COUNTER1,COUNTER_INC) - sets COUNTER1 to count the trials - i.e. count incrementally each time the Action occurs.
  • The LOAD commands tells the unit to use the assets detailed in brackets (in parenthesis) to define the location of each arena and the detector zones in each arena. The assets / .bmp files must be loaded in the unit's Assets directory.
LOGCREATE("TEXT:|TEXT:|TEXT:|TEXT:TIME|TEXT:TRIAL|TEXT:TEMPERATURE")
LOGAPPEND("TEXT:VARIABLE")
LOGAPPEND("TEXT:A1|TEXT:A2|TEXT:A3|TEXT:A4|TEXT:A5|TEXT:A6")
LOGAPPEND("TEXT:B1|TEXT:B2|TEXT:B3|TEXT:B4|TEXT:B5|TEXT:B6")
LOGAPPEND("TEXT:C1|TEXT:C2|TEXT:C3|TEXT:C4|TEXT:C5|TEXT:C6")
LOGAPPEND("TEXT:D1|TEXT:D2|TEXT:D3|TEXT:D4|TEXT:D5|TEXT:D6")
LOGRUN()
  • The LOGCREATE (and subsequent LOGAPPEND) command tell the unit to commit to memory information for a line of data. In this case there will be three empty data cells (where nothing is written after TEXT:) followed by cells containing text headings.
  • The LOGCREATE (and subsequent LOGAPPEND) commands are used for a 24 well plate and need to be amended for a different sized well plate. For example, a 6 wellplate you would change lines 4-6 for only one line reading:
    • LOGAPPEND("TEXT:A1|TEXT:A2|TEXT:A3|TEXT:B1|TEXT:B2|TEXT:B3")
  • The LOGRUN outputs the data specified in the previous LOGCREATE command.
AUTOREFERENCE()
LIGHTS(ALL,OFF)
WAIT(PRETRIAL_TIME)
  • The AUTOREFERENCE command tells the unit to take an auto reference image needed for tracking, using the settings detailed above.
  • The LIGHTS are all turned off.
  • The unit will wait for the time in seconds as defined above.
LOGDATA(DATA_SNAPSHOT,"BEGIN_EXPT")
INVOKE(MONITOR_MOVEMENT,TRIALS)
LOGDATA(DATA_SNAPSHOT,"END_EXPT")
LOGDATA(DATA_SELECT,"BEGIN_EXPT")
LOGDATA(DATA_DELTA,"END_EXPT") INVOKE(WRITEFINALDATA,1)
  • The first LOGDATA command tells the unit to take a snapshot of the experiment, remembering the tracking details of the animals, and labelling this snapshot BEGIN_EXPT.
  • The Action MONITOR_MOVEMENT will be invoked the number of times as defined by TRIALS above
  • The second LOGDATA(DATA_SNAPSHOT,...) command tells the unit to take another snapshot of the experiment after all the trials have finished, labelling it END_EXPT.
  • The last two LOGDATA lines of code, LOGDATA(DATA_SELECT,....) and LOGDATA(DATA_DELTA,.....), instruct the unit to calculate the difference in data between the two snapshots taken, "BEGIN_EXPT" and "END_EXPT"
ACTION WRITEDATA
LOGCREATE("TEXT:|TEXT:|TEXT:|RUNTIME|COUNTER1|TEMPERATURE1|TEXT:ZONE1_DISTANCE")
LOGAPPEND("ZONE_DISTANCES:A-24,Z1")
LOGRUN()

In ACTION WRITEDATA the commands tell the unit how to output processed results for each trial.

The LOGCREATE, LOGAPPEND lines above tell the unit what data to write in the line of cells, this includes:

  • empty cells (e.g. from TEXT:),
  • the actual RUNTIME that the data is recorded
  • the value of COUNTER1, which is the trial number
  • The temperature recorded at this time by the thermistor
  • The distance travelled by each animal (one in each of the 24 arenas) in zone 1 (from "ZONE_DISTANCES:A-24,Z1")

To amend the data collection for a smaller or bigger wellplate, change the number in A-24 to the number of arenas in your well plate, e.g. a 6 wellplate would read A-6; a 48 wellplate would read A-48.

LOGAPPEND("ZONE_DISTANCES:A-24,Z2")

The command above, which must follow a LOGCREATE line, tells the unit to output the distance travelled by each animal (in each of the 24 arenas) in Zone 2.

LOGAPPEND("ZONE_TIMERS:A-24,Z1")
  • The command above, which must follow a LOGCREATE line, tells the unit to output the time each animal (in each of the 24 arenas) spends in zone 1.
LOGAPPEND("ZONE_COUNTERS:A-24,Z1")
  • The command above, which must follow a LOGCREATE line, tells the unit to output the number of times each animal (in each of the 24 arenas) enters zone 1. This will include the position of the animal when this specific trial begins. Hence the value for the ZONE_COUNTERS for the total experiment may be less.
LOGAPPEND("ARENA_DISTANCES*")
  • The command above, which must follow a LOGCREATE line, tells the unit to ouput the distance travelled by every animal in their arena during the trial.
ACTION WRITEFINALDATA
  • This action is invoked after all the trials have been completed and gives a summary of the total results for the whole experiment.
  • The data is outputted in the same way as explained above.
  • Please note that it compares a data snapshot taken at the beginning of the experiment and one taken at the end of the experiment. Consequently there is no repetition of data which you may see with many subsequent trials.
Top

Results data

Below is a screenshot of the processed results data, which is downloaded from the Data directory on the unit as a .csv file. In this case the .csv file has been opened using Numbers.


Screen Shot 2019 10 15 At 14 54 32
Showing part of the processed results taken from a demo experiment using this script

In the screenshot above you can see some of the text headings for the results data file. The results for each trial in each arena are also detailed, although only the first 3 trials are evident for the first few arenas.