Skip to content

Commit 2df6280

Browse files
committed
2 parents 06568f4 + 678cd95 commit 2df6280

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+5654
-2477
lines changed

.github/workflows/u24_element_release_call.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
secrets:
1818
TWINE_USERNAME: ${{secrets.TWINE_TEST_USERNAME}}
1919
TWINE_PASSWORD: ${{secrets.TWINE_TEST_PASSWORD}}
20+
GOOGLE_ANALYTICS_KEY: ${{secrets.GOOGLE_ANALYTICS_KEY}}
2021
call_u24_elements_release_alpine:
2122
if: >-
2223
github.event.workflow_run.conclusion == 'success' && github.repository_owner == 'datajoint' && !contains(github.event.workflow_run.head_branch, 'test')
@@ -26,3 +27,5 @@ jobs:
2627
secrets:
2728
TWINE_USERNAME: ${{secrets.TWINE_USERNAME}}
2829
TWINE_PASSWORD: ${{secrets.TWINE_PASSWORD}}
30+
GOOGLE_ANALYTICS_KEY: ${{secrets.GOOGLE_ANALYTICS_KEY}}
31+

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,4 +118,8 @@ dj_local_conf_old.json
118118
docker-compose.y*ml
119119

120120
# include
121-
!docs/docker-compose.yaml
121+
!docs/docker-compose.yaml
122+
123+
# vscode settings
124+
.vscode
125+
*.code-workspace

