本文整理汇总了Python中autoprotocol.protocol.Protocol.as_dict方法的典型用法代码示例。如果您正苦于以下问题:Python Protocol.as_dict方法的具体用法?Python Protocol.as_dict怎么用?Python Protocol.as_dict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类autoprotocol.protocol.Protocol
的用法示例。
在下文中一共展示了Protocol.as_dict方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: runTest
# 需要导入模块: from autoprotocol.protocol import Protocol [as 别名]
# 或者: from autoprotocol.protocol.Protocol import as_dict [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_outs
# 需要导入模块: from autoprotocol.protocol import Protocol [as 别名]
# 或者: from autoprotocol.protocol.Protocol import as_dict [as 别名]
def test_outs(self):
p = Protocol()
self.assertFalse('outs' in p.as_dict())
plate = p.ref("plate", None, "96-pcr", discard=True)
plate.well(0).set_name("test_well")
self.assertTrue(plate.well(0).name == "test_well")
self.assertTrue(list(p.as_dict()['outs'].keys()) == ['plate'])
self.assertTrue(list(list(p.as_dict()['outs'].values())[0].keys()) == ['0'])
self.assertTrue(list(p.as_dict()['outs'].values())[0]['0'] == {'name': 'test_well'})
示例3: test_web_example
# 需要导入模块: from autoprotocol.protocol import Protocol [as 别名]
# 或者: from autoprotocol.protocol.Protocol import as_dict [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]])
示例4: test_flow
# 需要导入模块: from autoprotocol.protocol import Protocol [as 别名]
# 或者: from autoprotocol.protocol.Protocol import as_dict [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]])
示例5: test_distribute_one_well
# 需要导入模块: from autoprotocol.protocol import Protocol [as 别名]
# 或者: from autoprotocol.protocol.Protocol import as_dict [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)
示例6: test_distribute_multiple_wells
# 需要导入模块: from autoprotocol.protocol import Protocol [as 别名]
# 或者: from autoprotocol.protocol.Protocol import as_dict [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)
示例7: get_synthesized_oligo_tube_protocol
# 需要导入模块: from autoprotocol.protocol import Protocol [as 别名]
# 或者: from autoprotocol.protocol.Protocol import as_dict [as 别名]
def get_synthesized_oligo_tube_protocol(tube_name, sequence):
"""
Synthesize and prepare an oligo tube
25nm seems to be more than enough for most downstream work (25pmol seems to be all that is used for transcriptic's pcr)
"""
global inv
scale = '25nm'
p = Protocol()
dna_tube = p.ref(tube_name,
cont_type="micro-1.5",
storage="cold_20", discard=False)
dna_tube.well(0).properties = {'Molar Concentration':'100uM',
'original moles':'25nm'}
p.oligosynthesize([{"sequence": sequence,
"destination": dna_tube.well(0),
"scale": scale,
"purification": "standard"}]
)
#spin
p.spin(dna_tube, '2000:g', '30:second')
#dilute to 100uM
#safe min volume of 1.5uL is 20uL so we want a lot more than this so we don't lose too much
#how do you go from scale and desired concentration to volume --> n = CV --> V = n/C --> V = 25nmol / 100uM = 25nmol / (100E3 nmol / 1L)
# = 2.5E-4 L = 250 uL
#convert 100uM to nM #convert to uL
te_volume = 25 / (100 * pow(10, 3)) * pow(10, 6)
#add 250uL
p.provision(inv["te"], dna_tube.well(0), ul(te_volume))
#spin
p.spin(dna_tube, '2000:g', '30:second')
return json.dumps(p.as_dict(), indent=2)
示例8: test_purify
# 需要导入模块: from autoprotocol.protocol import Protocol [as 别名]
# 或者: from autoprotocol.protocol.Protocol import as_dict [as 别名]
def test_purify(self):
"""
Desired Output:
1. Perform gel purification on the 0.8% agarose gel with band range(s) 0-10
2. Perform gel purification on the 0.8% agarose gel with band range(s) 0-10
3. Perform gel purification on the 0.8% agarose gel with band range(s) 0-10
"""
p = Protocol()
sample_wells = p.ref("sample_wells", None, "96-pcr",
discard=True).wells_from(0, 20)
extract_wells = [p.ref("extract_%s" % i, None, "micro-1.5",
storage="cold_4").well(0) for i in sample_wells]
extract = [
{
"source": sample_wells[i],
"band_list": [{
"band_size_range": {"min_bp": 0, "max_bp": 10},
"elution_volume": Unit("5:microliter"),
"elution_buffer": "water",
"destination": d
}],
"lane": None,
"gel": None
} for i, d in enumerate(extract_wells)
]
p.gel_purify(extract, "10:microliter",
"size_select(8,0.8%)", "ladder1", "gel_purify_test")
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 gel purification on the 0.8% agarose gel with band range(s) 0-10",
"Perform gel purification on the 0.8% agarose gel with band range(s) 0-10",
"Perform gel purification on the 0.8% agarose gel with band range(s) 0-10"])
self.assertEqual(forest, [[1, [2, [3]]]])
示例9: test_mag_collect
# 需要导入模块: from autoprotocol.protocol import Protocol [as 别名]
# 或者: from autoprotocol.protocol.Protocol import as_dict [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]])
示例10: test_dispense_suite
# 需要导入模块: from autoprotocol.protocol import Protocol [as 别名]
# 或者: from autoprotocol.protocol.Protocol import as_dict [as 别名]
def test_dispense_suite(self):
"""
Desired Output:
1. Dispense 100 microliters of water to the full plate of sample_plate5
2. Dispense corresponding amounts of water to 12 column(s) of sample_plate5
3. Dispense 50 microliters of reagent with resource ID rs17gmh5wafm5p to the full plate of sample_plate5
"""
p = Protocol()
sample_plate5 = p.ref("sample_plate5", None,
"96-flat", storage="warm_37")
p.dispense_full_plate(sample_plate5, "water", "100:microliter")
p.dispense(sample_plate5,
"water",
[{"column": 0, "volume": "10:microliter"},
{"column": 1, "volume": "20:microliter"},
{"column": 2, "volume": "30:microliter"},
{"column": 3, "volume": "40:microliter"},
{"column": 4, "volume": "50:microliter"},
{"column": 5, "volume": "60:microliter"},
{"column": 6, "volume": "70:microliter"},
{"column": 7, "volume": "80:microliter"},
{"column": 8, "volume": "90:microliter"},
{"column": 9, "volume": "100:microliter"},
{"column": 10, "volume": "110:microliter"},
{"column": 11, "volume": "120:microliter"}
])
p.dispense_full_plate(sample_plate5, "rs17gmh5wafm5p", "50:microliter", is_resource_id=True)
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
forest = parser_instance.forest_list
self.assertEqual(
parsed_output, ["Dispense 100 microliters of water to the full plate of sample_plate5",
"Dispense corresponding amounts of water to 12 column(s) of sample_plate5",
"Dispense 50 microliters of resource with resource ID rs17gmh5wafm5p to the full plate of sample_plate5"])
self.assertEqual(forest, [[1, [2, [3]]]])
示例11: test_measure_suite
# 需要导入模块: from autoprotocol.protocol import Protocol [as 别名]
# 或者: from autoprotocol.protocol.Protocol import as_dict [as 别名]
def test_measure_suite(self):
"""
Desired Output:
1. Measure concentration of 2.0 microliters DNA source aliquots
2. Measure mass of test_plate2
3. Measure volume of 12 wells from test_plate
4. Measure volume of 8 wells from test_plate2
"""
p = Protocol()
test_plate = p.ref("test_plate", None, "96-flat", storage="cold_4")
test_plate2 = p.ref("test_plate2", id=None,
cont_type="96-flat", storage=None, discard=True)
for well in test_plate2.all_wells():
well.set_volume("150:microliter")
p.measure_concentration(wells=test_plate2.wells_from(
0, 96), dataref="mc_test", measurement="DNA", volume=Unit(2, "microliter"))
p.measure_mass(test_plate2, "test_ref")
p.measure_volume(test_plate.wells_from(0, 12), "test_ref")
p.measure_volume(test_plate2.wells_from(1, 8), "test_ref2")
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, ["Measure concentration of 2.0 microliters DNA source aliquots of test_plate2",
"Measure mass of test_plate2",
"Measure volume of 12 wells from test_plate",
"Measure volume of 8 wells from test_plate2"])
self.assertEqual(forest, [[1, [2, [4]]], [3]])
示例12: test_illumina
# 需要导入模块: from autoprotocol.protocol import Protocol [as 别名]
# 或者: from autoprotocol.protocol.Protocol import as_dict [as 别名]
def test_illumina(self):
"""
Desired Output:
1. Illumina sequence wells test_plate6/0, test_plate6/1 with library size 34
"""
p = Protocol()
sample_wells6 = p.ref(
"test_plate6", None, "96-pcr", discard=True).wells_from(0, 8)
p.illuminaseq("PE", [{"object": sample_wells6[0], "library_concentration": 1.0},
{"object": sample_wells6[1], "library_concentration": 2}],
"nextseq", "mid", 'none', 34, "dataref")
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, ["Illumina sequence wells test_plate6/0, test_plate6/1 with library size 34"])
self.assertEqual(forest, [[1]])
示例13: Protocol
# 需要导入模块: from autoprotocol.protocol import Protocol [as 别名]
# 或者: from autoprotocol.protocol.Protocol import as_dict [as 别名]
import json
from autoprotocol.protocol import Protocol
from utils import ul
inv = {
'gblock_dna':'ct18vs7cmjat2c', # my inventory
'te': 'rs17pwyc754v9t', # catalog; TE
}
p = Protocol()
#existing inventory
dna_sample = p.ref("gblock_dna", id=inv['gblock_dna'], cont_type="micro-1.5", storage='cold_20')
#tubes are thawed before being placed into workcell
#Centrifuge the tube for 3-5 sec at a minimum of 3000 x g to pellet the material to the bottom of the tube.
p.spin(dna_sample, '3000:g', '5:second')
#Add 500uL TE (to reach 1 ng/uL)
p.provision(inv["te"], dna_sample.well(0), ul(500))
#Briefly vortex (here we have to use mix) and centrifuge
p.mix(dna_sample.well(0),'480:microliter',speed='480:microliter/second',repetitions=10)
p.spin(dna_sample, '3000:g', '3:second')
print(json.dumps(p.as_dict(), indent=2))