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


Python Stats.report方法代码示例

本文整理汇总了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)
开发者ID:ian1roberts,项目名称:amptools,代码行数:32,代码来源:main.py

示例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)
开发者ID:ian1roberts,项目名称:amptools,代码行数:26,代码来源:main.py


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