Skip to content

Commit c1cbd67

Browse files
authored
Merge pull request #46 from ttngu207/main
added table for Species
2 parents a609e49 + e24320a commit c1cbd67

File tree

5 files changed

+98
-78
lines changed

5 files changed

+98
-78
lines changed

.gitignore

Lines changed: 64 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,77 @@
1-
# Byte-compiled / optimized / DLL files
2-
__pycache__/
1+
# Temporary and binary files
2+
*~
33
*.py[cod]
4-
*$py.class
4+
*.so
5+
*.cfg
6+
!.isort.cfg
7+
!setup.cfg
8+
*.orig
9+
*.log
10+
*.pot
11+
**/__pycache__
12+
.cache/*
13+
.*.swp
14+
*/.ipynb_checkpoints/*
15+
.DS_Store
16+
.mypy_cache/*
517

6-
# Distribution, packaging, PyInstaller
7-
.Python
8-
env/
9-
build/
10-
develop-eggs/
11-
dist/
12-
downloads/
13-
eggs/
14-
.eggs/
15-
lib/
16-
lib64/
17-
parts/
18-
sdist/
19-
var/
20-
wheels/
21-
*.egg-info/
22-
.installed.cfg
18+
# Project files
19+
.ropeproject
20+
.project
21+
.pydevproject
22+
.settings
23+
.idea
24+
.vscode
25+
tags
26+
profile_default/
27+
ipython_config.py
28+
29+
# Package files
2330
*.egg
24-
*.manifest
25-
*.spec
26-
pip-log.txt
27-
pip-delete*.txt
31+
*.eggs/
32+
.installed.cfg
33+
*.egg-info
34+
environment.lock.yml
2835

29-
# Unit test / coverage reports
30-
htmlcov/
31-
.tox/
36+
# Unittest and coverage
37+
htmlcov/*
3238
.coverage
3339
.coverage.*
34-
.cache
35-
nosetests.xml
40+
.tox/*
41+
.nox/*
42+
junit*.xml
3643
coverage.xml
37-
*.cover
38-
.hypothesis/
39-
.pytest_cache/
44+
.pytest_cache/*
4045

41-
# C extension, Translations
42-
*.so
43-
*.mo
44-
*.pot
46+
# Build and docs folder/files
47+
build/*
48+
site/*
49+
dist/*
50+
sdist/*
51+
docs/api/*
52+
docs/_rst/*
53+
docs/_build/*
54+
cover/*
55+
MANIFEST
4556

46-
# editors: vscode, emacs, Mac
47-
.vscode
48-
**/*~
49-
**/#*#
50-
**/.#*
51-
.DS_Store
57+
# Per-project virtualenvs
58+
.venv*/
59+
.conda*/
5260

53-
# Django, Flask, Scrapy, Sphinx, mkdocs
54-
# PyBuilder, Jupyter, SageMath, celery beat
55-
*.log
56-
local_settings.py
57-
instance/
58-
.webassets-cache
59-
.scrapy
60-
scratchpaper.*
61-
docs/_build/
62-
/site
63-
target/
64-
.ipynb_checkpoints
65-
celerybeat-schedule
66-
*.sage.py
61+
# Configuration files
62+
*.env
6763

