Skip to content

genotyping.py

activate(genotyping_schema_name, subject_schema_name=None, create_schema=True, create_tables=True, linking_module=None)

Activate this schema.

Parameters:

Name Type Description Default
genotyping_schema_name str

schema name on the database server to activate the genotyping element.

required
subject_schema_name str

schema name on the database server to activate the subject element

None
create_schema bool

when True (default), create schema in the database if it does not yet exist.

True
create_tables bool

when True (default), create tables in the database if they do not yet exist.

True
linking_module bool

a module name or a module containing the

None
required dependencies to activate the `subject` element
required

Dependencies:

Upstream tables

Source: The source of the material/resources (e.g. allele, animal) - typically refers to the vendor (e.g. Jackson Lab - JAX). Lab: The lab for which a particular animal belongs to. Protocol: The protocol applicable to a particular animal (e.g. IACUC, IRB). User: The user associated with a particular animal.

Source code in element_animal/genotyping.py
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
def activate(
    genotyping_schema_name,
    subject_schema_name=None,
    create_schema=True,
    create_tables=True,
    linking_module=None,
):
    """Activate this schema.

    Args:
        genotyping_schema_name (str): schema name on the database server to
                                    activate the `genotyping` element.
        subject_schema_name (str): schema name on the database server to
                                activate the `subject` element
        create_schema (bool, optional): when True (default), create schema in the
                            database if it does not yet exist.
        create_tables (bool, optional): when True (default), create tables in the
                            database if they do not yet exist.
        linking_module (bool, optional): a module name or a module containing the
        required dependencies to activate the `subject` element:

    Dependencies:
    Upstream tables:
        Source: The source of the material/resources (e.g. allele, animal) - typically refers to the
                    vendor (e.g. Jackson Lab - JAX).
        Lab: The lab for which a particular animal belongs to.
        Protocol: The protocol applicable to a particular animal (e.g. IACUC, IRB).
        User: The user associated with a particular animal.
    """
    if isinstance(linking_module, str):
        linking_module = importlib.import_module(linking_module)
    assert inspect.ismodule(
        linking_module
    ), "The argument 'linking_module' must be a module's name or a module"

    global _linking_module
    _linking_module = linking_module

    subject.activate(
        subject_schema_name,
        create_schema=create_schema,
        create_tables=create_tables,
        linking_module=linking_module,
    )
    schema.activate(
        genotyping_schema_name,
        create_schema=create_schema,
        create_tables=create_tables,
        add_objects=linking_module.__dict__,
    )

Sequence

Bases: dj.Lookup

Gene sequence information.

Attributes:

Name Type Description
sequence varchar(32)

Abbreviated sequence name

base_pairs varchar(1024)

Base pairs

sequence_desc varchar(255)

Description

Source code in element_animal/genotyping.py
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
@schema
class Sequence(dj.Lookup):
    """Gene sequence information.

    Attributes:
        sequence ( varchar(32) ): Abbreviated sequence name
        base_pairs ( varchar(1024) ): Base pairs
        sequence_desc ( varchar(255) ): Description
    """

    definition = """
    sequence            : varchar(32)   # abbreviated sequence name
    ---
    base_pairs=''       : varchar(1024) # base pairs
    sequence_desc=''    : varchar(255)  # description
    """

AlleleSequence

Bases: dj.Lookup

Allele sequence information.

Attributes:

Name Type Description
subject.Allele foreign key

subject.Allele key.

Sequence varchar(1024)

Sequence key.

Source code in element_animal/genotyping.py
81
82
83
84
85
86
87
88
89
90
91
92
93
@schema
class AlleleSequence(dj.Lookup):
    """Allele sequence information.

    Attributes:
        subject.Allele (foreign key): subject.Allele key.
        Sequence ( varchar(1024) ): Sequence key.
    """

    definition = """
    -> subject.Allele
    -> Sequence
    """

BreedingPair

Bases: dj.Manual

Information about male-female pair used for breeding.

Attributes:

Name Type Description
breeding_pair varchar(24)

Pair identifier.

bp_start_date date

Optional. Start date of breeding.

bp_end_date date

Option. End date of breeding.

bp_description varchar(2048)

Description of the pair.

Source code in element_animal/genotyping.py
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
@schema
class BreedingPair(dj.Manual):
    """Information about male-female pair used for breeding.

    Attributes:
        breeding_pair ( varchar(24) ): Pair identifier.
        bp_start_date (date): Optional. Start date of breeding.
        bp_end_date (date): Option. End date of breeding.
        bp_description ( varchar(2048) ): Description of the pair.
    """

    definition = """
    -> subject.Line
    breeding_pair           : varchar(32)
    ---
    bp_start_date=null      : date
    bp_end_date=null        : date
    bp_description=''       : varchar(2048)
    """

    class Father(dj.Part):
        """Information about male breeder.

        Attributes:
            BreedingPair (foreign key): BreedingPair key.
            subject.Subject (foreign key): subject.Subject key.
        """

        definition = """
        -> master
        ---
        -> subject.Subject.proj(father="subject")
        """

    class Mother(dj.Part):
        """Information about female breeder.

        Attributes:
            BreedingPair (foreign key): BreedingPair key.
            subject.Subject (foreign key): subject.Subject key.
        """

        definition = """
        -> master
        ---
        -> subject.Subject.proj(mother="subject")
        """

Father

Bases: dj.Part

Information about male breeder.

Attributes:

Name Type Description
BreedingPair foreign key

BreedingPair key.

subject.Subject foreign key

subject.Subject key.

