Brain models

These are the brain models that represent a mapping from the actual database tables to python classes, or ORM. (ORM: object relational mapping)


class brain.models.Animal(*args, **kwargs)

This is the main model used by almost all the other models in the entire project. It includes the fields originally set by David and Yoav.

Parameters
  • active (Boolean) – DB column = active

  • created (DateTime) – DB column = created

  • prep_id (Char length=20) – DB column = prep_id

  • performance_center (Enum) – DB column = performance_center

  • date_of_birth (Date) – DB column = date_of_birth

  • species (Enum) – DB column = species

  • strain (Char length=15) – DB column = strain

  • sex (Enum) – DB column = sex

  • genotype (Char length=100) – DB column = genotype

  • breeder_line (Char length=100) – DB column = breeder_line

  • vender (Enum) – DB column = vender

  • stock_number (Char length=100) – DB column = stock_number

  • tissue_source (Enum) – DB column = tissue_source

  • ship_date (Date) – DB column = ship_date

  • shipper (Enum) – DB column = shipper

  • tracking_number (Char length=100) – DB column = tracking_number

  • aliases_1 (Char length=100) – DB column = aliases_1

  • aliases_2 (Char length=100) – DB column = aliases_2

  • aliases_3 (Char length=100) – DB column = aliases_3

  • aliases_4 (Char length=100) – DB column = aliases_4

  • aliases_5 (Char length=100) – DB column = aliases_5

  • comments (Text length=2001) – DB column = comments

exception DoesNotExist
exception MultipleObjectsReturned
histogram()

This method will display the histogram as a link if the user hovers over it.

Returns

HTML of the link to the histogram

class brain.models.AtlasModel(*args, **kwargs)

This is the base model that is inherited by most of the other classes (models). It includes common fields that all the models need.

Parameters
  • active (Boolean) – DB column = active

  • created (DateTime) – DB column = created

class brain.models.Histology(*args, **kwargs)

This class provides the metadata associated with the histology of the animal

Parameters
  • active (Boolean) – DB column = active

  • created (DateTime) – DB column = created

  • id (Auto) – id

  • prep_id (ForeignKey) – prep

  • virus_id (ForeignKey) – virus

  • label_id (ForeignKey) – label

  • performance_center (Enum) – performance center

  • anesthesia (Enum) – anesthesia

  • perfusion_age_in_days (PositiveInteger) – perfusion age in days

  • perfusion_date (Date) – perfusion date

  • exsangination_method (Enum) – exsangination method

  • fixative_method (Enum) – fixative method

  • special_perfusion_notes (Char length=200) – special perfusion notes

  • post_fixation_period (PositiveInteger) – post fixation period

  • whole_brain (Char length=1) – whole brain

  • block (Char length=200) – block

  • date_sectioned (Date) – date sectioned

  • side_sectioned_first (Enum) – side sectioned first

  • scene_order (Enum) – scene order

  • sectioning_method (Enum) – sectioning method

  • section_thickness (PositiveInteger) – section thickness

  • orientation (Enum) – orientation

  • oblique_notes (Char length=200) – oblique notes

  • mounting (Enum) – mounting

  • counterstain (Enum) – counterstain

  • comments (Text length=2001) – comments

exception DoesNotExist
exception MultipleObjectsReturned
class brain.models.Injection(*args, **kwargs)

This class provides information regarding an injection. An animal can have one or more injections and and injection can contain one or more viruses.

Parameters
  • active (Boolean) – DB column = active

  • created (DateTime) – DB column = created

  • id (Auto) – id

  • prep_id (ForeignKey) – prep

  • label_id (ForeignKey) – label

  • performance_center (Enum) – performance center

  • anesthesia (Enum) – anesthesia

  • method (Enum) – method

  • injection_volume (Float) – injection volume

  • pipet (Enum) – pipet

  • location (Char length=20) – location

  • angle (Char length=20) – angle

  • brain_location_dv (Float) – brain location dv

  • brain_location_ml (Float) – brain location ml

  • brain_location_ap (Float) – brain location ap

  • injection_date (Date) – injection date

  • transport_days (Integer) – transport days

  • virus_count (Integer) – virus count

  • comments (Text length=2001) – comments

