genotypes_service.py 文件源码

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

项目:varapp-backend-py 作者: varapp 项目源码 文件源码
def _init_genotypes(self):
        """Construct an array of genotype vectors, one per variant.
           If it is found in cache, use the cached version,
           otherwise recompute it and cache the result.
           Either way, store a copy in local process memory.
        """
        if self.genotypes_key in self.cache:
            # Read cache, store in local memory
            self._gt_types_bit = self._get_genotypes()
        else:
            # Regenerate, cache, and store in local memory
            gt_types = extract_genotypes(db=self.db)
            f = np.vectorize(variant_build_gt_type_bit, otypes=[np.uint8])  # apply to all array elements
            self._gt_types_bit = f(gt_types)
            self._gt_types_bit.flags.writeable = False  # make it immutable
            self._save_genotypes(self._gt_types_bit)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号