Skip to content

Commit 2e87c49

Browse files
authored
Merge pull request #3 from MilagrosMarin/main
Pipeline Architecture Refinement and Enhancement
2 parents 1dea4e4 + 83c68d5 commit 2e87c49

23 files changed

+3073
-2967
lines changed

.devcontainer/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ ENV DJ_HOST fakeservices.datajoint.io
4444
ENV DJ_USER root
4545
ENV DJ_PASS simple
4646

47-
ENV KPMS_ROOT_DATA_DIR /workspaces/element-moseq/example_data/inbox
48-
ENV KPMS_ROOT_OUTPUT_DIR /workspaces/element-moseq/example_data/outbox
47+
ENV DATA_MOUNTPOINT /workspaces/element-moseq/example_data
48+
ENV KPMS_ROOT_DATA_DIR $DATA_MOUNTPOINT/inbox
49+
ENV KPMS_PROCESSED_DATA_DIR $DATA_MOUNTPOINT/outbox
4950
ENV DATABASE_PREFIX neuro_
5051

5152
USER vscode

.devcontainer/devcontainer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"remoteEnv": {
77
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}"
88
},
9-
"onCreateCommand": "mkdir -p ${KPMS_ROOT_DATA_DIR} && pip install -e .",
10-
"postStartCommand": "docker volume prune -f && s3fs ${DJ_PUBLIC_S3_LOCATION} ${KPMS_ROOT_DATA_DIR} -o nonempty,multipart_size=530,endpoint=us-east-1,url=http://s3.amazonaws.com,public_bucket=1",
9+
"onCreateCommand": "mkdir -p ${DATA_MOUNTPOINT} && pip install -e .",
10+
"postStartCommand": "docker volume prune -f && s3fs ${DJ_PUBLIC_S3_LOCATION} ${DATA_MOUNTPOINT} -o nonempty,multipart_size=530,endpoint=us-east-1,url=http://s3.amazonaws.com,public_bucket=1",
1111
"hostRequirements": {
1212
"cpus": 4,
1313
"memory": "8gb",

.github/workflows/release.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@ on:
44
jobs:
55
make_github_release:
66
uses: datajoint/.github/.github/workflows/make_github_release.yaml@main
7-
pypi_release:
8-
needs: make_github_release
9-
uses: datajoint/.github/.github/workflows/pypi_release.yaml@main
10-
secrets:
11-
TWINE_USERNAME: ${{secrets.TWINE_USERNAME}}
12-
TWINE_PASSWORD: ${{secrets.TWINE_PASSWORD}}
13-
with:
14-
UPLOAD_URL: ${{needs.make_github_release.outputs.release_upload_url}}
157
mkdocs_release:
168
uses: datajoint/.github/.github/workflows/mkdocs_release.yaml@main
179
permissions:

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,20 @@
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.1] - 2024-03-21
7+
8+
+ Update - Schemas and tables renaming
9+
+ Update - Move `PreFit` and `FullFit` to `moseq_train`
10+
+ Update - Additional attributes and data type modification from `time` to `float` for `duration` to eliminate datetime formatting code
11+
+ Update - Code refactoring in `make` functions and enhanced path handling
12+
+ Update - `docs`, docstrings and table definitions
13+
+ Update - `tutorial.ipynb` according to these changes and verify full functionality with Codespaces
14+
+ Update - pipeline `images` according to these changes
15+
+ Fix - `Dockerfile` environment variables
16+
+ Update - Activation of one schema with two modules by updating `tutorial_pipeline.ipynb`
17+
+ Update - remove PyPI release from `release.yml`
18+
+ Update - README
19+
620
## [0.1.0] - 2024-03-20
721

822
+ Add - `CHANGELOG` and version for first release

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ DataJoint Elements collectively standardize and automate data collection and ana
1919
+ Clone the repository to your computer.
2020

2121
```bash
22-
git clone https://github.com/<enter_github_username>/element-moseq
22+
git clone https://github.com/<enter_github_username>/element-moseq.git
2323
```
2424

2525
+ Install with `pip`:
@@ -72,4 +72,4 @@ MYSQL_VER=8.0 docker compose -f docker-compose-db.yaml up --build -d
7272

7373
1. We recommend you start by navigating to the `notebooks` directory on the left panel and go through the `tutorial.ipynb` Jupyter notebook. Execute the cells in the notebook to begin your walkthrough of the tutorial.
7474

75-
1. Once you are done, see the options available to you in the menu in the bottom-left corner. For example, in Codespace you will have an option to `Stop Current Codespace` but when running Dev Container on your own machine the equivalent option is `Reopen folder locally`. By default, GitHub will also automatically stop the Codespace after 30 minutes of inactivity. Once the Codespace is no longer being used, we recommend deleting the Codespace.
75+
2. Once you are done, see the options available to you in the menu in the bottom-left corner. For example, in Codespace you will have an option to `Stop Current Codespace` but when running Dev Container on your own machine the equivalent option is `Reopen folder locally`. By default, GitHub will also automatically stop the Codespace after 30 minutes of inactivity. Once the Codespace is no longer being used, we recommend deleting the Codespace.

