Example #1
0
 def test_static_coordinates(self):
     """
     Containers should calculate coordinates statically.
     """
     # Microplate has spacing as row: 12, col: 12.
     plate = containers.load_container('microplate.example_plate')
     coords = plate.calculate_offset('b12')
     self.assertEqual(coords, (12*1, 12*11)) 
Example #2
0
 def test_static_coordinates(self):
     """
     Containers should calculate coordinates statically.
     """
     # Microplate has spacing as row: 12, col: 12.
     plate = containers.load_container('microplate.example_plate')
     coords = plate.calculate_offset('b12')
     self.assertEqual(coords, (12 * 1, 12 * 11))
Example #3
0
 def test_instance_coordinates_custom_x_y_spacing(self):
     """
     Custom row, col spacing should supercede spacing.
     """
     # Deepwell has spacing as col: 10, row: 13
     plate = containers.load_container('microplate.example_plate.deepwell')
     coords = plate().get_child_coordinates('b12')
     self.assertEqual(coords, (10, 13 * 11))
Example #4
0
 def test_list_example_plate(self):
     """
     Custom container subset recursion.
     """
     inv = containers.list_containers()
     self.assertTrue('microplate.example_plate.deepwell.red' in inv)
     plate = containers.load_container('microplate.example_plate.deepwell.red')
     self.assertEqual(plate.depth, 25)
Example #5
0
 def test_instance_coordinates_custom_x_y_spacing(self):
     """
     Custom row, col spacing should supercede spacing.
     """
     # Deepwell has spacing as col: 10, row: 13
     plate = containers.load_container('microplate.example_plate.deepwell')
     coords = plate().get_child_coordinates('b12')
     self.assertEqual(coords, (10, 13*11))
Example #6
0
 def test_list_example_plate(self):
     """
     Custom container subset recursion.
     """
     inv = containers.list_containers()
     self.assertTrue('microplate.example_plate.deepwell.red' in inv)
     plate = containers.load_container(
         'microplate.example_plate.deepwell.red')
     self.assertEqual(plate.depth, 25)
Example #7
0
 def test_static_coordinates_custom_x_y_spacing(self):
     """
     Custom row, col spacing should supercede spacing.
     """
     # Deepwell has spacing as col: 10, row: 13
     plate = containers.load_container('microplate.example_plate.deepwell')
     coords = plate.calculate_offset('b12')
     print(plate.col_spacing, plate.row_spacing)
     self.assertEqual(coords, (10, 13*11, 0))
Example #8
0
 def test_custom_container_subset(self):
     """
     Custom container subsets inherit parent values.
     """
     plate = containers.load_container('microplate.example_plate.deepwell')
     self.assertEqual(plate.depth, 15)
     self.assertEqual(plate.rows, 12)
     self.assertEqual(plate.cols, 8)
     self.assertEqual(plate.a1_x, 10)
     self.assertEqual(plate.a1_y, 11)
Example #9
0
 def test_custom_container_subset(self):
     """
     Custom container subsets inherit parent values.
     """
     plate = containers.load_container('microplate.example_plate.deepwell')
     self.assertEqual(plate.depth, 15)
     self.assertEqual(plate.rows, 12)
     self.assertEqual(plate.cols, 8)
     self.assertEqual(plate.a1_x, 10)
     self.assertEqual(plate.a1_y, 11)
Example #10
0
 def add_module(self, position, mod):
     pos = self._normalize_position(position)
     if isinstance(mod, str):
         mod = load_container(mod)()
     if pos not in self._children:
         self._children[pos] = mod
         mod.position = position
     else:
         raise x.ContainerConflict(
             "Module already allocated to slot: {}.".format(
                 humanize_position(pos)))
Example #11
0
 def test_custom_container(self):
     """
     Provide a custom container interface.
     """
     # Example definition lives in config/containers/example.yml
     plate = containers.load_container('microplate.example_plate')
     self.assertIs(plate, microplates.Microplate)
     self.assertEqual(plate.rows, 12)
     self.assertEqual(plate.cols, 8)
     self.assertEqual(plate.a1_x, 10)
     self.assertEqual(plate.a1_y, 11)
     self.assertEqual(plate.diameter, 7)
Example #12
0
 def test_custom_container(self):
     """
     Provide a custom container interface.
     """
     # Example definition lives in config/containers/example.yml
     plate = containers.load_container('microplate.example_plate')
     self.assertIs(plate, microplates.Microplate)
     self.assertEqual(plate.rows, 12)
     self.assertEqual(plate.cols, 8)
     self.assertEqual(plate.a1_x, 10)
     self.assertEqual(plate.a1_y, 11)
     self.assertEqual(plate.diameter, 7)
Example #13
0
 def add_module(self, position, mod):
     pos = self._normalize_position(position)
     if isinstance(mod, str):
         mod = load_container(mod)()
     if pos not in self._children:
         self._children[pos] = mod
         mod.position = position
     else:
         raise x.ContainerConflict(
             "Module already allocated to slot: {}."
             .format(humanize_position(pos))
         )
