This document captures the sequence of data import, preprocessing, analysis, and figure generation implemented in the MAP pipeline.
Roughly speaking, the data being imported into the Imported
tables of this pipeline
belong to four primary categories, correspondingly accompanied by four "ingestion schemas" and scripts:
- Behavior
- schema:
ingest_behavior
- ingestion script
- schema:
- Tracking
- schema:
ingest_tracking
- ingestion script
- schema:
- Ephys
- schema:
ingest_ephys
- ingestion script
- schema:
- Histology
- schema:
ingest_histology
- ingestion script
- schema:
The ingestion of behavior data is performed by the BehaviorIngest
's make()
function.
Each make()
call perform the import for one session, determined by browsing the data folder
and following the folder/file naming convention specified in the Ingestion Instruction.
BehaviorIngest
performs ingestion on a per-session basis,
populating data into the tables outlined in red in the diagram below.
Similarly, TrackingIngest
performs ingestion on a per-session basis,
populating data into the tables outlined in red in the diagram below.
The association of whisker tracking time series and the tracked whisker(s) are to be done as follow up manual insertion step.
EphysIngest
performs ingestion on a per-session basis,
search for all Probe and Ephys data associated with that session,
and populate data into the tables outlined in red in the diagram below.
The detailed steps are as followed:
- Search data directory for clustering folder per probe - e.g. kilosort or jrclust
- Per probe, performs:
- Read neuropixels meta file (*_ap.meta) for probe type, probe's serial number, and electrode configuration
- Insert new
ephys.ProbeInsertion
- Read clustering results for clustering method, units, unit quality, spike times, waveforms, etc.
- Insert new
ephys.Unit
for each unit - Read quality control data (metrics.csv) if available, insert new:
ephys.UnitStat
ephys.ClusterMetric
ephys.WaveformMetric
- Read bitcode data file for trial numbering, start times, and "go-cue" onset
- Extract spike times per unit per trial, time alignment to "go-cue", and insert new
ephys.Unit.TrialSpike
- Insertion details are to be subsequently manually inserted by experimenters:
ephys.ProbeInsertion.InsertionLocation
ephys.ProbeInsertion.RecordableBrainRegion
HistologyIngest
performs ingestion on a per-probe basis, populating electrodes' CCF locations and probe tracks.
The MAP pipeline is setup with a set of "workers" that will automatically perform processing/analysis on any newly available data in a parallely distributed fashion.
The insertion of new ephys data triggers several analysis routines.
-
Computing unit's firing rate and ISI-violation (if quality control metrics not available) in
ephys.UnitStat
-
Computing unit's cell type based on mean waveform in
ephys.UnitCellType
-
Compute unit PSTH for all predefined trial condition (i.e.
psth.TrialCondition
) inpsth.UnitPSTH
. This is done for all units except for those with unit_quality of type "all" -
Only when
ephys.ProbeInsertion.InsertionLocation
available, compute:- period selectivity per unit, in
psth.PeriodSelectivity
- overall selectivity per unit, in
psth.UnitSelectivity
- period selectivity per unit, in
Automatic generation of report figures based on availability of upstream results
report.ProjectLevelProbeTrack
- figure regeneration triggered upon changes in the total count of
histology.LabeledProbeTrack
- figure regeneration triggered upon changes in the total count of
report.SessionLevelProbeTrack
- figure regeneration triggered upon changes in the count of
histology.LabeledProbeTrack
for any particular session
- figure regeneration triggered upon changes in the count of
report.SessionLevelReport
report.SessionLevelCDReport
- only process Session with UnitSelectivity computation fully completed, and has RecordableBrainRegion present for all probe insertions
report.ProbeLevelReport
- only process ProbeInsertion with UnitSelectivity computation fully completed
report.ProbeLevelPhotostimEffectReport
- only process ProbeInsertion with UnitPSTH computation (for all TrialCondition) fully completed
report.ProbeLevelDriftMap
- figures generated on a per-shank level
- only process ProbeInsertion with Histology and InsertionLocation known
report.UnitLevelEphysReport
- only process Units from probe that has InsertionLocation present
- ignore units of
unit_quality
of type "all"
report.UnitLevelTrackingReport
- only process Units from session with tracking available
- ignore units of
unit_quality
of type "all"