Building analysis pipeline
Building an analysis pipeline requires sa-labs-analysis-core. It is an analysis framework which abstracts the data structure, storage hierarchy and provides a simplified API (Application Programming Interface). The framework captures the information about analysis parameters and the source code while building the analysis.
Below are the steps involved in building an analysis pipeline,
Step 1- Creating an analysis project
The analysis project helps with organizing the CellData
for a defined purpose. It stores the file names of the cellData
and the results of the analysis. ThecreateAnalysisProject
function requires a unique name for the project, and a list of experiment date as mandatory input parameters. The experiment date can follow the Matlab regular expression pattern. Based on the experiment date pattern, the createAnalysisProject
checks whetherCellData
exists for this project (i.e. the raw data has already been parsed previously). If not, then it parses the raw data file and generates the cell-specific data from the raw data. Otherwise, it loads the already parsed cellData
.
The function saves a simple text file formatted as JSON with the following attributes.
Step 2 - Defining an epoch filter
The epoch filter defines the hierarchy in which epochs are grouped together. As an example, we will focus on creating a filter definition to build a Light Step
analysis pipeline. Light Step
is a simple flash used to stimulate the neurons. The relevant stimulus parameters are displayName
= the name of the stimulus protocol (Light Step
), intensity
= stimulus intensity and simTime
= the duration of the stimulus display.
The epoch filter definition is programmed as a Matlab structure with the following attributes,
type
- a unique name for the filter definition
buildTreeBy
- defines the hierarchy in which the epochs have to be grouped based on epoch parameter names.Let us assume the epoch has the parameters
displayName, intensity, and stimTime
.
Example:
It is also possible to group epochs with different parameters at the same level,
splitValue
- It further filters the epoch based on the epoch parameter values. Let us assume the epochs withdisplayName
have valuesLightStep, MovingBar, DriftingGrating
. The below code filters the epoch which havedisplayName == Light Step
The code below follows our example of the LightStepAnalysis
and filters the epochs which have displayName == Light Step
– the epochs were a simple flash of light was presented to the cells.
It is also possible to attach a function handle to buildTree
and splitValues
.
featureExtractor
- attaches a function handle to the filtered epoch group for further evaluation (the feature extractor will be explained in step 4).
In summary, the complete filter definition for the example LightStepAnalysis
is as follows,
Step 3 - Building the analysis
The function buildAnalysis
generates the analysis tree as defined by the epoch filter, and updates the project file with the analysis results. The project file then stores the analysis date and analysis result file name as additional attributes,
Example Ligt Step Analysis tree for cell data 101217Dcc2_Amp2
It is also possible to build the analysis for multiple filters. This is achieved by passing an array of analysis filter to the function bulidAnalysis
.
Step 4 - Attaching feature extractors & Rebuilding the analysis
The featureExtractor
contains the function handle to process a group of epochs. To perform the feature extraction, assign the feature extractor function handle to the desired level in the analysis tree and rebuild the analysis.
The example below assigns psthExtractor
to the lowest node (stimTime
) in the example analysis tree built for the LightStepAnalysis
. The psthExtractor
generates a peri-stimulus time histogram (PSTH) of the neuron’s responses in the selected epoch group.
Then rebuild the analysis,
When building the analysis, the psthExtractor
is executed and a PSTH is saved for each epoch group that has a unique stimTime
value as a parameter. In addition, the result is also percolated up to the higher levels of the analysis tree for further processing and visualization.
Please be aware of the arguments required in the feature extractor function. It is mandatory to include the input parameters:
analysis, epochGroup, analysisParameter
. Guidelines for creating a feature extractor are explained in the next section.
There are advantages of including the featureExtractor
handle in the filter definition: when the filter definition, source code, and data are coupled, it is possible to execute the analysis and synchronize the results on any computer which has access to the data. Hence, the data-intensive analysis can be performed in distributed (or) a remote computer.
Last updated