Example #14
0
    def test_custom_well_positions(self):
        """
        Custom well positions.
        """
        rack = containers.load_container('tuberack.15-50ml')

        # Values taken from legacy containers.json file.
        self.assertEqual(rack.coordinates('A1'), (0, 0))
        self.assertEqual(rack.coordinates('A3'), (10, 50))
        self.assertEqual(rack.coordinates('B1'), (32, 0))
        self.assertEqual(rack.coordinates('B2'), (32, 24))
        self.assertEqual(rack.coordinates('B3'), (55, 50))
        self.assertEqual(rack.coordinates('C1'), (64, 0))
        self.assertEqual(rack.coordinates('C2'), (64, 24))
Example #15
0
    def test_custom_well_positions(self):
        """
        Custom well positions.
        """
        rack = containers.load_container('tuberack.15-50ml')
 
        # Values taken from legacy containers.json file.
        self.assertEqual(rack.coordinates('A1'), (0, 0))
        self.assertEqual(rack.coordinates('A3'), (10, 50))
        self.assertEqual(rack.coordinates('B1'), (32, 0))
        self.assertEqual(rack.coordinates('B2'), (32, 24))
        self.assertEqual(rack.coordinates('B3'), (55, 50))
        self.assertEqual(rack.coordinates('C1'), (64, 0))
        self.assertEqual(rack.coordinates('C2'), (64, 24))
Example #16
0
    def test_custom_well_properties(self):
        """
        Custom well properties.
        """
        rack = containers.load_container('tuberack.15-50ml')()

        self.assertEqual(rack.volume, 15000)  # Default volume.
 
        self.assertEqual(rack.tube('A1').max_volume, 15000)
        self.assertEqual(rack.tube('B3').max_volume, 50000)
        
        self.assertEqual(rack.tube('A1').depth, 76)
        self.assertEqual(rack.tube('A3').depth, 76)
        self.assertEqual(rack.tube('A1').diameter, 16)
        self.assertEqual(rack.tube('A3').diameter, 26)
Example #17
0
    def test_custom_well_properties(self):
        """
        Custom well properties.
        """
        rack = containers.load_container('tuberack.15-50ml')()

        self.assertEqual(rack.volume, 15000)  # Default volume.

        self.assertEqual(rack.tube('A1').max_volume, 15000)
        self.assertEqual(rack.tube('B3').max_volume, 50000)

        self.assertEqual(rack.tube('A1').depth, 76)
        self.assertEqual(rack.tube('A3').depth, 76)
        self.assertEqual(rack.tube('A1').diameter, 16)
        self.assertEqual(rack.tube('A3').diameter, 26)
Example #18
0
    def test_tiprack_next_tip(self):
        """
        Tip offset.
        """
        rack = containers.load_container('tiprack.1000ul')()

        a1 = rack.tip_offset(0)
        a2 = rack.tip_offset(1)
        a3 = rack.tip_offset(2)
        a4 = rack.tip_offset(3)
        b1 = rack.tip_offset(12)
        b3 = rack.tip_offset(14)

        self.assertEqual(a1, rack.coordinates('a1'))
        self.assertEqual(a2, rack.coordinates('a2'))
        self.assertEqual(a3, rack.coordinates('a3'))
        self.assertEqual(a4, rack.coordinates('a4'))
        self.assertEqual(b1, rack.coordinates('b1'))
        self.assertEqual(b3, rack.coordinates('b3'))
Example #19
0
    def test_tiprack_next_tip(self):
        """
        Tip offset.
        """
        rack = containers.load_container('tiprack.1000ul')()

        a1 = rack.tip_offset(0)
        a2 = rack.tip_offset(1)
        a3 = rack.tip_offset(2)
        a4 = rack.tip_offset(3)
        b1 = rack.tip_offset(12)
        b3 = rack.tip_offset(14)

        self.assertEqual(a1, rack.coordinates('a1'))
        self.assertEqual(a2, rack.coordinates('a2'))
        self.assertEqual(a3, rack.coordinates('a3'))
        self.assertEqual(a4, rack.coordinates('a4'))
        self.assertEqual(b1, rack.coordinates('b1'))
        self.assertEqual(b3, rack.coordinates('b3'))
Example #20
0
    def test_tiprack_tag(self):
        """
        Tips on specific racks can be tagged for reuse.
        """
        rack = containers.load_container('tiprack.1000ul')()

        a1 = rack.get_next_tip().coordinates()
        a2 = rack.get_next_tip().coordinates()
        a3 = rack.get_next_tip().coordinates()

        a4 = rack.get_next_tip(tag='water').coordinates()
        a5 = rack.get_next_tip(tag='saline').coordinates()

        also_a4 = rack.get_next_tip(tag='water').coordinates()
        also_a5 = rack.get_next_tip('saline').coordinates()

        self.assertEqual(a1, rack.coordinates('a1'))
        self.assertEqual(a2, rack.coordinates('a2'))
        self.assertEqual(a3, rack.coordinates('a3'))
        self.assertEqual(a4, rack.coordinates('a4'))
        self.assertEqual(a5, rack.coordinates('a5'))
        self.assertEqual(also_a4, rack.coordinates('a4'))
        self.assertEqual(also_a5, rack.coordinates('a5'))