exception DoesNotExist
exception MultipleObjectsReturned
class brain.models.InjectionVirus(*args, **kwargs)

This class describes a many to many relationship for the injections and viruses. An animal can have one or more injections and a injection can have one or more viruses.

Parameters
  • active (Boolean) – DB column = active

  • created (DateTime) – DB column = created

  • id (Auto) – id

  • injection_id (ForeignKey) – injection

  • virus_id (ForeignKey) – virus

exception DoesNotExist
exception MultipleObjectsReturned
class brain.models.OrganicLabel(*args, **kwargs)

This class holds the organic label metadata.

Parameters
  • active (Boolean) – DB column = active

  • created (DateTime) – DB column = created

  • id (Auto) – id

  • label_id (Char length=20) – label id

  • label_type (Enum) – label type

  • type_lot_number (Char length=20) – type lot number

  • type_tracer (Enum) – type tracer

  • type_details (Char length=500) – type details

  • concentration (Float) – concentration

  • excitation_1p_wavelength (Integer) – excitation 1p wavelength

  • excitation_1p_range (Integer) – excitation 1p range

  • excitation_2p_wavelength (Integer) – excitation 2p wavelength

  • excitation_2p_range (Integer) – excitation 2p range

  • lp_dichroic_cut (Integer) – lp dichroic cut

  • emission_wavelength (Integer) – emission wavelength

  • emission_range (Integer) – emission range

  • label_source (Enum) – label source

  • source_details (Char length=100) – source details

  • comments (Text length=2000) – comments

exception DoesNotExist
exception MultipleObjectsReturned
class brain.models.ScanRun(*args, **kwargs)

This class describes the blueprint of a scan. Each animal will usually have just one scan run, but they can have more than one. Information in this table is used extensively throughout the pre-processing

Parameters
  • active (Boolean) – DB column = active

  • created (DateTime) – DB column = created

  • id (Auto) – id

  • prep_id (ForeignKey) – prep

  • rescan_number (Integer) – rescan number

  • performance_center (Enum) – performance center

  • machine (Enum) – machine

  • objective (Enum) – objective

  • resolution (Float) – XY Resolution (um)

  • zresolution (Float) – Z Resolution (um)

  • number_of_slides (Integer) – number of slides

  • scan_date (Date) – scan date

  • file_type (Enum) – file type

  • channels_per_scene (Enum) – channels per scene

  • converted_status (Enum) – converted status

  • ch_1_filter_set (Enum) – ch 1 filter set

  • ch_2_filter_set (Enum) – ch 2 filter set

  • ch_3_filter_set (Enum) – ch 3 filter set

  • ch_4_filter_set (Enum) – ch 4 filter set

  • width (Integer) – Width (pixels)

  • height (Integer) – Height (pixels)

  • rotation (Integer) – rotation

  • flip (Enum) – flip

  • comments (Text length=2001) – comments

exception DoesNotExist
exception MultipleObjectsReturned
class brain.models.Section(*args, **kwargs)

This class describes a view and not an actual database table. This table provides the names, locations and ordering of the TIFF files.

Parameters
  • active (Boolean) – DB column = active

  • created (DateTime) – DB column = created

  • id (Auto) – id

  • prep_id (Char length=20) – prep id

  • rescan_number (Integer) – Rescan

  • czi_file (Char length=200) – czi file

  • slide_physical_id (Integer) – Slide

  • file_name (Char length=200) – file name

  • scene_number (Integer) – Scene

  • scene_index (Integer) – Scene Index

  • channel (Integer) – channel

