本文整理汇总了Python中pbcommand.models.report.Report.add_plotgroup方法的典型用法代码示例。如果您正苦于以下问题:Python Report.add_plotgroup方法的具体用法?Python Report.add_plotgroup怎么用?Python Report.add_plotgroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pbcommand.models.report.Report
的用法示例。
在下文中一共展示了Report.add_plotgroup方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_to_dict
# 需要导入模块: from pbcommand.models.report import Report [as 别名]
# 或者: from pbcommand.models.report.Report import add_plotgroup [as 别名]
def test_to_dict(self):
"""
The id of report sub elements is prepended with the id of the parent
element when to_dict is called.
"""
r = Report('redfang')
a = Attribute('a', 'b')
a2 = Attribute('a2', 'b2')
r.add_attribute(a)
r.add_attribute(a2)
pg = PlotGroup('pgid')
pg.add_plot(Plot('pid', 'anImg'))
pg.add_plot(Plot('pid2', 'anImg2'))
r.add_plotgroup(pg)
t = Table('tabid')
t.add_column(Column('c1'))
r.add_table(t)
d = r.to_dict()
log.debug("\n" + pformat(d))
self.assertEqual('redfang', d['id'])
self.assertEqual('redfang.a', d['attributes'][0]['id'])
self.assertEqual('redfang.a2', d['attributes'][1]['id'])
self.assertEqual('redfang.pgid', d['plotGroups'][0]['id'])
self.assertEqual('redfang.pgid.pid', d['plotGroups'][0]['plots'][0]['id'])
self.assertEqual('redfang.pgid.pid2', d['plotGroups'][0]['plots'][1]['id'])
self.assertEqual('redfang.tabid', d['tables'][0]['id'])
self.assertEqual('redfang.tabid.c1', d['tables'][0]['columns'][0]['id'])
示例2: test_to_dict_multi
# 需要导入模块: from pbcommand.models.report import Report [as 别名]
# 或者: from pbcommand.models.report.Report import add_plotgroup [as 别名]
def test_to_dict_multi(self):
"""
Multiple complex elements.
The id of report sub elements is prepended with the id of the parent
element when to_dict is called.
"""
r = Report('redfang')
a = Attribute('a', 'b')
a2 = Attribute('a2', 'b2')
r.add_attribute(a)
r.add_attribute(a2)
pg = PlotGroup('pgid')
pg.add_plot(Plot('pid', 'anImg'))
pg.add_plot(Plot('pid2', 'anImg2'))
r.add_plotgroup(pg)
pg = PlotGroup('pgid2')
pg.add_plot(Plot('pid2', 'anImg2'))
pg.add_plot(Plot('pid22', 'anImg22'))
r.add_plotgroup(pg)
t = Table('tabid')
t.add_column(Column('c1'))
r.add_table(t)
t = Table('tabid2')
t.add_column(Column('c2'))
r.add_table(t)
d = r.to_dict()
log.debug(str(d))
self.assertEqual('redfang', d['id'])
self.assertEqual('redfang.a', d['attributes'][0]['id'])
self.assertEqual('redfang.a2', d['attributes'][1]['id'])
self.assertEqual('redfang.pgid', d['plotGroups'][0]['id'])
self.assertEqual('redfang.pgid.pid', d[
'plotGroups'][0]['plots'][0]['id'])
self.assertEqual('redfang.pgid.pid2', d[
'plotGroups'][0]['plots'][1]['id'])
self.assertEqual('redfang.pgid2', d['plotGroups'][1]['id'])
self.assertEqual('redfang.pgid2.pid2', d[
'plotGroups'][1]['plots'][0]['id'])
self.assertEqual('redfang.pgid2.pid22', d[
'plotGroups'][1]['plots'][1]['id'])
self.assertEqual('redfang.tabid', d['tables'][0]['id'])
self.assertEqual('redfang.tabid.c1', d['tables'][
0]['columns'][0]['id'])
self.assertEqual('redfang.tabid2', d['tables'][1]['id'])
self.assertEqual('redfang.tabid2.c2', d[
'tables'][1]['columns'][0]['id'])
log.info(repr(r))
self.assertIsNotNone(repr(r))
示例3: make_report
# 需要导入模块: from pbcommand.models.report import Report [as 别名]
# 或者: from pbcommand.models.report.Report import add_plotgroup [as 别名]
def make_report(in_fn, out_dir='.', bounds=None, nolegend=False,
reference=None, dpi=60, name=None):
"""AlignmentToPng Report
Convert an input bam or DataSet XML file to a figure of Concordance vs.
Subread Length.
Args:
in_fn: the bam, DataSet XML or cmp.h5 file to turn into a length vs
concordance plot
out_dir: the output directory to be used with the file name or default
name: the file name to be used with the outdir or default (no full
path filenames!)
bounds: the figure limits (in xmin:xmax:ymin:ymax)
nolegend: exclude the figure legend
reference: the reference to use in the figure. Default of all
references
dpi: the dots per inch (resolution) of the figure
"""
data = _read_in_file(in_fn, reference)
report = Report('alignment_to_png_report')
if not name:
name = '%s.png' % os.path.splitext(os.path.basename(in_fn))[0]
png_fn = os.path.join(out_dir, name)
_make_plot(data, png_fn, bounds, dpi, nolegend)
plot_group = PlotGroup(Constants.PLOT_GROUP_ID,
plots=[Plot('alignment_to_png_plot',
os.path.basename(png_fn))])
report.add_plotgroup(plot_group)
return report
示例4: test_get_plotgroup_by_id_with_bad_id
# 需要导入模块: from pbcommand.models.report import Report [as 别名]
# 或者: from pbcommand.models.report.Report import add_plotgroup [as 别名]
def test_get_plotgroup_by_id_with_bad_id(self):
r = Report('redfang')
pg1 = PlotGroup('pgid1')
pg1.add_plot(Plot('pid1', 'anImg'))
r.add_plotgroup(pg1)
bad_pg = r.get_plotgroup_by_id('id_that_does_not_exist')
self.assertIsNone(bad_pg)
示例5: test_get_plotgroup_by_id
# 需要导入模块: from pbcommand.models.report import Report [as 别名]
# 或者: from pbcommand.models.report.Report import add_plotgroup [as 别名]
def test_get_plotgroup_by_id(self):
r = Report('redfang')
pg1 = PlotGroup('pgid1')
pg1.add_plot(Plot('pid1', 'anImg'))
r.add_plotgroup(pg1)
pg = r.get_plotgroup_by_id('pgid1')
self.assertEqual(pg, pg1)
示例6: test_to_dict_multi
# 需要导入模块: from pbcommand.models.report import Report [as 别名]
# 或者: from pbcommand.models.report.Report import add_plotgroup [as 别名]
def test_to_dict_multi(self):
"""
Multiple complex elements.
The id of report sub elements is prepended with the id of the parent
element when to_dict is called.
"""
r = Report("redfang")
a = Attribute("a", "b")
a2 = Attribute("a2", "b2")
r.add_attribute(a)
r.add_attribute(a2)
pg = PlotGroup("pgid")
pg.add_plot(Plot("pid", "anImg"))
pg.add_plot(Plot("pid2", "anImg2"))
r.add_plotgroup(pg)
pg = PlotGroup("pgid2")
pg.add_plot(Plot("pid2", "anImg2"))
pg.add_plot(Plot("pid22", "anImg22"))
r.add_plotgroup(pg)
t = Table("tabid")
t.add_column(Column("c1"))
r.add_table(t)
t = Table("tabid2")
t.add_column(Column("c2"))
r.add_table(t)
d = r.to_dict()
log.debug(str(d))
self.assertEqual("redfang", d["id"])
self.assertEqual("redfang.a", d["attributes"][0]["id"])
self.assertEqual("redfang.a2", d["attributes"][1]["id"])
self.assertEqual("redfang.pgid", d["plotGroups"][0]["id"])
self.assertEqual("redfang.pgid.pid", d["plotGroups"][0]["plots"][0]["id"])
self.assertEqual("redfang.pgid.pid2", d["plotGroups"][0]["plots"][1]["id"])
self.assertEqual("redfang.pgid2", d["plotGroups"][1]["id"])
self.assertEqual("redfang.pgid2.pid2", d["plotGroups"][1]["plots"][0]["id"])
self.assertEqual("redfang.pgid2.pid22", d["plotGroups"][1]["plots"][1]["id"])
self.assertEqual("redfang.tabid", d["tables"][0]["id"])
self.assertEqual("redfang.tabid.c1", d["tables"][0]["columns"][0]["id"])
self.assertEqual("redfang.tabid2", d["tables"][1]["id"])
self.assertEqual("redfang.tabid2.c2", d["tables"][1]["columns"][0]["id"])
log.info(repr(r))
self.assertIsNotNone(repr(r))
示例7: make_polished_assembly_report
# 需要导入模块: from pbcommand.models.report import Report [as 别名]
# 或者: from pbcommand.models.report.Report import add_plotgroup [as 别名]
def make_polished_assembly_report(report, gff, fastq, output_dir):
"""
Entry to report.
:param gff: (str) path to alignment_summary.gff
:param fastq: (str) path to polished fastq file
:param report: (str) report name
create a polished assembly report.
"""
log.info("Starting version {f} v{x}".format(
x=__version__, f=os.path.basename(__file__)))
log.debug("Loading {f}".format(f=fastq))
contigs = _get_contigs(fastq)
log.debug("Loading {f}".format(f=gff))
_get_contig_coverage(gff, contigs)
log.debug("Computing and creating plots")
cvqp = _coverage_vs_quality_plot(contigs, output_dir)
pgrp = PlotGroup('coverage_based',
title='Contig Coverage vs Confidence',
thumbnail=cvqp.thumbnail,
plots=[cvqp])
rep = Report('polished_assembly')
rep.add_attribute(
Attribute(Constants.A_N_CONTIGS, len(contigs),
Constants.ATTR_LABELS[Constants.A_N_CONTIGS]))
read_lengths = [c.length for c in contigs.values()]
read_lengths.sort()
rep.add_attribute(_get_att_max_contig_length(read_lengths))
rep.add_attribute(_get_att_n_50_contig_length(read_lengths))
rep.add_attribute(_get_att_sum_contig_lengths(read_lengths))
rep.add_plotgroup(pgrp)
rep.write_json(os.path.join(output_dir, report))
_write_coverage_vs_quality_csv(contigs, output_dir)
return 0