本文整理汇总了Python中pbcommand.models.report.Report.from_simple_dict方法的典型用法代码示例。如果您正苦于以下问题:Python Report.from_simple_dict方法的具体用法?Python Report.from_simple_dict怎么用?Python Report.from_simple_dict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pbcommand.models.report.Report
的用法示例。
在下文中一共展示了Report.from_simple_dict方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_merge
# 需要导入模块: from pbcommand.models.report import Report [as 别名]
# 或者: from pbcommand.models.report.Report import from_simple_dict [as 别名]
def test_merge(self):
r = Report.merge([
Report.from_simple_dict("pbcommand_test",
{"n_reads": 50, "n_zmws": 10},
"pbcommand"),
Report.from_simple_dict("pbcommand_test",
{"n_reads": 250, "n_zmws": 50},
"pbcommand")])
attr = {a.id: a.value for a in r.attributes}
self.assertEqual(attr['pbcommand_n_reads'], 300)
self.assertEqual(attr['pbcommand_n_zmws'], 60)
示例2: resolved_tool_contract_runner
# 需要导入模块: from pbcommand.models.report import Report [as 别名]
# 或者: from pbcommand.models.report.Report import from_simple_dict [as 别名]
def resolved_tool_contract_runner(rtc):
opts = rtc.task.options
# XXX to handle chunking I am simply re-using the old i/N arguments, but
# embedded in the input pickle instead of passed on the command line
final_pickle_fn = rtc.task.input_files[2]
_tmp = cPickle.load(open(final_pickle_fn, 'rb'))
i_chunk = 0
n_chunks = 1
if "__chunk_i" in _tmp:
i_chunk = _tmp['__chunk_i']
n_chunks = _tmp['__chunk_n']
final_pickle_fn = _tmp['pickle_file']
output_dir = os.path.dirname(final_pickle_fn)
IceFiles.final_consensus_fa = property(
lambda self: rtc.task.input_files[1])
IceFiles.final_pickle_fn = property(lambda self: final_pickle_fn)
IceFiles.nfl_all_pickle_fn = property(lambda self: rtc.task.input_files[3])
iceq = IceQuiverRTC(
root_dir=output_dir,
subread_set=rtc.task.input_files[0],
nproc=rtc.task.nproc)
iceq.validate_inputs()
iceq.process_chunk_i(i=i_chunk, num_chunks=n_chunks)
with open(rtc.task.output_files[0], 'w') as f:
report = Report.from_simple_dict(
report_id="isoseq_ice_quiver",
raw_d={'n_chunks': 1},
namespace="ice_quiver")
f.write(report.to_json())
return 0
示例3: test_from_simple_dict
# 需要导入模块: from pbcommand.models.report import Report [as 别名]
# 或者: from pbcommand.models.report.Report import from_simple_dict [as 别名]
def test_from_simple_dict(self):
r = Report.from_simple_dict("pbcommand_test", {"n_reads": 50},
"pbcommand")
json_dict = json.loads(r.to_json())
self.assertEqual(json_dict['attributes'], [
{
"id": "pbcommand_test.pbcommand_n_reads",
"name": "n_reads",
"value": 50
},
])
示例4: _write_stats_to_json
# 需要导入模块: from pbcommand.models.report import Report [as 别名]
# 或者: from pbcommand.models.report.Report import from_simple_dict [as 别名]
def _write_stats_to_json(stats, output_json):
with open(output_json, "w") as w:
w.write(Report.from_simple_dict(report_id="pbcommand_test", raw_d=stats, namespace="pb").to_json())