exception DoesNotExist
exception MultipleObjectsReturned
histogram()

Creates a link to the histogram of the section

Returns

HTML that provides a link to the histogram

image_tag()

Creates a link to the web friendly version of the TIFF

Returns

HTML that provides a link to the thumbnail

scene()

Returns the scene #

slide()

Returns the slide #

tif()

Returns the name of the TIFF file

class brain.models.Slide(*args, **kwargs)

This class describes an individual slide. Each slide usually has 4 scenes (pieces of tissue). This is the parent class to the TIFF (SlideCziToTif) class.

Parameters
  • active (Boolean) – DB column = active

  • created (DateTime) – DB column = created

  • id (Auto) – id

  • scan_run_id (ForeignKey) – scan run

  • slide_physical_id (Integer) – slide physical id

  • slide_status (Enum) – slide status

  • scenes (Integer) – scenes

  • insert_before_one (Integer) – Replicate S1

  • scene_qc_1 (Integer) – Scene 1 QC

  • insert_between_one_two (Integer) – Replicate S2

  • scene_qc_2 (Integer) – Scene 2 QC

  • insert_between_two_three (Integer) – Replicate S3

  • scene_qc_3 (Integer) – Scene 3 QC

  • insert_between_three_four (Integer) – Replicate S4

  • scene_qc_4 (Integer) – Scene 4 QC

  • insert_between_four_five (Integer) – Replicate S5

  • scene_qc_5 (Integer) – Scene 5 QC

  • insert_between_five_six (Integer) – Replicate S6

  • scene_qc_6 (Integer) – Scene 6 QC

  • file_name (Char length=200) – file name

  • comments (Text length=2001) – comments

  • file_size (Float) – File size (bytes)

  • processed (Boolean) – Converted

exception DoesNotExist
exception MultipleObjectsReturned
class brain.models.SlideCziToTif(*args, **kwargs)

This is the child class of the Slide class. This model describes the metadata associated with a TIFF file, or another way to think of it, it describes one piece of brain tissue on a slide.

Parameters
  • active (Boolean) – DB column = active

  • created (DateTime) – DB column = created

  • id (Auto) – id

  • slide_id (ForeignKey) – DB column = FK_slide_id

  • file_name (Char length=200) – file name

  • scene_number (Integer) – Scene

  • scene_index (Integer) – scene index

  • channel (Integer) – channel

  • width (Integer) – Width (pixels)

  • height (Integer) – Height (pixels)

  • comments (Text length=2000) – comments

  • file_size (Float) – File size (bytes)

  • processing_duration (Float) – Processing time (seconds)

exception DoesNotExist
exception MultipleObjectsReturned
max_scene()

This method gives you the number of scenes on a slide

Returns

an integer with the number of scenes

class brain.models.Virus(*args, **kwargs)

A class that describes the Virus metadata. There will be one or more of these in each Injection

Parameters
  • active (Boolean) – DB column = active

  • created (DateTime) – DB column = created

  • id (Auto) – id

  • virus_name (Char length=50) – virus name

  • virus_type (Enum) – virus type

  • virus_active (Enum) – virus active

  • type_details (Char length=500) – type details

  • titer (Float) – titer

  • lot_number (Char length=20) – lot number

  • label (Enum) – label

  • label2 (Char length=200) – label2

  • excitation_1p_wavelength (Integer) – excitation 1p wavelength

  • excitation_1p_range (Integer) – excitation 1p range

  • excitation_2p_wavelength (Integer) – excitation 2p wavelength

  • excitation_2p_range (Integer) – excitation 2p range

  • lp_dichroic_cut (Integer) – lp dichroic cut

  • emission_wavelength (Integer) – emission wavelength

  • emission_range (Integer) – emission range

  • virus_source (Enum) – virus source

  • source_details (Char length=100) – source details

  • comments (Text length=2000) – comments

exception DoesNotExist
exception MultipleObjectsReturned