Source code in element_animal/genotyping.py
116
117
118
119
120
121
122
123
124
125
126
127
128
class Father(dj.Part):
    """Information about male breeder.

    Attributes:
        BreedingPair (foreign key): BreedingPair key.
        subject.Subject (foreign key): subject.Subject key.
    """

    definition = """
    -> master
    ---
    -> subject.Subject.proj(father="subject")
    """

Mother

Bases: dj.Part

Information about female breeder.

Attributes:

Name Type Description
BreedingPair foreign key

BreedingPair key.

subject.Subject foreign key

subject.Subject key.

Source code in element_animal/genotyping.py
130
131
132
133
134
135
136
137
138
139
140
141
142
class Mother(dj.Part):
    """Information about female breeder.

    Attributes:
        BreedingPair (foreign key): BreedingPair key.
        subject.Subject (foreign key): subject.Subject key.
    """

    definition = """
    -> master
    ---
    -> subject.Subject.proj(mother="subject")
    """

Litter

Bases: dj.Manual

Information about litter (group of animals born to a breeding pair).

Attributes:

Name Type Description
BreedingPair foreign key

BreedingPair key.

litter_birth_date date

Birth date of litter.

num_of_pups tinyint

Number of animals in the litter.

litter_notes varchar(255)

Notes about the litter.

Source code in element_animal/genotyping.py
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
@schema
class Litter(dj.Manual):
    """Information about litter (group of animals born to a breeding pair).

    Attributes:
        BreedingPair (foreign key): BreedingPair key.
        litter_birth_date (date): Birth date of litter.
        num_of_pups (tinyint): Number of animals in the litter.
        litter_notes ( varchar(255) ): Notes about the litter.
    """

    definition = """
    -> BreedingPair
    litter_birth_date       : date
    ---
    num_of_pups             : tinyint
    litter_notes=''         : varchar(255)
    """

Weaning

Bases: dj.Manual

Information about weaning (maternal separation).

Attributes:

Name Type Description
Litter foreign key

Litter key.

weaning_date date

Litter key.

num_of_male tinyint

Number of males.

num_of_female tinyint

Number of females.

weaning_notes varchar(255)

Notes about weaning.

Source code in element_animal/genotyping.py
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
@schema
class Weaning(dj.Manual):
    """Information about weaning (maternal separation).

    Attributes:
        Litter (foreign key): Litter key.
        weaning_date (date): Litter key.
        num_of_male (tinyint): Number of males.
        num_of_female (tinyint): Number of females.
        weaning_notes ( varchar(255) ): Notes about weaning.
    """

    definition = """
    -> Litter
    ---
    weaning_date            : date
    num_of_male             : tinyint
    num_of_female           : tinyint
    weaning_notes=''        : varchar(255)
    """

SubjectLitter

Bases: dj.Manual

Subject and its litter.

Attributes:

Name Type Description
subject.Subject foreign key

subject.Subject key.

Litter foreign key

Litter key.

Source code in element_animal/genotyping.py
187
188
189
190
191
192
193
194
195
196
197
198
199
200
@schema
class SubjectLitter(dj.Manual):
    """Subject and its litter.

    Attributes:
        subject.Subject (foreign key): subject.Subject key.
        Litter (foreign key): Litter key.
    """

    definition = """
    -> subject.Subject
    ---
    -> Litter
    """

Cage

Bases: dj.Lookup

Cage information.

Attributes:

Name Type Description
cage varchar(32)

Cage identifier.

cage_purpose varchar(128)

Cage purpose.

Source code in element_animal/genotyping.py
203
204
205
206
207
208
209
210
211
212
213
214
215
216
@schema
class Cage(dj.Lookup):
    """Cage information.

    Attributes:
        cage ( varchar(32) ): Cage identifier.
        cage_purpose ( varchar(128) ): Cage purpose.
    """

    definition = """
    cage            : varchar(32)   # cage identifier
    ---
    cage_purpose='' : varchar(128)  # cage purpose
    """

SubjectCaging

Bases: dj.Manual

Information about subject and its cage.

Attributes:

Name Type Description
subject.Subject foreign key

subject.Subject key.

caging_datetime datetime

Date of cage entry.

Cage foreign key

Cage key.

User foreign key

User key.

Source code in element_animal/genotyping.py
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
@schema
class SubjectCaging(dj.Manual):
    """Information about subject and its cage.

    Attributes:
        subject.Subject (foreign key): subject.Subject key.
        caging_datetime (datetime): Date of cage entry.
        Cage (foreign key): Cage key.
        User (foreign key): User key.
    """

    definition = """
    # record of animal caging
    -> subject.Subject
    caging_datetime     : datetime   # date of cage entry
    ---
    -> Cage
    -> User           # person associated with the cage transfer
    """

GenotypeTest

Bases: dj.Manual

Information about genotype test.

Attributes:

Name Type Description
subject.Subject foreign key

subject.Subject key.

Sequence foreign key

Sequence key.

genotype_test_id datetime

Identifier of a genotype test.

test_result Present or Absent

Test result.

Source code in element_animal/genotyping.py
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
@schema
class GenotypeTest(dj.Manual):
    """Information about genotype test.

    Attributes:
        subject.Subject (foreign key): subject.Subject key.
        Sequence (foreign key): Sequence key.
        genotype_test_id (datetime): Identifier of a genotype test.
        test_result (Present or Absent): Test result.
    """

    definition = """
    -> subject.Subject
    -> Sequence
    genotype_test_id    : varchar(32)    # identifier of a genotype test
    ---
    test_result         : enum("Present", "Absent")     # test result
    """