UBSpec Processing is a python package for analyzing spec traces.

See the quick-start guide below to get started using UBSpec Processing.

CAAPP bitbucket account holders can access the latest source code here

Installation

  1. You will need a Python 3 code editor. (Anaconda with Python 3.6 is reccomended for new python users. It comes with both the python enterpreter and the jupyter notebook python editor.)
  2. Install the "ubspec_processing" python package from the command line
    pip install https://caapp-msu.bitbucket.io/projects/ubspec-processing/package.tar.gz --upgrade --no-cache-dir
  3. (optional) Install the "pandas" python package, which is used in the examples below.
    pip install pandas

Process Traces with Varying Light Intensity

You will need to define the path to the directory containing traces, and the set of light intensities used.

Trace files for each light intensity will be located automatically, and you will be automaticaly prompted to enter the relevent meta-data

import ubspec_processing as ubs
folder = "path/to/data"
set_of_lights = [50,100,500,1000,2000]
processed_data = ubs.getAllPhotoDataFromOneFolder( folder, set_of_lights )

The code above can be easily adapted to process multiple folders by using ubs.getAllPhotoDataFromAllSubFolders() instead of ubs.getAllPhotoDataFromOneFolder()

Processed results can be saved to CSV files using pandas. Meta-data will be included in CSVs.

import pandas
for header in processed_data.keys():
    filename = header + ".csv"
    print( "saving file \"" + filename + "\"" )
    pandas.DataFrame.to_csv( data[header], filename )

This example assumes that your trace files follow "standard" naming conventions. However these settings (and others) can be changed by calling the functions shown below before getAllPhotoDataFromOneFolder() or getAllPhotoDataFromAllSubFolders()

Process Traces with Non-Standard Filenames

import ubspec_processing as ubs
ubs.setPS2LightTraceFileSuffix("_0002.dat")       # (the default is "ue._aux_0002.dat")
ubs.setPS2DarkTraceFileSuffix("dat_0_0002.dat")   # (the default is "f_aux_0002.dat")
ubs.setECSTraceFileSuffix("_0004.dat")         # (the default is "ue.0003.dat")

Set Trace Indices and Aggregators

Trace indices/loops should contain at least one pair of start,stop indices.

Trace aggregators effect how raw parameter loops are summarized for processing. Currently "min", "max", and "mean" are accepted.

import ubspec_processing as ubs
ubs.setPS2DarkTraceParameter( "F0", [ [45,54] ], "min" )
ubs.setPS2DarkTraceParameter( "Fm", [ [80,90], [95,104] ], "max" )
ubs.setPS2LightTraceParameter( "Fmp", [ [1330,1335], [1345,1354] ], "mean" )

Raw Parameters

raw parameters are divided into catagories based on the trace files they are extracted from

Catagory Raw Parameters Example Code
Photosystem 1 Dark DarkP0, DarkPm ubs.setPS1DarkTraceParameter( "DarkP0", [ [180,200] ], "mean" )
Photosystem 1 Light P, P0, Pm, Pmp ubs.setPS1LightTraceParameter( "P", [ [70,90] ], "mean" )
Photosystem 2 Dark F0, Fm ubs.setPS2DarkTraceParameter( "F0", [ [45,54] ], "mean" )
Photosystem 2 Light Fmp, F0p, Fs, Fmpp, F0pp ubs.setPS2LightTraceParameter( "Fmp", [ [1345,1354] ], "mean" )
Parsing A, B, C ubs.setParsingTraceParameter( "C", [ [30, 40] ], "max" )

Computed Results

These standard results are automatically computed if the necessary raw parameters are available.

Photosystem 1

  • b0 = DarkPm - DarkP0
  • PS1ox = P - P0
  • Ynd = ( P - P0 ) / ( Pmp - P0 )
  • PS1open = Pm - P
  • YI = ( Pm - P ) / ( Pmp - P0 )
  • PS1or = Pmp - Pm
  • YNA = ( Pmp - Pm ) / ( Pmp - P0 )
  • Phi1 = ( Pm - P ) / ( DarkPm - DarkP0 )
  • PS1f = ( Pmp - P0 ) / ( DarkPm - DarkP0 )

Photosystem 2

  • Fv_over_Fm = Fv / Fm
  • fvp = fmp - fs
  • phi2 = fvp / fmp
  • LEF = phi2 * light
  • qI = ( fm - fmpp ) / fmpp
  • qE = ( fmpp - fmp ) / fmp
  • qESV = ( fm / fmp ) - ( fm / fmpp )
  • qL = ( (fmp-fs) / (fmp-f0p) ) * (f0p/fs)
  • NPQt = ( 4.88 / ( fmp/f0p - 1 ) ) - 1
  • PhiNO = 1 / ( npqt + 1 + (qL*4.88) )
  • PhiNPQ = 1 - phi2 - phiNO

Parsing

  • ECSt = A - B
  • ECSinv = C - B
  • ECSss = A - C