From 1775d389046dc9f313d5dc59e7533b3c9a963f53 Mon Sep 17 00:00:00 2001 From: Thinh Nguyen Date: Tue, 28 Nov 2023 10:40:54 -0600 Subject: [PATCH 1/3] Update .gitignore --- .gitignore | 138 +++++++++++++++++++++++++---------------------------- 1 file changed, 64 insertions(+), 74 deletions(-) diff --git a/.gitignore b/.gitignore index 27ae774..e1522db 100644 --- a/.gitignore +++ b/.gitignore @@ -1,87 +1,77 @@ -# Byte-compiled / optimized / DLL files -__pycache__/ +# Temporary and binary files +*~ *.py[cod] -*$py.class +*.so +*.cfg +!.isort.cfg +!setup.cfg +*.orig +*.log +*.pot +**/__pycache__ +.cache/* +.*.swp +*/.ipynb_checkpoints/* +.DS_Store +.mypy_cache/* -# Distribution, packaging, PyInstaller -.Python -env/ -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -*.egg-info/ -.installed.cfg +# Project files +.ropeproject +.project +.pydevproject +.settings +.idea +.vscode +tags +profile_default/ +ipython_config.py + +# Package files *.egg -*.manifest -*.spec -pip-log.txt -pip-delete*.txt +*.eggs/ +.installed.cfg +*.egg-info +environment.lock.yml -# Unit test / coverage reports -htmlcov/ -.tox/ +# Unittest and coverage +htmlcov/* .coverage .coverage.* -.cache -nosetests.xml +.tox/* +.nox/* +junit*.xml coverage.xml -*.cover -.hypothesis/ -.pytest_cache/ +.pytest_cache/* -# C extension, Translations -*.so -*.mo -*.pot +# Build and docs folder/files +build/* +site/* +dist/* +sdist/* +docs/api/* +docs/_rst/* +docs/_build/* +cover/* +MANIFEST -# editors: vscode, emacs, Mac -.vscode -**/*~ -**/#*# -**/.#* -.DS_Store +# Per-project virtualenvs +.venv*/ +.conda*/ -# Django, Flask, Scrapy, Sphinx, mkdocs -# PyBuilder, Jupyter, SageMath, celery beat -*.log -local_settings.py -instance/ -.webassets-cache -.scrapy -scratchpaper.* -docs/_build/ -/site -target/ -.ipynb_checkpoints -celerybeat-schedule -*.sage.py +# Configuration files +*.env -# dotenv, virtualenv, pyenv, mypy -./.env -.venv -venv/ -ENV/ -.python-version -.mypy_cache/ - -# Spyder/Rope project settings -.spyderproject -.spyproject -.ropeproject - -# datajoint, notes, nwb export +# DataJoint files dj_local_c*.json -temp* -*nwb +dj_remote_c*.json +.datajoint_config.json + +# Misc files/folders +pyproject.code-workspace +scratch/* +src/deangelis_lab/experimental/* +.junk/* -# mkdocs documentation -docs/site +# Secret keys +*.ssh +*.pem From 72bf262b045e22403a7fb8763901a8b1e94dc322 Mon Sep 17 00:00:00 2001 From: Thinh Nguyen Date: Tue, 28 Nov 2023 10:41:10 -0600 Subject: [PATCH 2/3] added table for `Species` --- element_animal/export/nwb.py | 3 ++- element_animal/subject.py | 29 +++++++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/element_animal/export/nwb.py b/element_animal/export/nwb.py index 167995f..95997e7 100644 --- a/element_animal/export/nwb.py +++ b/element_animal/export/nwb.py @@ -16,6 +16,7 @@ def subject_to_nwb(session_key: dict): pynwb.file.Subject: NWB object """ subject_query = subject.Subject & session_key + subject_query = subject_query.join(subject.Subject.Species, left=True) subject_query = subject_query.join(subject.Subject.Line, left=True) subject_query = subject_query.join(subject.Subject.Strain, left=True) subject_query = subject_query.join(subject.Subject.Source, left=True) @@ -29,7 +30,7 @@ def subject_to_nwb(session_key: dict): datetime.strptime("00:00:00", "%H:%M:%S").time(), ), description=json.dumps(subject_info, default=str), - species=str((subject.Line & subject_query).fetch("species")), + species=str((subject.Species & subject_query).fetch("species")), genotype=" x ".join( (subject.Line.Allele * subject.Subject.Line & subject_query).fetch("allele") ), diff --git a/element_animal/subject.py b/element_animal/subject.py index 35034ee..c5d6546 100644 --- a/element_animal/subject.py +++ b/element_animal/subject.py @@ -53,6 +53,19 @@ def activate( ) +@schema +class Species(dj.Lookup): + """Animal species + + Attributes: + species ( varchar(64) ): Animal species, Latin name preferred for NWB export + """ + + definition = """ # Animal species + species: varchar(64) # Animal species, Latin name preferred for NWB export + """ + + @schema class Strain(dj.Lookup): """Genetic strain of an animal. (e.g. C57Bl/6). @@ -112,7 +125,6 @@ class Line(dj.Lookup): Attributes: line ( varchar(32) ): Abbreviated name for the line. - species ( varchar(64) ): Latin name preferred for NWB export. line_description ( varchar(2000) ): Optional. Description of the line. target_phenotype ( varchar(255) ): Optional. Targeted gene phenotype. is_active (boolean) : Whether the line is in active breeding. @@ -121,7 +133,6 @@ class Line(dj.Lookup): definition = """ line : varchar(32) # abbreviated name for the line --- - species='' : varchar(64) # Latin name preferred for NWB export line_description='' : varchar(2000) target_phenotype='' : varchar(255) is_active : boolean # whether the line is in active breeding @@ -188,6 +199,20 @@ class User(dj.Part): -> User """ + class Species(dj.Part): + """Species of the subject. + + Attributes: + Subject (foreign key): Subject key. + Species (foreign key): Species key. + """ + + definition = """ + -> master + --- + -> Species + """ + class Line(dj.Part): """Genetic line of the subject. From e24320adbf1aacff740f18e5972a8c4ba716d812 Mon Sep 17 00:00:00 2001 From: Thinh Nguyen Date: Tue, 28 Nov 2023 10:42:45 -0600 Subject: [PATCH 3/3] update changelog, bump version --- CHANGELOG.md | 4 ++++ element_animal/version.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a2e994..cdb23d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) convention. +## [0.2.1] - 2023-11-28 ++ Add - `Species` table in `subject` schema + ## [0.2.0] - 2023-08-23 + Add - `injection` schema @@ -63,6 +66,7 @@ Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and + Add - `subject` schema + Add - `genotyping` schema +[0.2.1]: https://github.com/datajoint/element-animal/releases/tag/0.2.1 [0.2.0]: https://github.com/datajoint/element-animal/releases/tag/0.2.0 [0.1.8]: https://github.com/datajoint/element-animal/releases/tag/0.1.8 [0.1.7]: https://github.com/datajoint/element-animal/releases/tag/0.1.7 diff --git a/element_animal/version.py b/element_animal/version.py index 8667345..7e30021 100644 --- a/element_animal/version.py +++ b/element_animal/version.py @@ -1,2 +1,2 @@ """Package metadata.""" -__version__ = "0.2.0" +__version__ = "0.2.1"