本文整理汇总了Python中autoprotocol.protocol.Protocol类的典型用法代码示例。如果您正苦于以下问题:Python Protocol类的具体用法?Python Protocol怎么用?Python Protocol使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Protocol类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: runTest
def runTest(self):
p1 = Protocol()
p2 = Protocol()
p1.spin("dummy_ref", "2000:rpm", "560:second")
self.assertEqual(len(p2.instructions), 0,
"incorrect number of instructions in empty protocol")
示例2: test_single_well
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))
示例3: test_single_transfer
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])
示例4: test_flow
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]])
示例5: test_one_tip
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))
示例6: test_duplicates_not_allowed
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)
示例7: test_one_source
def test_one_source(self):
p = Protocol()
echo = p.ref("echo", None, "384-echo", discard=True)
dest = p.ref("dest", None, "384-flat", discard=True)
p.acoustic_transfer(echo.wells(0,1).set_volume("2:microliter"),
dest.wells(0,1,2,3), "1:microliter", one_source=True)
self.assertTrue(p.instructions[-1].data["groups"][0]["transfer"][-1]["from"] == echo.well(1))
self.assertTrue(p.instructions[-1].data["groups"][0]["transfer"][0]["from"] == echo.well(0))
示例8: test_echo_max_vol
def test_echo_max_vol(self):
from autoprotocol.protocol import Protocol
p = Protocol()
echo_w = p.ref("echo", None, "384-echo", discard=True).well(0)
echo_w.set_volume("135:microliter")
assert echo_w.volume == Unit(135, "microliter")
with pytest.raises(ValueError):
echo_w.set_volume("136:microliter")
示例9: test_one_tip
def test_one_tip(self):
p = Protocol()
plateCount = 2
plateList = [p.ref("plate_%s_384" % str(x+1), None, "384-flat", discard=True) for x in range(plateCount)]
p.stamp(plateList[0], plateList[1], "330:microliter", one_tip=True)
self.assertEqual(len(p.instructions[0].groups[0]["transfer"]), 12)
self.assertEqual(len(p.instructions[0].groups), 1)
示例10: test_all_container_types
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))
示例11: test_distribute_one_well
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)
示例12: test_gt_750uL_wellgroup_transfer
def test_gt_750uL_wellgroup_transfer(self):
p = Protocol()
c = p.ref("test", None, "96-deep", discard=True)
p.transfer(
c.wells_from(0, 8, columnwise=True),
c.wells_from(1, 8, columnwise=True),
'1800:microliter'
)
self.assertEqual(
24,
len(p.instructions[0].groups)
)
示例13: test_distribute_multiple_wells
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)
示例14: test_web_example
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]])
示例15: test_single_transfers
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)