68-
# dotenv, virtualenv, pyenv, mypy
69-
./.env
70-
.venv
71-
venv/
72-
ENV/
73-
.python-version
74-
.mypy_cache/
75-
76-
# Spyder/Rope project settings
77-
.spyderproject
78-
.spyproject
79-
.ropeproject
80-
81-
# datajoint, notes, nwb export
64+
# DataJoint files
8265
dj_local_c*.json
83-
temp*
84-
*nwb
66+
dj_remote_c*.json
67+
.datajoint_config.json
68+
69+
# Misc files/folders
70+
pyproject.code-workspace
71+
scratch/*
72+
src/deangelis_lab/experimental/*
73+
.junk/*
8574

86-
# mkdocs documentation
87-
docs/site
75+
# Secret keys
76+
*.ssh
77+
*.pem

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
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.2.1] - 2023-11-28
7+
+ Add - `Species` table in `subject` schema
8+
69
## [0.2.0] - 2023-08-23
710

811
+ Add - `injection` schema
@@ -63,6 +66,7 @@ Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and
6366
+ Add - `subject` schema
6467
+ Add - `genotyping` schema
6568

69+
[0.2.1]: https://github.com/datajoint/element-animal/releases/tag/0.2.1
6670
[0.2.0]: https://github.com/datajoint/element-animal/releases/tag/0.2.0
6771
[0.1.8]: https://github.com/datajoint/element-animal/releases/tag/0.1.8
6872
[0.1.7]: https://github.com/datajoint/element-animal/releases/tag/0.1.7

element_animal/export/nwb.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def subject_to_nwb(session_key: dict):
1616
pynwb.file.Subject: NWB object
1717
"""
1818
subject_query = subject.Subject & session_key
19+
subject_query = subject_query.join(subject.Subject.Species, left=True)
1920
subject_query = subject_query.join(subject.Subject.Line, left=True)
2021
subject_query = subject_query.join(subject.Subject.Strain, left=True)
2122
subject_query = subject_query.join(subject.Subject.Source, left=True)
@@ -29,7 +30,7 @@ def subject_to_nwb(session_key: dict):
2930
datetime.strptime("00:00:00", "%H:%M:%S").time(),
3031
),
3132
description=json.dumps(subject_info, default=str),
32-
species=str((subject.Line & subject_query).fetch("species")),
33+
species=str((subject.Species & subject_query).fetch("species")),
3334
genotype=" x ".join(
3435
(subject.Line.Allele * subject.Subject.Line & subject_query).fetch("allele")
3536
),

element_animal/subject.py

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,19 @@ def activate(
5353
)
5454

5555

56+
@schema
57+
class Species(dj.Lookup):
58+
"""Animal species
59+
60+
Attributes:
61+
species ( varchar(64) ): Animal species, Latin name preferred for NWB export
62+
"""
63+
64+
definition = """ # Animal species
65+
species: varchar(64) # Animal species, Latin name preferred for NWB export
66+
"""
67+
68+
5669
@schema
5770
class Strain(dj.Lookup):
5871
"""Genetic strain of an animal. (e.g. C57Bl/6).
@@ -112,7 +125,6 @@ class Line(dj.Lookup):
112125
113126
Attributes:
114127
line ( varchar(32) ): Abbreviated name for the line.
115-
species ( varchar(64) ): Latin name preferred for NWB export.
116128
line_description ( varchar(2000) ): Optional. Description of the line.
117129
target_phenotype ( varchar(255) ): Optional. Targeted gene phenotype.
118130
is_active (boolean) : Whether the line is in active breeding.
@@ -121,7 +133,6 @@ class Line(dj.Lookup):
121133
definition = """
122134
line : varchar(32) # abbreviated name for the line
123135
---
124-
species='' : varchar(64) # Latin name preferred for NWB export
125136
line_description='' : varchar(2000)
126137
target_phenotype='' : varchar(255)
127138
is_active : boolean # whether the line is in active breeding
@@ -188,6 +199,20 @@ class User(dj.Part):
188199
-> User
189200
"""
190201

202+
class Species(dj.Part):
203+
"""Species of the subject.
204+
205+
Attributes:
206+
Subject (foreign key): Subject key.
207+
Species (foreign key): Species key.
208+
"""
209+
210+
definition = """
211+
-> master
212+
---
213+
-> Species
214+
"""
215+
191216
class Line(dj.Part):
192217
"""Genetic line of the subject.
193218

element_animal/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
"""Package metadata."""
2-
__version__ = "0.2.0"
2+
__version__ = "0.2.1"

0 commit comments

Comments
 (0)