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


Python Utilities.patient_id_to_family方法代码示例

本文整理汇总了Python中utilities.Utilities.patient_id_to_family方法的典型用法代码示例。如果您正苦于以下问题:Python Utilities.patient_id_to_family方法的具体用法?Python Utilities.patient_id_to_family怎么用?Python Utilities.patient_id_to_family使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在utilities.Utilities的用法示例。


在下文中一共展示了Utilities.patient_id_to_family方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: CompoundHets

# 需要导入模块: from utilities import Utilities [as 别名]
# 或者: from utilities.Utilities import patient_id_to_family [as 别名]

#.........这里部分代码省略.........
                    gene_list.append(variant.gene)
                    # Keep a lookback of 5 genes to account for gene overlaps
                    if len(current_genes) > self.lookback:
                        to_process = gene_list.pop(0)
                        self.process_gene(current_genes[to_process])
                        del current_genes[to_process]
                current_genes[variant.gene].append(variant)
        for gene in current_genes:
            self.process_gene(current_genes[gene])

    # Get any het calls for a gene and print the results
    # Input:
    #   gene: A list of variants (Variant objects) within a gene
    # Return:
    #   Nothing
    def process_gene(self, gene):
        if self.debug:
            print("Processing gene")
        hets = self.check_gene(gene)
        if hets:
            self.print_hets(hets)

    # For each gene in the gene list, check whether each sample has a compound het pair within the gene
    # Input:
    #   genes: dictionary of lists of Variants
    # Return:
    #   samples: dictionary of lists of tuples of Variants
    #   positions: A list of tuples of variants
    def check_gene(self, gene):
        hets = []
        identified_pairs = []
        for v1 in gene:
            for patient_id in v1.from_father_affected + v1.from_father_unaffected:
                family_id = self.Utils.patient_id_to_family(patient_id)
                if not self.families[family_id].members[patient_id].has_disease():
                    continue
                for v2 in gene:
                    if v1.pos == v2.pos:
                        continue
                    if v2.has_maternal(patient_id):
                        key = "-".join(sorted([v1.pos, v2.pos, self.Utils.patient_id_to_family(patient_id)]))
                        het = CompoundHet(patient_id, v2, v1, self.families)
                        if not key in identified_pairs:
                            if self.transcript:
                                if v1.transcript == v2.transcript:
                                    hets.append(het)
                                    identified_pairs.append(key)
                            else:
                                hets.append(het)
                                identified_pairs.append(key)
        return hets

    # Print out the hets - debugging function
    # input:
    #   hets: a CompoundHet object
    def print_hets(self, hets):
        for h in hets:
            h.print_aggregate(self.aggregate_file)
            h.print_family(self.output, self.prefix)

    # Create output folder and initialize all output files with headers
    # input:
    #   output: the output directory
    #   families: A dictionary of Family objects.  Family IDs are the keys of the dictionary.
    def setup_output(self, output, families):
        # Due to popular demand this has been removed.
开发者ID:gregmcinnes,项目名称:compound-het-calculator,代码行数:70,代码来源:compound-hets.py


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