Skip to content

Commit

Permalink
Merge pull request #46 from ttngu207/main
Browse files Browse the repository at this point in the history
added table for Species
  • Loading branch information
kushalbakshi authored Nov 30, 2023
2 parents a609e49 + e24320a commit c1cbd67
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 78 deletions.
138 changes: 64 additions & 74 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion element_animal/export/nwb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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")
),
Expand Down
29 changes: 27 additions & 2 deletions element_animal/subject.py
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion element_animal/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
"""Package metadata."""
__version__ = "0.2.0"
__version__ = "0.2.1"

0 comments on commit c1cbd67

Please sign in to comment.