本文整理汇总了Python中pbcore.io.ContigSet.close方法的典型用法代码示例。如果您正苦于以下问题:Python ContigSet.close方法的具体用法?Python ContigSet.close怎么用?Python ContigSet.close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pbcore.io.ContigSet
的用法示例。
在下文中一共展示了ContigSet.close方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: makeReport
# 需要导入模块: from pbcore.io import ContigSet [as 别名]
# 或者: from pbcore.io.ContigSet import close [as 别名]
def makeReport(inReadsFN, inSummaryFN, outDir):
"""
Generate a report with ID, tables, attributes and plot groups.
inReadsFN --- an input FASTA file which has all consensus
isoforms produced by pbtranscript.py cluster.
This file is required to plot a read length histogram as part of
the report:
consensus_isoforms_readlength_hist.png
inSummaryFN --- a summary TXT file with cluster attributes,
including two attributes:
number of consensus isoforms
average length of consensus isoforms
Attributes of the report are extracted from this file.
"""
log.info("Plotting read length histogram from file: {f}".
format(f=inReadsFN))
# Collect read lengths of
reader = ContigSet(inReadsFN)
rs = [len(r.sequence) for r in reader]
reader.close()
readlengths = np.array(rs)
# Plot read length histogram
readlength_plot = create_readlength_plot(readlengths, outDir)
readlength_group = PlotGroup(Constants.PG_READLENGTH,
title="Read Length of Consensus Isoforms Reads",
plots=[readlength_plot],
thumbnail=readlength_plot.thumbnail)
log.info("Plotting summary attributes from file: {f}".
format(f=inSummaryFN))
# Produce attributes based on summary.
dataset_uuids = [ContigSet(inReadsFN).uuid]
if inSummaryFN.endswith(".json"):
attributes = _report_to_attributes(inSummaryFN)
r = load_report_from_json(inSummaryFN)
# FIXME(nechols)(2016-03-22) not using the dataset UUIDs from these
# reports; should we be?
else:
attributes = summaryToAttributes(inSummaryFN)
table = attributesToTable(attributes)
log.info(str(table))
# A report is consist of ID, tables, attributes, and plotgroups.
report = Report(Constants.R_ID,
title="Transcript Clustering",
attributes=attributes,
plotgroups=[readlength_group],
dataset_uuids=dataset_uuids)
return report
示例2: makeReport
# 需要导入模块: from pbcore.io import ContigSet [as 别名]
# 或者: from pbcore.io.ContigSet import close [as 别名]
def makeReport(inReadsFN, hq_isoforms_fq, lq_isoforms_fq, inSummaryFN, outDir):
"""
Generate a report with ID, tables, attributes and plot groups.
inReadsFN --- an input FASTA file which has all consensus
isoforms produced by pbtranscript.py cluster.
This file is required to plot a read length histogram as part of
the report:
consensus_isoforms_readlength_hist.png
hq_isoforms_fq/lq_isoforms_lq --- input FASTQ files which has
all HQ/LQ isoforms produced by pbtranscript.py cluster.
These two files will be required to plot the average QV histograms:
hq_lq_isoforms_avgqv_hist.png
inSummaryFN --- a summary TXT file with cluster attributes,
including two attributes:
number of consensus isoforms
average length of consensus isoforms
Attributes of the report are extracted from this file.
"""
log.info("Plotting read length histogram from file: {f}".
format(f=inReadsFN))
# Collect read lengths of
reader = ContigSet(inReadsFN)
rs = [len(r.sequence) for r in reader]
reader.close()
readlengths = np.array(rs).astype(float)
# Plot read length histogram
readlength_plot = create_readlength_plot(readlengths, outDir)
readlength_group = PlotGroup(Constants.PG_READLENGTH,
plots=[readlength_plot],
thumbnail=readlength_plot.thumbnail)
# Collect average qvs
hq_qvs = [np.mean(r.quality) for r in ContigSet(hq_isoforms_fq)]
lq_qvs = [np.mean(r.quality) for r in ContigSet(lq_isoforms_fq)]
avgqvs = np.array(hq_qvs + lq_qvs)
# Plot average qv histogram
avgqv_plot = create_avgqv_plot(avgqvs, outDir)
avgqv_group = PlotGroup(Constants.PG_AVGQV,
plots=[avgqv_plot],
thumbnail=avgqv_plot.thumbnail)
log.info("Plotting summary attributes from file: {f}".
format(f=inSummaryFN))
# Produce attributes based on summary.
dataset_uuids = [ContigSet(inReadsFN).uuid]
attributes = _report_to_attributes(inSummaryFN)
r = load_report_from_json(inSummaryFN)
# FIXME(nechols)(2016-03-22) not using the dataset UUIDs from these
# reports; should we be?
table = attributesToTable(attributes)
log.info(str(table))
# A report is consist of ID, tables, attributes, and plotgroups.
report = Report(Constants.R_ID,
attributes=attributes,
plotgroups=[readlength_group, avgqv_group],
dataset_uuids=dataset_uuids)
return spec.apply_view(report)