本文整理汇总了Python中autoprotocol.protocol.Protocol.ref方法的典型用法代码示例。如果您正苦于以下问题:Python Protocol.ref方法的具体用法?Python Protocol.ref怎么用?Python Protocol.ref使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类autoprotocol.protocol.Protocol
的用法示例。
在下文中一共展示了Protocol.ref方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_volume_tracking
# 需要导入模块: from autoprotocol.protocol import Protocol [as 别名]
# 或者: from autoprotocol.protocol.Protocol import ref [as 别名]
def test_volume_tracking(self):
p = Protocol()
plate_96 = p.ref("plate_96", None, "96-pcr", discard=True)
plate_96_2 = p.ref("plate_96_2", None, "96-pcr", discard=True)
plate_384 = p.ref("plate_384", None, "384-pcr", discard=True)
plate_384_2 = p.ref("plate_384_2", None, "384-pcr", discard=True)
p.stamp(plate_96.well(0), plate_384.well(0), "5:microliter",
{"columns": 12, "rows": 1})
self.assertEqual(plate_384.well(0).volume.value, 5)
self.assertTrue(plate_384.well(1).volume is None)
p.stamp(plate_96.well(0), plate_96_2.well(0), "10:microliter",
{"columns": 12, "rows": 1})
p.stamp(plate_96.well(0), plate_96_2.well(0), "10:microliter",
{"columns": 1, "rows": 8})
self.assertTrue(plate_96_2.well(0).volume == Unit(20, "microliter"))
for w in plate_96_2.wells_from(1, 11):
self.assertTrue(w.volume == Unit(10, "microliter"))
p.stamp(plate_96.well(0), plate_384_2.well(0), "5:microliter",
{"columns": 1, "rows": 8})
for w in plate_384_2.wells_from(0, 16, columnwise=True)[0::2]:
self.assertTrue(w.volume == Unit(5, "microliter"))
for w in plate_384_2.wells_from(1, 16, columnwise=True)[0::2]:
self.assertTrue(w.volume is None)
for w in plate_384_2.wells_from(1, 24)[0::2]:
self.assertTrue(w.volume is None)
plate_384_2.all_wells().set_volume("0:microliter")
p.stamp(plate_96.well(0), plate_384_2.well(0), "15:microliter", {"columns": 3, "rows": 8})
self.assertEqual(plate_384_2.well("C3").volume, Unit(15, "microliter"))
self.assertEqual(plate_384_2.well("B2").volume, Unit(0, "microliter"))
示例2: test_duplicates_not_allowed
# 需要导入模块: from autoprotocol.protocol import Protocol [as 别名]
# 或者: from autoprotocol.protocol.Protocol import ref [as 别名]
def test_duplicates_not_allowed(self):
p = Protocol()
p.ref("test", None, "96-flat", discard=True)
with self.assertRaises(AssertionError):
p.ref("test", None, "96-flat", storage="cold_20")
self.assertTrue(p.refs["test"].opts["discard"])
self.assertFalse("where" in p.refs["test"].opts)
示例3: test_single_transfers
# 需要导入模块: from autoprotocol.protocol import Protocol [as 别名]
# 或者: from autoprotocol.protocol.Protocol import ref [as 别名]
def test_single_transfers(self):
p = Protocol()
plate_1_6 = p.ref("plate_1_6", None, "6-flat", discard=True)
plate_1_96 = p.ref("plate_1_96", None, "96-flat", discard=True)
plate_2_96 = p.ref("plate_2_96", None, "96-flat", discard=True)
plate_1_384 = p.ref("plate_1_384", None, "384-flat", discard=True)
plate_2_384 = p.ref("plate_2_384", None, "384-flat", discard=True)
p.stamp(plate_1_96.well("G1"), plate_2_96.well("H1"),
"10:microliter", dict(rows=1, columns=12))
p.stamp(plate_1_96.well("A1"), plate_1_384.well("A2"),
"10:microliter", dict(rows=8, columns=2))
# Verify full plate to full plate transfer works for 96, 384 container input
p.stamp(plate_1_96, plate_2_96, "10:microliter")
p.stamp(plate_1_384, plate_2_384, "10:microliter")
with self.assertRaises(ValueError):
p.stamp(plate_1_96.well("A1"), plate_2_96.well("A2"),
"10:microliter", dict(rows=9, columns=1))
with self.assertRaises(ValueError):
p.stamp(plate_1_96.well("A1"), plate_2_96.well("B1"),
"10:microliter", dict(rows=1, columns=13))
with self.assertRaises(ValueError):
p.stamp(plate_1_384.well("A1"), plate_2_384.well("A2"),
"10:microliter", dict(rows=9, columns=1))
with self.assertRaises(ValueError):
p.stamp(plate_1_384.well("A1"), plate_2_384.well("B1"),
"10:microliter", dict(rows=1, columns=13))
with self.assertRaises(ValueError):
p.stamp(plate_1_96.well("A1"), plate_2_96.well("A2"),
"10:microliter", dict(rows=1, columns=12))
with self.assertRaises(ValueError):
p.stamp(plate_1_96.well("A1"), plate_2_96.well("D1"),
"10:microliter", dict(rows=6, columns=12))
示例4: test_web_example
# 需要导入模块: from autoprotocol.protocol import Protocol [as 别名]
# 或者: from autoprotocol.protocol.Protocol import ref [as 别名]
def test_web_example(self):
p = Protocol()
bacterial_sample = p.ref("bacteria", None, "micro-1.5", discard=True)
test_plate = p.ref("test_plate", None, "96-flat", storage="cold_4")
p.dispense_full_plate(test_plate, "lb-broth-noAB", "50:microliter")
w = 0
amt = 1
while amt < 20:
p.transfer(bacterial_sample.well(
0), test_plate.well(w), "%d:microliter" % amt)
amt += 2
w += 1
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(forest, [[1], [2], [3], [4], [5], [
6], [7], [8], [9], [10], [11]])
示例5: runTest
# 需要导入模块: from autoprotocol.protocol import Protocol [as 别名]
# 或者: from autoprotocol.protocol.Protocol import ref [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")
示例6: test_all_container_types
# 需要导入模块: from autoprotocol.protocol import Protocol [as 别名]
# 或者: from autoprotocol.protocol.Protocol import ref [as 别名]
def test_all_container_types(self):
from autoprotocol.container_type import _CONTAINER_TYPES
from autoprotocol.protocol import Protocol
p = Protocol()
for k, v in _CONTAINER_TYPES.items():
p.ref(k, None, v.shortname, discard=True)
assert (len(p.refs) == len(_CONTAINER_TYPES))
示例7: test_sequence_cover_instructions
# 需要导入模块: from autoprotocol.protocol import Protocol [as 别名]
# 或者: from autoprotocol.protocol.Protocol import ref [as 别名]
def test_sequence_cover_instructions(self):
p = Protocol()
cont1 = p.ref("c1", None, "384-pcr", storage="cold_4")
cont2 = p.ref("c2", None, "384-pcr", storage="cold_4")
cont3 = p.ref("c3", None, "96-deep", storage="cold_4")
cont4 = p.ref("c4", None, "micro-1.5", storage="cold_4")
cont5 = p.ref("c5", None, "384-echo", discard=True)
therm_groups = [
{
"cycles": 1,
"steps": [
{
"temperature": "37:celsius",
"duration": "60:minute"
},
]
}
]
p.incubate(cont1, "ambient", duration="1:minute")
self.assertEqual(p.instructions[0].op, "seal")
self.assertEqual(p.instructions[1].op, "incubate")
self.assertEqual(cont1.cover, 'ultra-clear')
p.spin(cont1, acceleration="1000:g", duration="2:minute")
self.assertEqual(cont1.cover, "ultra-clear")
self.assertEqual(cont2.cover, None)
p.thermocycle(cont2, groups=therm_groups)
self.assertEqual(cont2.cover, "ultra-clear")
p.transfer(cont2.well(0), cont1.well(1), volume="1:microliter")
self.assertEqual(cont1.cover, None)
self.assertEqual(cont2.cover, None)
with self.assertRaises(RuntimeError):
p.cover(cont2)
p.seal(cont2)
p.thermocycle(cont1, groups=therm_groups)
self.assertEqual(cont1.cover, "ultra-clear")
p.spin(cont1, acceleration="1000:g", duration="2:minute")
p.spin(cont2, acceleration="1000:g", duration="2:minute")
p.spin(cont5, acceleration="1000:g", duration="2:minute")
self.assertEqual(cont1.cover, "ultra-clear")
self.assertEqual(cont2.cover, "ultra-clear")
self.assertEqual(cont5.cover, "universal")
p.uncover(cont5)
p.unseal(cont1)
p.transfer(cont4.well(0), cont3.well(0), "1:microliter")
p.spin(cont4, acceleration="1000:g", duration="2:minute")
self.assertEqual(cont4.cover, None)
with self.assertRaises(RuntimeError):
p.thermocycle(cont4, groups=therm_groups)
seal_on_store(p)
self.assertEqual(cont1.cover, "ultra-clear")
self.assertEqual(cont2.cover, "ultra-clear")
self.assertEqual(cont3.cover, "standard")
self.assertEqual(cont4.cover, None)
self.assertEqual(cont5.cover, None)
示例8: test_sequence_cover_instructions2
# 需要导入模块: from autoprotocol.protocol import Protocol [as 别名]
# 或者: from autoprotocol.protocol.Protocol import ref [as 别名]
def test_sequence_cover_instructions2(self):
p = Protocol()
cont1 = p.ref("c1", None, "96-pcr", storage="cold_4")
p.incubate(cont1, "ambient", duration="1:minute")
assert (p.instructions[0].op == "seal")
cont2 = p.ref("c2", None, "96-pcr", storage="cold_4")
p.incubate(cont2, "ambient", duration="1:minute", uncovered=True)
assert (p.instructions[-2].op == "incubate")
with pytest.raises(RuntimeError):
p.incubate(cont1, "cold_4", duration="1:minute", uncovered=True)
示例9: test_append
# 需要导入模块: from autoprotocol.protocol import Protocol [as 别名]
# 或者: from autoprotocol.protocol.Protocol import ref [as 别名]
def test_append(self):
p = Protocol()
echo = p.ref("echo", None, "384-echo", discard=True)
dest = p.ref("dest", None, "384-flat", discard=True)
dest2 = p.ref("dest2", None, "384-flat", discard=True)
p.acoustic_transfer(echo.well(0), dest.wells(1,3,5), "25:microliter")
self.assertTrue(len(p.instructions) == 1)
p.acoustic_transfer(echo.well(0), dest.wells(0,2,4), "25:microliter")
self.assertTrue(len(p.instructions) == 1)
p.acoustic_transfer(echo.well(0), dest.wells(0,2,4), "25:microliter",
droplet_size="0.50:microliter")
self.assertTrue(len(p.instructions) == 2)
p.acoustic_transfer(echo.well(0), dest2.wells(0,2,4), "25:microliter")
self.assertTrue(len(p.instructions) == 3)
示例10: test_single_transfers
# 需要导入模块: from autoprotocol.protocol import Protocol [as 别名]
# 或者: from autoprotocol.protocol.Protocol import ref [as 别名]
def test_single_transfers(self):
p = Protocol()
plate_96_list = []
for plate_num in range(5):
plate_name = ("test_96_"+str(plate_num))
plate_96_list.append(p.ref(plate_name, None, "96-flat", discard=True))
plate_384_list = []
for plate_num in range(3):
plate_name = ("test_384_"+str(plate_num))
plate_384_list.append(p.ref(plate_name, None, "384-flat", discard=True))
with self.assertRaises(RuntimeError):
# Transfer 4 plates
for pl, q in zip(plate_96_list, [0, 1, 24, 26]):
p.stamp(pl, plate_384_list[0], "10:microliter", to_quad = q)
示例11: test_flow
# 需要导入模块: from autoprotocol.protocol import Protocol [as 别名]
# 或者: from autoprotocol.protocol.Protocol import ref [as 别名]
def test_flow(self):
"""
Desired Output:
1. Perform flow cytometry on well0 with the respective FSC and SSC channel parameters
"""
p = Protocol()
dataref = "test_ref"
well0 = p.ref("test_plate", None, "96-pcr",
discard=True).well(0)
FSC = {"voltage_range": {"low": "230:volt", "high": "280:volt"},
"area": True, "height": True, "weight": False}
SSC = {"voltage_range": {"low": "230:volt", "high": "280:volt"},
"area": True, "height": True, "weight": False}
channel0 = [FSC, SSC]
neg_controls = [{"well": well0, "volume": "100:microliter",
"captured_events": 5, "channel": channel0}]
samples = [{"well": well0,
"volume": "100:microliter", "captured_events": 9}]
p.flow_analyze(dataref, FSC, SSC, neg_controls,
samples)
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, ["Perform flow cytometry on test_plate/0 with the respective FSC and SSC channel parameters"])
self.assertEqual(forest, [[1]])
示例12: test_single_well
# 需要导入模块: from autoprotocol.protocol import Protocol [as 别名]
# 或者: from autoprotocol.protocol.Protocol import ref [as 别名]
def test_single_well(self):
p = Protocol()
test_plate = p.ref("test", None, "96-flat", discard=True)
p.fluorescence(test_plate, test_plate.well(0),
excitation="587:nanometer", emission="610:nanometer",
dataref="test_reading")
self.assertTrue(isinstance(p.instructions[0].wells, list))
示例13: test_mix_before_and_after
# 需要导入模块: from autoprotocol.protocol import Protocol [as 别名]
# 或者: from autoprotocol.protocol.Protocol import ref [as 别名]
def test_mix_before_and_after(self):
p = Protocol()
c = p.ref("test", None, "96-flat", discard=True)
with self.assertRaises(RuntimeError):
p.transfer(c.well(0), c.well(1), "10:microliter", mix_vol= "15:microliter")
p.transfer(c.well(0), c.well(1), "10:microliter", repetitions_a=21)
p.transfer(c.well(0), c.well(1), "10:microliter", repetitions=21)
p.transfer(c.well(0), c.well(1), "10:microliter", repetitions_b=21)
p.transfer(c.well(0), c.well(1), "10:microliter", flowrate_a="200:microliter/second")
p.transfer(c.well(0), c.well(1), "12:microliter", mix_after=True,
mix_vol="10:microliter", repetitions_a=20)
self.assertTrue(int(p.instructions[-1].groups[0]['transfer'][0]['mix_after']['repetitions']) == 20)
p.transfer(c.well(0), c.well(1), "12:microliter", mix_after=True,
mix_vol="10:microliter", repetitions_b=20)
self.assertTrue(int(p.instructions[-1].groups[-1]['transfer'][0]['mix_after']['repetitions']) == 10)
p.transfer(c.well(0), c.well(1), "12:microliter", mix_after=True)
self.assertTrue(int(p.instructions[-1].groups[-1]['transfer'][0]['mix_after']['repetitions']) == 10)
self.assertTrue(str(p.instructions[-1].groups[-1]['transfer'][0]['mix_after']['speed']) == "100:microliter/second")
self.assertTrue(str(p.instructions[-1].groups[-1]['transfer'][0]['mix_after']['volume']) == "6.0:microliter")
p.transfer(c.well(0), c.well(1), "12:microliter", mix_before=True,
mix_vol="10:microliter", repetitions_b=20)
self.assertTrue(int(p.instructions[-1].groups[-1]['transfer'][-1]['mix_before']['repetitions']) == 20)
p.transfer(c.well(0), c.well(1), "12:microliter", mix_before=True,
mix_vol="10:microliter", repetitions_a=20)
self.assertTrue(int(p.instructions[-1].groups[-1]['transfer'][-1]['mix_before']['repetitions']) == 10)
p.transfer(c.well(0), c.well(1), "12:microliter", mix_before=True)
self.assertTrue(int(p.instructions[-1].groups[-1]['transfer'][-1]['mix_before']['repetitions']) == 10)
self.assertTrue(str(p.instructions[-1].groups[-1]['transfer'][-1]['mix_before']['speed']) == "100:microliter/second")
self.assertTrue(str(p.instructions[-1].groups[-1]['transfer'][-1]['mix_before']['volume']) == "6.0:microliter")
示例14: test_one_tip
# 需要导入模块: from autoprotocol.protocol import Protocol [as 别名]
# 或者: from autoprotocol.protocol.Protocol import ref [as 别名]
def test_one_tip(self):
p = Protocol()
c = p.ref("test", None, "96-flat", discard=True)
p.transfer(c.wells_from(0, 2), c.wells_from(2, 2), "20:microliter",
one_tip=True)
self.assertEqual(c.well(2).volume, c.well(3).volume)
self.assertEqual(1, len(p.instructions[0].groups))
示例15: test_single_transfer
# 需要导入模块: from autoprotocol.protocol import Protocol [as 别名]
# 或者: from autoprotocol.protocol.Protocol import ref [as 别名]
def test_single_transfer(self):
p = Protocol()
c = p.ref("test", None, "96-flat", discard=True)
p.transfer(c.well(0), c.well(1), "20:microliter")
self.assertEqual(Unit(20, "microliter"), c.well(1).volume)
self.assertEqual(None, c.well(0).volume)
self.assertTrue("transfer" in p.instructions[-1].groups[-1])