本文整理汇总了Python中stats.Stats.report方法的典型用法代码示例。如果您正苦于以下问题:Python Stats.report方法的具体用法?Python Stats.report怎么用?Python Stats.report使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stats.Stats
的用法示例。
在下文中一共展示了Stats.report方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: do_mark
# 需要导入模块: from stats import Stats [as 别名]
# 或者: from stats.Stats import report [as 别名]
def do_mark(self, subcmd, opts, bamfile, amplicons):
"""${cmd_name}: Mark reads matching amplicons and optionally clip.
Walk a BAM file and mark any matching amplicons using the AM tag.
Outputs a modified BAM. Use 'clip' if you want only reads matching
amplicons in the output.
${cmd_usage}
BAMFILE: input reads (use - for stdin)
AMPLICONS: a file listing amplicons and trim locations.
${cmd_option_list}
"""
samfile = pysam.Samfile(bamfile, "rb")
stats = Stats(" ".join(sys.argv))
amplicons = load_amplicons(design, stats, opts, samfile=samfile)
outfile = pysam.Samfile(opts.outfile, "wb", template=samfile)
# we need to reopen the file here to get sequential access after computin the pileups
samfile = pysam.Samfile(bamfile, "rb")
for read in samfile:
# TODO: optimisation of the list of amplicons that are considered
for amp in amplicons:
if amp.matches(read):
amp.clip(read)
amp.mark(read)
outfile.write(read)
stats.report(sys.stderr)
示例2: do_clip
# 需要导入模块: from stats import Stats [as 别名]
# 或者: from stats.Stats import report [as 别名]
def do_clip(self, subcmd, opts, bamfile, amplicons):
"""${cmd_name}: Find and clip reads matching amplicons.
Find reads from amplicons in the input and write clipped reads to
output. Writes the AM tag for matches. Use 'mark' if you want all
input reads (including non matching) in the output.
${cmd_usage}
BAMFILE: input reads (use - for stdin)
AMPLICONS: a file listing amplicons and trim locations.
${cmd_option_list}
"""
stats = Stats(" ".join(sys.argv))
opts.clip = False
samfile = pysam.Samfile(bamfile, "rb")
amplicons = load_amplicons(design, stats, opts)
outfile = pysam.Samfile(opts.outfile, "wb", template=samfile)
for amplicon in amplicons:
trimmed = amplicon.clipped_reads(samfile, mark=True)
map(outfile.write, trimmed)
stats.report(sys.stderr)