genotype_filters.py 文件源码

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

项目:varapp-backend-py 作者: varapp 项目源码 文件源码
def scan_genotypes(self, genotypes, sub_ids=None, db=None):
        """Pass through all genotypes and return only the indices of those that pass the filter.
        :param genotypes: np.ndarray[uint64, dim=2]
        :rtype: np.ndarray[uint64]"""
        if self.shortcut:
            return np.zeros(0)
        N = len(genotypes)
        if sub_ids is not None:
            variant_ids = sub_ids
        elif self.val == 'x_linked' and db:
            variant_ids = genotypes_service(db).chrX
        else:
            variant_ids = np.asarray(range(1,N+1), dtype=np.uint64)
        active_idx = np.asarray(self.ss.active_idx, dtype=np.uint16)
        conditions = self.conditions_vector
        is_and = self.merge_op == AND
        if len(conditions) == 0:
            passing = variant_ids
        else:
            passing = self.parallel_apply_bitwise(genotypes, variant_ids, conditions, active_idx, is_and)
        return passing
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号