当前位置: 首页>>代码示例>>Python>>正文


Python Report.merge方法代码示例

本文整理汇总了Python中pbcommand.models.report.Report.merge方法的典型用法代码示例。如果您正苦于以下问题:Python Report.merge方法的具体用法?Python Report.merge怎么用?Python Report.merge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pbcommand.models.report.Report的用法示例。


在下文中一共展示了Report.merge方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_merge

# 需要导入模块: from pbcommand.models.report import Report [as 别名]
# 或者: from pbcommand.models.report.Report import merge [as 别名]
 def test_merge(self):
     EXPECTED_VALUES = {
         "n_reads": 300,
         "n_zmws": 60,
     }
     NAMES = {
         "n_reads": "Number of reads",
         "n_zmws": "Number of ZMWs"
     }
     chunks = [
         Report("pbcommand_test",
             attributes=[
                 Attribute(id_="n_reads", value=50, name="Number of reads"),
                 Attribute(id_="n_zmws", value=10, name="Number of ZMWs")],
             dataset_uuids=["12345"]),
         Report("pbcommand_test",
             attributes=[
                 Attribute(id_="n_reads", value=250, name="Number of reads"),
                 Attribute(id_="n_zmws", value=50, name="Number of ZMWs")]),
     ]
     r = Report.merge(chunks)
     self.assertEqual([a.id for a in r.attributes], ["n_reads", "n_zmws"])
     self.assertEqual(r._dataset_uuids, ["12345"])
     for attr in r.attributes:
         self.assertEqual(attr.value, EXPECTED_VALUES[attr.id])
         self.assertEqual(attr.name, NAMES[attr.id])
     for table in r.tables:
         for column in table.columns:
             self.assertEqual(column.header, NAMES[column.id])
开发者ID:mpkocher,项目名称:pbcommand,代码行数:31,代码来源:test_models_report.py

示例2: test_merge_tables

# 需要导入模块: from pbcommand.models.report import Report [as 别名]
# 或者: from pbcommand.models.report.Report import merge [as 别名]
 def test_merge_tables(self):
     names = ["laa_report1.json", "laa_report2.json"]
     r = Report.merge([_to_report(names[0]), _to_report(names[1])])
     table = r.tables[0]
     self.assertEqual(len(table.columns), 7)
     self.assertEqual(
         [col.header for col in table.columns],
         [
             "BarcodeName",
             "FastaName",
             "CoarseCluster",
             "Phase",
             "TotalCoverage",
             "SequenceLength",
             "PredictedAccuracy",
         ],
     )
     for col in table.columns:
         self.assertEqual(len(col.values), 4)
         if col.header == "BarcodeName":
             self.assertEqual(col.values, ["Barcode1", "Barcode2", "Barcode4", "Barcode3"])
         elif col.header == "FastaName":
             self.assertEqual(col.values, ["BarcodeFasta1", "BarcodeFasta2", "BarcodeFasta4", "BarcodeFasta3"])
         else:
             self.assertEqual(col.values, [1, 2, 4, 3])
开发者ID:tperelmuter,项目名称:pbcommand,代码行数:27,代码来源:test_models_report.py

示例3: gather_report

# 需要导入模块: from pbcommand.models.report import Report [as 别名]
# 或者: from pbcommand.models.report.Report import merge [as 别名]
def gather_report(json_files, output_file):
    """
    Combines statistics (usually raw counts) stored as JSON files.
    Data models: pbcommand.models.report
    """
    reports = [ load_report_from_json(fn) for fn in json_files ]
    merged = Report.merge(reports)
    with open(output_file, "w") as writer:
        writer.write(merged.to_json())
    return output_file
开发者ID:lpp1985,项目名称:lpp_Script,代码行数:12,代码来源:gather.py

示例4: test_merge

# 需要导入模块: from pbcommand.models.report import Report [as 别名]
# 或者: from pbcommand.models.report.Report import merge [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)
开发者ID:gconcepcion,项目名称:pbcommand,代码行数:13,代码来源:test_models_report.py

示例5: test_merge_tables

# 需要导入模块: from pbcommand.models.report import Report [as 别名]
# 或者: from pbcommand.models.report.Report import merge [as 别名]
 def test_merge_tables(self):
     names = ['laa_report1.json', 'laa_report2.json']
     r = Report.merge([_to_report(names[0]), _to_report(names[1])])
     table = r.tables[0]
     self.assertEqual(len(table.columns), 7)
     self.assertEqual(
         [col.header for col in table.columns],
         ['BarcodeName', 'FastaName', 'CoarseCluster', 'Phase',
          'TotalCoverage', 'SequenceLength', 'PredictedAccuracy'])
     for col in table.columns:
         self.assertEqual(len(col.values), 4)
         if col.header == 'BarcodeName':
             self.assertEqual(
                 col.values,
                 ['Barcode1', 'Barcode2', 'Barcode4', 'Barcode3'])
         elif col.header == 'FastaName':
             self.assertEqual(
                 col.values,
                 ['BarcodeFasta1', 'BarcodeFasta2', 'BarcodeFasta4',
                  'BarcodeFasta3'])
         else:
             self.assertEqual(col.values, [1, 2, 4, 3])
开发者ID:mpkocher,项目名称:pbcommand,代码行数:24,代码来源:test_models_report.py

示例6: gather_report

# 需要导入模块: from pbcommand.models.report import Report [as 别名]
# 或者: from pbcommand.models.report.Report import merge [as 别名]
def gather_report(json_files, output_file):
    """
    Combines statistics (usually raw counts) stored as JSON files.
    Data models: pbcommand.models.report
    """
    reports = [ load_report_from_json(fn) for fn in json_files ]
    merged = Report.merge(reports)
    total_num_flnc_bases = 0
    total_num_flnc = 0
    for r in reports:
        attrs = {a.id:a.value for a in r.attributes}
        num_flnc = attrs["num_flnc"]
        num_flnc_bases = attrs["num_flnc_bases"]
        total_num_flnc += num_flnc
        total_num_flnc_bases += num_flnc_bases
    if total_num_flnc > 0:
        for a in merged.attributes:
            if a.id == "avg_flnc_len":
                # mimicking pbtranscript.io.Summary
                a._value = int(total_num_flnc_bases / total_num_flnc)
                log.info("Setting avg_flnc_len = {v}".format(v=a.value))
    with open(output_file, "w") as writer:
        writer.write(merged.to_json())
    return output_file
开发者ID:lpp1985,项目名称:lpp_Script,代码行数:26,代码来源:gather_isoseq_classify_report.py


注:本文中的pbcommand.models.report.Report.merge方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。