CHANGELOG.md

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,19 @@
33
Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and
44
[Keep a Changelog](https://keepachangelog.com/en/1.0.0/) convention.
55

6-
## [0.1.5] - 2022-07-11
6+
## [0.2.1] - Unreleased
77

8+
+ Update - clustering step, update duration for "median_subtraction" step
9+
+ Bugfix - handles single probe recording in "Neuropix-PXI" format
10+
+ Update - safeguard in creating/inserting probe types upon probe activation
11+
12+
## [0.2.0] - 2022-10-28
13+
14+
+ Add - New schema `ephys_report` to compute and store figures from results
15+
+ Add - Widget to display figures
16+
+ Add - Add `ephys_no_curation` and routines to trigger spike-sorting analysis
17+
using Kilosort (2.0, 2.5)
18+
+ Add - mkdocs for Element Documentation
819
+ Add - New `QualityMetrics` table to store clusters' and waveforms' metrics after the spike sorting analysis.
920

1021
## [0.1.4] - 2022-07-11
@@ -33,8 +44,8 @@ Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and
3344
+ Add - NWB export function
3445

3546
## [0.1.0b4] - 2021-11-29
36-
### Added
37-
+ Processing with Kilosort and pyKilosort for Open Ephys and SpikeGLX
47+
48+
+ Add - Processing with Kilosort and pyKilosort for Open Ephys and SpikeGLX
3849

3950

4051
## [0.1.0b0] - 2021-05-07
@@ -46,12 +57,16 @@ Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and
4657
+ Add - GitHub Action release process
4758
+ Add - `probe` and `ephys` elements
4859
+ Add - Readers for: `SpikeGLX`, `Open Ephys`, `Kilosort`
49-
+ Add - Probe table supporting: Neuropixels probes 1.0 - 3A, 1.0 - 3B, 2.0 - SS, 2.0 - MS
50-
51-
[0.1.4]: https://github.com/datajoint/element-array-ephys/compare/0.1.3...0.1.4
52-
[0.1.3]: https://github.com/datajoint/element-array-ephys/compare/0.1.2...0.1.3
53-
[0.1.2]: https://github.com/datajoint/element-array-ephys/compare/0.1.1...0.1.2
54-
[0.1.1]: https://github.com/datajoint/element-array-ephys/compare/0.1.0...0.1.1
55-
[0.1.0]: https://github.com/datajoint/element-array-ephys/compare/0.1.0b0...0.1.0
56-
[0.1.0b0]: https://github.com/datajoint/element-array-ephys/compare/0.1.0a5...0.1.0b0
60+
+ Add - Probe table supporting: Neuropixels probes 1.0 - 3A, 1.0 - 3B, 2.0 - SS,
61+
2.0 - MS
62+
63+
[0.2.1]: https://github.com/datajoint/element-array-ephys/releases/tag/0.2.1
64+
[0.2.0]: https://github.com/datajoint/element-array-ephys/releases/tag/0.2.0
65+
[0.1.4]: https://github.com/datajoint/element-array-ephys/releases/tag/0.1.4
66+
[0.1.3]: https://github.com/datajoint/element-array-ephys/releases/tag/0.1.3
67+
[0.1.2]: https://github.com/datajoint/element-array-ephys/releases/tag/0.1.2
68+
[0.1.1]: https://github.com/datajoint/element-array-ephys/releases/tag/0.1.1
69+
[0.1.0]: https://github.com/datajoint/element-array-ephys/releases/tag/0.1.0
70+
[0.1.0b4]: https://github.com/datajoint/element-array-ephys/releases/tag/0.1.0b4
71+
[0.1.0b0]: https://github.com/datajoint/element-array-ephys/releases/tag/0.1.0b0
5772
[0.1.0a5]: https://github.com/datajoint/element-array-ephys/releases/tag/0.1.0a5

README.md

Lines changed: 8 additions & 173 deletions
Original file line numberDiff line numberDiff line change
@@ -1,177 +1,12 @@
11
# DataJoint Element - Array Electrophysiology Element
22

3-
+ This repository features DataJoint pipeline design for extracellular array electrophysiology,
4-
with Neuropixels probe and Kilosort spike sorting method.
3+
DataJoint Element for extracellular array electrophysiology. DataJoint Elements
4+
collectively standardize and automate data collection and analysis for neuroscience
5+
experiments. Each Element is a modular pipeline for data storage and processing with
6+
corresponding database tables that can be combined with other Elements to assemble a
7+
fully functional pipeline.
58

6-
+ This module is designed to be integrated into a complete data pipeline and provides
7-
data tables and computational dependencies specific to extracellular electrophysiology
8-
processing and analysis.
9+
![diagram](https://raw.githubusercontent.com/datajoint/element-array-ephys/main/images/diagram_flowchart.svg)
910

10-
+ This modular pipeline element can be flexibly attached downstream
11-
to any particular design of experiment session, thus assembling a fully functional
12-
ephys pipeline.
13-
14-
+ This Element provides three schema options, selected via the DataJoint config file, with `dj.config['custom']['ephys_mode']`
15-
+ `acute` probe insertion, with curated clustering
16-
+ `chronic` probe insertion, with curated clustering
17-
+ `no-curation`, with kilosort triggered clustering
18-
19-
+ See the [Element Array Electrophysiology documentation](https://elements.datajoint.org/description/array_ephys/) for the background information and development timeline.
20-
21-
+ For more information on the DataJoint Elements project, please visit https://elements.datajoint.org. This work is supported by the National Institutes of Health.
22-
23-
## Element architecture
24-
25-
`element-array-ephys` is comprised of two schemas, `probe` and `ephys`. To handle
26-
several use cases of this pipeline, we have designed several `ephys` schemas, including
27-
`ephys_acute`, `ephys_chronic`, and `ephys_precluster`.
28-
29-
+ `ephys_acute` - A probe(s) is inserted into a new location during each session.
30-
31-
+ `ephys_chronic` - A probe(s) is inserted once and used to record across multiple
32-
sessions.
33-
34-
+ `ephys_precluster` - A probe(s) is inserted into a new location during each session.
35-
And pre-clustering steps (e.g. CatGT) are performed on the data from each probe prior
36-
to Kilosort analysis.
37-
38-
### `ephys_acute` module
39-
![element-array-ephys acute diagram](images/attached_array_ephys_element_acute.svg)
40-
41-
42-
### `ephys_chronic` module
43-
![element-array-ephys chronic diagram](images/attached_array_ephys_element_chronic.svg)
44-
45-
### `ephys_precluster` module
46-
![element-array-ephys precluster diagram](
47-
images/attached_array_ephys_element_precluster.svg)
48-
49-
50-
As the diagram depicts, the array ephys element starts immediately downstream from `Session`,
51-
and also requires some notion of `Location` as a dependency for `InsertionLocation`. We
52-
provide an [example workflow](https://github.com/datajoint/workflow-array-ephys/) with a
53-
[pipeline script](https://github.com/datajoint/workflow-array-ephys/blob/main/workflow_array_ephys/pipeline.py)
54-
that models (a) combining this Element with the corresponding [Element-Session](https://github.com/datajoint/element-session)
55-
, and (b) declaring a `SkullReference` table to provide Location.
56-
57-
## Table descriptions
58-
59-
### Probe & electrodes
60-
61-
The `probe` schema contains information regarding the Neuropixels probe and electrode configuration.
62-
63-
<details>
64-
<summary>Click to expand details</summary>
65-
66-
+ `ProbeType` - a lookup table specifying the type of Neuropixels probe (e.g. "neuropixels 1.0", "neuropixels 2.0 single-shank")
67-
68-
+ `ProbeType.Electrode` - all electrode and their properties for a particular probe type
69-
+ An electrode here refers to one recordable electrode site on the Neuropixels probe (e.g. for Neuropixels 1.0, there are 960 sites per shank)
70-
71-
+ `Probe` - record of an actual physical probe, identifiable by some unique ID (e.g. probe's serial number)
72-
73-
+ `ElectrodeConfig` - particular electrode configuration to be used for ephys recording
74-
75-
+ `ElectrodeConfig.Electrode` - corresponding electrodes in `ProbeType.Electrode` that are used for recording in this electrode configuration (e.g. for Neuropixels 1.0 or 2.0, there can be at most 384 electrodes usable for recording per probe)
76-
77-
</details>
78-
79-
### Extracellular electrophysiology recording
80-
81-
The `ephys` schema stores information regarding the recording from a probe for a given session.
82-
83-
<details>
84-
<summary>Click to expand details</summary>
85-
86-
+ `ProbeInsertion` - a surgical insertion of a probe in the brain. Every experimental session consists of one or more entries in `ProbeInsertion` with a corresponding `InsertionLocation` each
87-
88-
+ `EphysRecording` - each `ProbeInsertion` is accompanied by a corresponding `EphysRecording`, specifying the `ElectrodeConfig` used for the recording from the `Probe` defined in such `ProbeInsertion`
89-
90-
</details>
91-
92-
### Clusters and spikes
93-
94-
The `ephys` schema features automatic ingestion of spike sorting results from the `Kilosort` analysis method.
95-
96-
<details>
97-
<summary>Click to expand details</summary>
98-
99-
+ `Clustering` - specify instance(s) of clustering on an `EphysRecording`, by some `ClusteringMethod`
100-
101-
+ `Curation` - specify instance(s) of curations performed on the output of a given `Clustering`
102-
103-
+ `CuratedClustering` - set of results from a particular round of clustering/curation
104-
+ `CuratedClustering.Unit` - Identified unit(s) from one `Curation`, and the associated properties (e.g. cluster quality, spike times, spike depths, etc.)
105-
+ `WaveformSet` - A set of spike waveforms for units from a given CuratedClustering
106-
107-
</details>
108-
109-
## Installation
110-
<details>
111-
<summary>Click to expand details</summary>
112-
113-
+ Install `element-array-ephys`
114-
```
115-
pip install element-array-ephys
116-
```
117-
118-
+ Upgrade `element-array-ephys` previously installed with `pip`
119-
```
120-
pip install --upgrade element-array-ephys
121-
```
122-
123-
+ Install `element-interface`
124-
+ `element-interface` is a dependency of `element-array-ephys`, however it is not contained within `requirements.txt`.
125-
```
126-
pip install "element-interface @ git+https://github.com/datajoint/element-interface"
127-
```
128-
129-
</details>
130-
131-
## Usage
132-
133-
### Element activation
134-
135-
When using this Element, one needs to run `ephys.activate` to declare the schemas and tables on the database.
136-
137-
<details>
138-
<summary>Click to expand details</summary>
139-
140-
To activate the `element-array-ephys`, ones need to provide:
141-
142-
1. Schema names
143-
+ schema name for the probe module
144-
+ schema name for the ephys module
145-
146-
2. Upstream tables
147-
+ Session table: A set of keys identifying a recording session (see [Element-Session](https://github.com/datajoint/element-session)).
148-
+ SkullReference table: A reference table for InsertionLocation, specifying the skull reference (see [example pipeline](https://github.com/datajoint/workflow-array-ephys/blob/main/workflow_array_ephys/pipeline.py)).
149-
150-
3. Utility functions. See [example definitions here](https://github.com/datajoint/workflow-array-ephys/blob/main/workflow_array_ephys/paths.py)
151-
+ get_ephys_root_data_dir(): Returns your root data directory.
152-
+ get_session_directory(): Returns the path of the session data relative to the root.
153-
154-
For more detail, check the docstring of the `element-array-ephys`:
155-
156-
help(probe.activate)
157-
help(ephys.activate)
158-
159-
</details>
160-
161-
### Example usage
162-
163-
See [this project](https://github.com/datajoint/workflow-array-ephys) for an example usage of this Array Electrophysiology Element.
164-
165-
## Citation
166-
167-
+ If your work uses DataJoint and DataJoint Elements, please cite the respective Research Resource Identifiers (RRIDs) and manuscripts.
168-
169-
+ DataJoint for Python or MATLAB
170-
+ Yatsenko D, Reimer J, Ecker AS, Walker EY, Sinz F, Berens P, Hoenselaar A, Cotton RJ, Siapas AS, Tolias AS. DataJoint: managing big scientific data using MATLAB or Python. bioRxiv. 2015 Jan 1:031658. doi: https://doi.org/10.1101/031658
171-
172-
+ DataJoint ([RRID:SCR_014543](https://scicrunch.org/resolver/SCR_014543)) - DataJoint for `<Select Python or MATLAB>` (version `<Enter version number>`)
173-
174-
+ DataJoint Elements
175-
+ Yatsenko D, Nguyen T, Shen S, Gunalan K, Turner CA, Guzman R, Sasaki M, Sitonic D, Reimer J, Walker EY, Tolias AS. DataJoint Elements: Data Workflows for Neurophysiology. bioRxiv. 2021 Jan 1. doi: https://doi.org/10.1101/2021.03.30.437358
176-
177-
+ DataJoint Elements ([RRID:SCR_021894](https://scicrunch.org/resolver/SCR_021894)) - Element Array Electrophysiology (version `<Enter version number>`)
11+
Installation and usage instructions can be found at the
12+
[Element documentation](https://datajoint.com/docs/elements/element-array-ephys).

docs/.docker/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ WORKDIR /main
44
COPY --chown=anaconda:anaconda ./docs/.docker/apk_requirements.txt ${APK_REQUIREMENTS}
55
COPY --chown=anaconda:anaconda ./docs/.docker/pip_requirements.txt ${PIP_REQUIREMENTS}
66
RUN \
7+
umask u+rwx,g+rwx,o-rwx && \
78
/entrypoint.sh echo "Dependencies installed" && \
9+
rm ${APK_REQUIREMENTS} ${PIP_REQUIREMENTS} && \
810
git config --global user.name "GitHub Action" && \
911
git config --global user.email "action@github.com"&& \
1012
git config --global pull.rebase false && \
1113
git init
1214
COPY --chown=anaconda:anaconda ./${PACKAGE} /main/${PACKAGE}
1315
COPY --chown=anaconda:anaconda ./docs/mkdocs.yaml /main/docs/mkdocs.yaml
1416
COPY --chown=anaconda:anaconda ./docs/src /main/docs/src
15-
COPY --chown=anaconda:anaconda ./CHANGELOG.md /main/docs/src/about/changelog.md
17+
COPY --chown=anaconda:anaconda ./CHANGELOG.md /main/

docs/.docker/pip_requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ mdx-truly-sane-lists
77
mkdocs-gen-files
88
mkdocs-literate-nav
99
mkdocs-exclude-search
10+
mkdocs-markdownextradata-plugin

docs/docker-compose.yaml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# MODE="LIVE|QA|BUILD" PACKAGE=element_array_ephys UPSTREAM_REPO=https://github.com/datajoint/element-array-ephys.git HOST_UID=$(id -u) docker compose -f docs/docker-compose.yaml up --build
1+
# MODE="LIVE|QA|PUSH" PACKAGE=element_array_ephys UPSTREAM_REPO=https://github.com/datajoint/element-array-ephys.git HOST_UID=$(id -u) docker compose -f docs/docker-compose.yaml up --build
22
#
33
# navigate to http://localhost/
44
version: "2.4"
@@ -14,27 +14,39 @@ services:
1414
- PACKAGE
1515
- UPSTREAM_REPO
1616
- MODE
17+
- GOOGLE_ANALYTICS_KEY
18+
- PATCH_VERSION
1719
volumes:
18-
- ..:/main
20+
- ../docs:/main/docs
21+
- ../${PACKAGE}:/main/${PACKAGE}
1922
user: ${HOST_UID}:anaconda
2023
ports:
2124
- 80:80
2225
command:
2326
- sh
2427
- -c
2528
- |
29+
git config --global --add safe.directory /main
2630
set -e
31+
export PATCH_VERSION=$$(cat /main/$${PACKAGE}/version.py | grep -oE '\d+\.\d+\.[a-z0-9]+')
2732
if echo "$${MODE}" | grep -i live &>/dev/null; then
2833
mkdocs serve --config-file ./docs/mkdocs.yaml -a 0.0.0.0:80
29-
elif echo "$${MODE}" | grep -iE "qa|build" &>/dev/null; then
34+
elif echo "$${MODE}" | grep -iE "qa|push" &>/dev/null; then
35+
echo "INFO::Delete gh-pages branch"
3036
git branch -D gh-pages || true
31-
git fetch $${UPSTREAM_REPO} gh-pages:gh-pages || true
37+
echo "INFO::Fetch upstream gh-pages"
38+
git fetch $${UPSTREAM_REPO} gh-pages:gh-pages && git switch gh-pages || git switch --orphan gh-pages && git commit --allow-empty -m "init commit"
39+
echo "INFO::mike"
3240
mike deploy --config-file ./docs/mkdocs.yaml -u $$(grep -oE '\d+\.\d+' /main/$${PACKAGE}/version.py) latest
3341
mike set-default --config-file ./docs/mkdocs.yaml latest
3442
if echo "$${MODE}" | grep -i qa &>/dev/null; then
3543
mike serve --config-file ./docs/mkdocs.yaml -a 0.0.0.0:80
44+
elif echo "$${MODE}" | grep -i push &>/dev/null; then
45+
echo "INFO::Push gh-pages to upstream"
46+
git push $${UPSTREAM_REPO} gh-pages
3647
fi
3748
else
3849
echo "Unexpected mode..."
3950
exit 1
4051
fi
52+

0 commit comments

Comments
 (0)