本文整理汇总了Python中autoprotocol.protocol.Protocol.distribute方法的典型用法代码示例。如果您正苦于以下问题:Python Protocol.distribute方法的具体用法?Python Protocol.distribute怎么用?Python Protocol.distribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类autoprotocol.protocol.Protocol
的用法示例。
在下文中一共展示了Protocol.distribute方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: runTest
# 需要导入模块: from autoprotocol.protocol import Protocol [as 别名]
# 或者: from autoprotocol.protocol.Protocol import distribute [as 别名]
def runTest(self):
protocol = Protocol()
resource = protocol.ref("resource", None, "96-flat", discard=True)
pcr = protocol.ref("pcr", None, "96-flat", discard=True)
bacteria = protocol.ref("bacteria", None, "96-flat", discard=True)
self.assertEqual(len(protocol.as_dict()['refs']), 3, 'incorrect number of refs')
self.assertEqual(protocol.as_dict()['refs']['resource'], {"new": "96-flat",
"discard": True})
bacteria_wells = WellGroup([bacteria.well("B1"), bacteria.well("C5"),
bacteria.well("A5"), bacteria.well("A1")])
protocol.distribute(resource.well("A1").set_volume("40:microliter"),
pcr.wells_from('A1',5), "5:microliter")
protocol.distribute(resource.well("A1").set_volume("40:microliter"),
bacteria_wells, "5:microliter")
self.assertEqual(len(protocol.instructions), 1)
self.assertEqual(protocol.instructions[0].op, "pipette")
self.assertEqual(len(protocol.instructions[0].groups), 2)
protocol.incubate(bacteria, "warm_37", "30:minute")
self.assertEqual(len(protocol.instructions), 2)
self.assertEqual(protocol.instructions[1].op, "incubate")
self.assertEqual(protocol.instructions[1].duration, "30:minute")
示例2: test_distribute_one_well
# 需要导入模块: from autoprotocol.protocol import Protocol [as 别名]
# 或者: from autoprotocol.protocol.Protocol import distribute [as 别名]
def test_distribute_one_well(self):
p = Protocol()
c = p.ref("test", None, "96-flat", discard=True)
p.distribute(c.well(0).set_volume("20:microliter"),
c.well(1),
"5:microliter")
self.assertEqual(1, len(p.instructions))
self.assertEqual("distribute",
list(p.as_dict()["instructions"][0]["groups"][0].keys())[0])
self.assertTrue(5, c.well(1).volume.value)
self.assertTrue(15, c.well(0).volume.value)
示例3: test_distribute_multiple_wells
# 需要导入模块: from autoprotocol.protocol import Protocol [as 别名]
# 或者: from autoprotocol.protocol.Protocol import distribute [as 别名]
def test_distribute_multiple_wells(self):
p = Protocol()
c = p.ref("test", None, "96-flat", discard=True)
p.distribute(c.well(0).set_volume("20:microliter"),
c.wells_from(1,3),
"5:microliter")
self.assertEqual(1, len(p.instructions))
self.assertEqual("distribute",
p.as_dict()["instructions"][0]["groups"][0].keys()[0])
for w in c.wells_from(1,3):
self.assertTrue(5, w.volume.value)
self.assertTrue(5, c.well(0).volume.value)
示例4: test_mag_collect
# 需要导入模块: from autoprotocol.protocol import Protocol [as 别名]
# 或者: from autoprotocol.protocol.Protocol import distribute [as 别名]
def test_mag_collect(self):
"""
Desired Output:
1. Magnetically release pcr_0 beads for 30.0 seconds at an amplitude of 0
2. Distribute from test/1 into wells test/7, test/8, test/9
3. Distribute from test/2 into wells test/10
4. Distribute from test/0 into wells test/1
5. Magnetically collect pcr_0 beads for 5 cycles with a pause duration of 30.0 seconds
"""
p = Protocol()
pcrs = [p.ref("pcr_%s" % i, None, "96-pcr", storage="cold_20")
for i in range(7)]
pcr = pcrs[0]
p.mag_release("96-pcr", pcr, "30:second", "1:hertz",
center=float(5) / 100, amplitude=0)
c = p.ref("test", None, "96-flat", discard=True)
srcs = c.wells_from(1, 2).set_volume("100:microliter")
dests = c.wells_from(7, 4)
p.distribute(srcs, dests, "30:microliter", allow_carryover=True)
p.distribute(c.well("A1").set_volume(
"20:microliter"), c.well("A2"), "5:microliter")
p.mag_collect("96-pcr", pcr, 5, "30:second",
bottom_position=float(5) / 100)
pjsonString = json.dumps(p.as_dict(), indent=2)
pjson = json.loads(pjsonString)
parser_instance = english.AutoprotocolParser(pjson)
parser_instance.job_tree()
parsed_output = parser_instance.parsed_output
steps = parser_instance.object_list
forest = parser_instance.forest_list
self.assertEqual(
parsed_output, ["Magnetically release pcr_0 beads for 30.0 seconds at an amplitude of 0",
"Distribute from test/1 into wells test/7, test/8, test/9",
"Distribute from test/2 into wells test/10",
"Distribute from test/0 into wells test/1",
"Magnetically collect pcr_0 beads for 5 cycles with a pause duration of 30.0 seconds"])
self.assertEqual(forest, [[1, [5]], [2, [4]], [3]])
示例5: test_fill_wells
# 需要导入模块: from autoprotocol.protocol import Protocol [as 别名]
# 或者: from autoprotocol.protocol.Protocol import distribute [as 别名]
def test_fill_wells(self):
p = Protocol()
c = p.ref("test", None, "96-flat", discard=True)
srcs = c.wells_from(1, 2).set_volume("100:microliter")
dests = c.wells_from(7, 4)
p.distribute(srcs, dests, "30:microliter", allow_carryover=True)
self.assertEqual(2, len(p.instructions[0].groups))
# track source vols
self.assertEqual(10, c.well(1).volume.value)
self.assertEqual(70, c.well(2).volume.value)
# track dest vols
self.assertEqual(30, c.well(7).volume.value)
self.assertIs(None, c.well(6).volume)
# test distribute from Well to Well
p.distribute(c.well("A1").set_volume("20:microliter"), c.well("A2"), "5:microliter")
self.assertTrue("distribute" in p.instructions[-1].groups[-1])
示例6: test_unit_conversion
# 需要导入模块: from autoprotocol.protocol import Protocol [as 别名]
# 或者: from autoprotocol.protocol.Protocol import distribute [as 别名]
def test_unit_conversion(self):
p = Protocol()
c = p.ref("test", None, "96-flat", discard=True)
with self.assertRaises(RuntimeError):
with self.assertRaises(ValueError):
p.distribute(c.well(0).set_volume("100:microliter"), c.well(1), ".0001:liter")
p.distribute(c.well(0).set_volume("100:microliter"), c.well(1), "200:nanoliter")
self.assertTrue(str(p.instructions[0].groups[0]["distribute"]["to"][0]["volume"]) == "0.2:microliter")
p.distribute(c.well(2).set_volume("100:microliter"), c.well(3), ".1:milliliter", new_group=True)
self.assertTrue(str(p.instructions[-1].groups[0]["distribute"]["to"][0]["volume"]) == "100.0:microliter")