Example #21
0
    def test_tiprack_tag(self):
        """
        Tips on specific racks can be tagged for reuse.
        """
        rack = containers.load_container('tiprack.1000ul')()
        
        a1 = rack.get_next_tip().coordinates()
        a2 = rack.get_next_tip().coordinates()
        a3 = rack.get_next_tip().coordinates()

        a4 = rack.get_next_tip(tag='water').coordinates()
        a5 = rack.get_next_tip(tag='saline').coordinates()

        also_a4 = rack.get_next_tip(tag='water').coordinates()
        also_a5 = rack.get_next_tip('saline').coordinates()

        self.assertEqual(a1, rack.coordinates('a1'))
        self.assertEqual(a2, rack.coordinates('a2'))
        self.assertEqual(a3, rack.coordinates('a3'))
        self.assertEqual(a4, rack.coordinates('a4'))
        self.assertEqual(a5, rack.coordinates('a5'))
        self.assertEqual(also_a4, rack.coordinates('a4'))
        self.assertEqual(also_a5, rack.coordinates('a5'))
Example #22
0
 def test_legacy_container_load(self):
     """
     All legacy containers load.
     """
     containers.load_legacy_containers_file()
     containers.load_container('legacy.tube-rack-2ml_PCR')
Example #23
0
 def test_custom_container_volume(self):
     """
     Custom containers can specify custom volume.
     """
     rack = containers.load_container('tuberack.750ul')
     self.assertEqual(rack.volume, 750)
Example #24
0
 def test_microplate_subsubset(self):
     """
     Provide access to subchild microplates.
     """
     plate = containers.load_container('microplate.96.deepwell')
     self.assertIs(plate, microplates.Microplate_96_Deepwell)
Example #25
0
 def test_microplate_subset(self):
     """
     Provide access to child microplates.
     """
     plate = containers.load_container('microplate.96')
     self.assertIs(plate, microplates.Microplate)
Example #26
0
 def test_tiprack(self):
     """
     Provide access to tipracks.
     """
     rack = containers.load_container('tiprack')
     self.assertIs(rack, tipracks.Tiprack)
Example #27
0
 def test_custom_container_volume(self):
     """
     Custom containers can specify custom volume.
     """
     rack = containers.load_container('tuberack.750ul')
     self.assertEqual(rack.volume, 750)
Example #28
0
 def load_calibration(self, data):
     for pos in data:
         Container = load_container(data[pos]['name'])
         self.add_module(pos, Container())
     self.calibrate(**data)
Example #29
0
 def test_custom_tiprack(self):
     """
     Custom container should inherit from Tiprack type.
     """
     rack = containers.load_container('tiprack.example_rack')
     self.assertIs(rack, tipracks.Tiprack)
Example #30
0
 def test_microplate_subset(self):
     """
     Provide access to child microplates.
     """
     plate = containers.load_container('microplate.96')
     self.assertIs(plate, microplates.Microplate)
Example #31
0
 def test_microplate(self):
     """
     Provide access to microplates.
     """
     plate = containers.load_container('microplate')
     self.assertIs(plate, microplates.Microplate)
Example #32
0
 def test_invaid_container_name(self):
     """
     Enforce valid container name.
     """
     with self.assertRaises(KeyError):
         containers.load_container('fake_container')
Example #33
0
 def test_microplate_subsubset(self):
     """
     Provide access to subchild microplates.
     """
     plate = containers.load_container('microplate.96.deepwell')
     self.assertIs(plate, microplates.Microplate_96_Deepwell)
Example #34
0
 def test_tiprack(self):
     """
     Provide access to tipracks.
     """
     rack = containers.load_container('tiprack')
     self.assertIs(rack, tipracks.Tiprack)
Example #35
0
 def test_24_well_microplate(self):
     """
     24 well microplate should exist.
     """
     plate = containers.load_container('microplate.24')
     self.assertEqual(plate.rows * plate.cols, 24)
Example #36
0
 def test_microplate(self):
     """
     Provide access to microplates.
     """
     plate = containers.load_container('microplate')
     self.assertIs(plate, microplates.Microplate)
Example #37
0
 def test_custom_tiprack(self):
     """
     Custom container should inherit from Tiprack type.
     """
     rack = containers.load_container('tiprack.example_rack')
     self.assertIs(rack, tipracks.Tiprack)
Example #38
0
 def test_invaid_container_name(self):
     """
     Enforce valid container name.
     """
     with self.assertRaises(KeyError):
         containers.load_container('fake_container')
Example #39
0
 def test_24_well_microplate(self):
     """
     24 well microplate should exist.
     """
     plate = containers.load_container('microplate.24')
     self.assertEqual(plate.rows*plate.cols, 24)
Example #40
0
 def test_legacy_container_load(self):
     """
     All legacy containers load.
     """
     containers.load_legacy_containers_file()
     containers.load_container('legacy.tube-rack-2ml_PCR')