docs/src/citation.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,9 @@ If your work uses the following resources, please cite the respective manuscript
1010
+ [RRID:SCR_021894](https://scicrunch.org/resolver/SCR_021894)
1111

1212
+ Keypoint-MoSeq
13-
+ [Manuscripts](https://www.biorxiv.org/content/10.1101/2023.03.16.532307v2.full.pdf)
13+
+ Weinreb C, Pearl J, Lin S, Osman MAM, Zhang L, Annapragada S, Conlin E, Hoffman R,
14+
Makowska S, Gillis WF and Jay M. Keypoint-MoSeq: parsing behavior by linking point
15+
tracking to pose dynamics. BioRxiv. 2023 Dec 23. doi: https://doi.org/10.1101/2023.03.16.532307
16+
+ Wiltschko AB, Johnson MJ, Iurilli G, Peterson RE, Katon JM, Pashkovski SL, Abraira VE,
17+
Adams RP, Datta SR. Mapping sub-second structure in mouse behavior. Neuron. 2015 Dec 16;
18+
88(6):1121-35.

docs/src/concepts.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,4 @@ Key features include:
2323
- Loading and formatting of 2D deeplabcut keypoint tracking data for model training
2424
- Queue management and initiation of Keypoint-MoSeq analysis across multiple sessions
2525
- Ingestion of analysis outcomes such as PCA, AR-HMM, and Keypoint-SLDS components
26-
- Ingestion of analysis outcomes from motion sequencing inference
27-
28-
26+
- Ingestion of analysis outcomes from motion sequencing inference

docs/src/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
DataJoint Element for Motion Sequencing with
44
[Keypoint-MoSeq](https://github.com/dattalab/keypoint-moseq){:target="_blank"},
5-
from keypoint data extracted with [DeepLabCut](x){:target="_blank"}. DataJoint Elements collectively standardize and automate
5+
from keypoint data extracted with [DeepLabCut](http://www.mackenziemathislab.org/deeplabcut){:target="_blank"}.
6+
DataJoint Elements collectively standardize and automate
67
data collection and analysis for neuroscience experiments. Each Element is a modular
78
pipeline for data storage and processing with corresponding database tables that can be
89
combined with other Elements to assemble a fully functional pipeline.

docs/src/partnerships.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Key partnerships
22

3-
Element MoSeq was developed in collaboration with the [Keypoint-MoSeq developers](https://github.com/dattalab/keypoint-moseq) in Datta's Lab at Harvard Medical School to promote integration and interoperability between Keypoint-MoSeq and the DataJoint Element MoSeq.
3+
Element MoSeq was developed in collaboration with the [Keypoint-MoSeq developers](https://github.com/dattalab/keypoint-moseq), particularly with Kai Fox from Datta's Lab at Harvard Medical School, to foster integration and interoperability between Keypoint-MoSeq and the DataJoint Element MoSeq.

docs/src/pipeline.md

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@ corresponding table in the database. Within the pipeline, Element MoSeq
55
connects to upstream Elements including Lab, Animal, Session, and Event. For more
66
detailed documentation on each table, see the API docs for the respective schemas.
77

8-
The Element is composed of two main schemas, `kpms_pca` and `kpms_model`. The `kpms_pca` schema is designed to handle the analysis and ingestion of PCA model for formatted keypoint tracking. The `kpms_model` schema is designed to handle the analysis and ingestion of Keypoint-MoSeq's motion sequencing on video recordings.
8+
The Element is composed of two main schemas, `moseq_train` and `moseq_infer`. The `moseq_train` schema is designed to handle the analysis and ingestion of PCA model for formatted keypoint tracking and train the Kepoint-MoSeq model. The `moseq_infer` schema is designed to handle the analysis and ingestion of Keypoint-MoSeq's motion sequencing on video recordings by using one registered model.
99

1010
## Diagrams
1111

12-
### `kpms_pca` module
12+
### `moseq_train` module
1313

14-
- The `kpms_pca` schema is designed to handle the analysis and ingestion of a PCA model for formatted keypoint tracking.
14+
- The `moseq_train` schema is designed to handle the analysis and ingestion of PCA model for formatted keypoint tracking and train the Kepoint-MoSeq model.
1515

16-
![pipeline](https://raw.githubusercontent.com/datajoint/element-moseq/main/images/pipeline_kpms_pca.svg)
16+
![pipeline](https://raw.githubusercontent.com/datajoint/element-moseq/main/images/pipeline_moseq_train.svg)
1717

18-
### `kpms_model` module
18+
### `moseq_infer` module
1919

20-
- The `kpms_model` schema is designed to handle the analysis and ingestion of Keypoint-MoSeq's motion sequencing on video recordings.
20+
- The `moseq_infer` schema is designed to handle the analysis and ingestion of Keypoint-MoSeq's motion sequencing on video recordings by using one registered model.
2121

22-
![pipeline](https://raw.githubusercontent.com/datajoint/element-moseq/main/images/pipeline_kpms_model.svg)
22+
![pipeline](https://raw.githubusercontent.com/datajoint/element-moseq/main/images/pipeline_moseq_infer.svg)
2323

2424
## Table Descriptions
2525

@@ -49,36 +49,35 @@ The Element is composed of two main schemas, `kpms_pca` and `kpms_model`. The `k
4949
| --- | --- |
5050
| Session | Unique experimental session identifier |
5151

52-
### `kpms_pca` schema
52+
### `model_train` schema
5353

54-
- For further details see the [kpms_pca schema API docs](https://datajoint.com/docs/elements/element-moseq/latest/api/element_moseq/kpms_pca/)
54+
- For further details see the [`model_train` schema API docs](https://datajoint.com/docs/elements/element-moseq/latest/api/element_moseq/model_train/)
5555

5656
| Table | Description |
5757
| --- | --- |
58-
| PoseEstimationMethod | Table to store the pose estimation methods supported by the keypoint loader of `keypoint-moseq` package. |
59-
| KeypointSet | Table to store the keypoint data and video set directory to train the model.|
60-
| KeypointSet.VideoFile | IDs and file paths of each video file that will be used to train the model.|
61-
| Bodyparts | Table to store the body parts to use in the analysis.|
58+
| KeypointSet | Store keypoint data and video set directory for model training.|
59+
| KeypointSet.VideoFile | IDs and file paths of each video file that will be used for model training. |
60+
| Bodyparts | Store the body parts to use in the analysis. |
6261
| PCATask | Staging table to define the PCA task and its output directory. |
63-
| LoadKeypointSet | Table to create the `kpms_project_output_dir`, and create and update the `config.yml` by creating a new `dj_config.yml`. |
64-
| PCAFitting | Automated fitting of the PCA model.|
65-
| LatentDimension | Automated computation to calculate the latent dimension as one of the autoregressive hyperparameters (`ar_hypparams`) necessary for the model fitting. |
62+
| PCAPrep | Setup the Keypoint-MoSeq project output directory (`kpms_project_output_dir`) creating the default `config.yml` and updating it in a new `dj_config.yml`. |
63+
| PCAFit | Fit PCA model.|
64+
| LatentDimension | Calculate the latent dimension as one of the autoregressive hyperparameters (`ar_hypparams`) necessary for the model fitting. |
65+
| PreFitTask | Specify parameters for model (AR-HMM) pre-fitting. |
66+
| PreFit | Fit AR-HMM model. |
67+
| FullFitTask | Specify parameters for the model full-fitting. |
68+
| FullFit | Fit the full (Keypoint-SLDS) model. |
6669

70+
### `moseq_infer` schema
6771

68-
### `kpms_model` schema
69-
70-
- For further details see the [kpms_model schema API docs](https://datajoint.com/docs/elements/element-moseq/latest/api/element_moseq/kpms_model/)
72+
- For further details see the [`moseq_infer` schema API docs](https://datajoint.com/docs/elements/element-moseq/latest/api/element_moseq/moseq_infer/)
7173

7274
| Table | Description |
7375
| --- | --- |
74-
| PreFittingTask | Table to specify the parameters for the pre-fitting (AR-HMM) of the model. |
75-
| PreFitting | Automated computation to fit a AR-HMM model. |
76-
| FullFittingTask | Table to specify the parameters for the full fitting of the model. The full model will generally require a lower value of kappa to yield the same target syllable durations. |
77-
| FullFitting | Automated computation to fit the full model. |
78-
| Model | Table to register the models. |
76+
| Model | Register a model. |
7977
| VideoRecording | Set of video recordings for the Keypoint-MoSeq inference. |
8078
| VideoRecording.File | File IDs and paths associated with a given `recording_id`. |
81-
| InferenceTask | Table to specify the model, the video set, and the output directory for the inference task. |
82-
| Inference | This table is used to infer the model results from the checkpoint file and save them to `{output_dir}/{model_name}/{inference_output_dir}/results.h5`. |
83-
| Inference.MotionSequence | This table is used to store the results of the model inference.|
84-
| Inference.GridMoviesSampledInstances | This table is used to store the grid movies sampled instances.|
79+
| PoseEstimationMethod | Pose estimation methods supported by the keypoint loader of `keypoint-moseq` package. |
80+
| InferenceTask | Staging table to define the Inference task and its output directory. |
81+
| Inference | Infer the model from the checkpoint file and save the results as `results.h5` file. |
82+
| Inference.MotionSequence | Results of the model inference. |
83+
| Inference.GridMoviesSampledInstances | Store the sampled instances of the grid movies. |

0 commit comments

Comments
 (0)