<jupyter_start><jupyter_text>Subject Related Data `CB DEV NOTES`1. Some table structures and data types changed for pyrat ingestion2. The GUI didn't work for me. Maybe an error on my end.  LoginEither log in via a local config file (see [01_pipeline](./01_pipeline.ipynb)), or enter login information manually. If you are don't have your login information, contact the administrator.<jupyter_code># Local Config
import os
if os.path.basename(os.getcwd())=='notebooks': os.chdir('..')
assert os.path.basename(os.getcwd())=='adamacs', ("Please move to the main directory")
import datajoint as dj; dj.conn()
# Manual Entry
import datajoint as dj; import getpass
dj.config['database.host'] = '172.26.128.53'        # Put the server name between these apostrophe
dj.config['database.user'] = 'danielmk'             # Put your user name between these apostrophe
dj.config['database.password'] = <PASSWORD>()  # Put your password in the prompt
dj.conn()<jupyter_output>Connecting danielmk@172.26.128.53:3306<jupyter_text>ActivationNext, import from `adamacs.pipeline` to activate the relevant schema.<jupyter_code>from adamacs.utility import *
from adamacs.nbgui import *
from adamacs.pipeline import subject<jupyter_output><empty_output><jupyter_text>Assign easy names for relevant tables<jupyter_code>sub, lab, protocol, line, mutation, user, project, subject_genotype, subject_death = (
    subject.Subject(), subject.Lab(), subject.Protocol(), subject.Line(), 
    subject.Mutation(), subject.User(), subject.Project(), subject.SubjectGenotype(), 
    subject.SubjectDeath()
    )<jupyter_output><empty_output><jupyter_text>Entry via GUI<jupyter_code>"""Run this cell to load the subject entry sheet."""
mouse_gui = MouseEntrySheet()
mouse_gui.app<jupyter_output><empty_output><jupyter_text>Entry via `insert()` **WARNING** Only run these manual entry cells if you know what you are doing!Strings for these values may be edited to insert single rows into corresponding tables. Lab<jupyter_code>lab_key = 'Beck'  # Short, unique identifier for the lab. Maximum 8 characters. Example: 'Rose'.
lab_name = 'Neuronal input-output computation during cognition'  # A longer, more descriptive name for the laboratory.
institution = 'Institute for Experimental Epileptology and Cognition Research'  # The institution the laboratory belongs to.
address = 'Venusberg-Campus 1, 53127 Bonn'  # The postal address of the laboratory.

lab.insert1((lab_key, lab_name, institution, address))<jupyter_output><empty_output><jupyter_text>Protocol<jupyter_code>protocol_key = 'LANUF3'  # Short, unique identifier for the protocol. Maximum 16 characters.
protocol_description = 'Another dummy protocol ID for testing purposes'  # Description of the protocol.

protocol.insert1((protocol_key, protocol_description))<jupyter_output><empty_output><jupyter_text>User Entry<jupyter_code># insert multiple entries
data = [{'user_id': 1, 'name': 'natashak', 'lab': lab_key},
        {'user_id': 2, 'name': 'georgejk', 'lab': lab_key}]
user.insert(data)<jupyter_output><empty_output><jupyter_text>Line/Mutation<jupyter_code>line_id = 1  # Unique identifier for the line.
line_name = 'Gcamp6-ThyC57BL/6J-Tg(Thy1-GCaMP6s)GP4.12Dkim/J'  # Description of the line.
is_active = 1  # Whether or not the line is actively breeding.

mutation_id = 2  # Unique identifier for the mutation.
mutation_description = 'Tg(Thy1-GCaMP6s)GP4.12Dkim'  # A description of the mutation.

line.insert1((line_id, line_name, is_active))
mutation.insert1((line_id, mutation_id, mutation_description))<jupyter_output><empty_output><jupyter_text>Subject<jupyter_code>subject_id = 'WEZ-8701'
earmark = 'G155'
sex = 'M'
birth_date = '2010-08-20'
subject_description = 'Basic Mouse'
generation = 'F2'
parents = {'m': 'Rose_ROS-0001', 'f' : 'Rose_ROS-0002'}
owner_id = 1
responsible_id = 2
line_id = 1
protocol_key = 'LANUF3'

sub.insert1((subject_id, earmark, sex, birth_date, subject_description, generation, 
             parents, owner_id, responsible_id, line_id, protocol_key))<jupyter_output><empty_output><jupyter_text>Subject Genotype<jupyter_code>subject = 'WEZ-8701'
line_id = 1
mutation_id = 2  # Unique identifier for the mutation.
genotype = 'wt/tg'  # The target phenotype of the line.

subject_genotype.insert1((subject, line_id, mutation_id, genotype))<jupyter_output><empty_output><jupyter_text>Project Entry<jupyter_code>project_key = 'TEC'
project_description = 'Trace Eyeblink Conditioning'

project.insert1((project_key, project_description))<jupyter_output><empty_output><jupyter_text>Subject Death<jupyter_code>subject = 'WEZ-8701'
death_date = '2010-12-01'
case = 'natural'

subject_death.insert1((subject, death_date, case))<jupyter_output><empty_output><jupyter_text>Fetch  As table<jupyter_code>user * lab
sub
line * subject_genotype
subject_genotype<jupyter_output><empty_output><jupyter_text>As dictionary One item:<jupyter_code>(sub & 'subject="Rose_ROS-0019"').fetch1()<jupyter_output><empty_output><jupyter_text>List of dictionaries:<jupyter_code>(subject_genotype & 'subject="Rose_ROS-0019"').fetch(as_dict=True)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11404538341158059, 'fraction_numerical': 0.023865414710485134, 'mean_word_length': 6.677177177177177, 'pattern_counts': {'":': 0, '<': 61, '<?xml version=': 0, '>': 61, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '15', 'dir': 'jupyter-structured-clean-dedup', 'id': '513870', 'license': 'MIT', 'n_tokens_mistral': 1807, 'n_tokens_neox': 1669, 'n_words': 422, 'path': 'notebooks/02_manual_insert.ipynb', 'repo_name': 'vathes/adamacs', 'size': '5117'}