variants.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:XYalign 作者: WilsonSayresLab 项目源码 文件源码
def index_vcf(self):
        """
        Indexes vcf file using tabix.  If file does not end in .gz, will
        compress with bgzip (by calling self.compress_vcf).

        Note: Files MUST be compressed using bgzip.

        Returns
        -------

        bool
            True if successful.

        Raises
        ------

        RuntimeError
            If return code from external call is not 0.
        """
        self.logger.info("Indexing vcf file: {}".format(self.filepath))
        index_start = time.time()
        rc = subprocess.call([self.tabix, "-f", "-p", "vcf", self.filepath])
        if rc == 0:
            self.logger.info("Indexing complete. Elapsed time: {} seconds.".format(
                time.time() - index_start))
            return True
        else:
            self.logger.info("Unable to index vcf file: {}. Exiting".format(
                self.filepath))
            logging.shutdown()
            raise RuntimeError("unable to index vcf file. Exiting.")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号