Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(1)  |  Call(1)  |  Derive(0)  |  Import(0)

        def check_genetic_models(variant_batch, family, verbose = False, phased=False ,proc_name = None):
    #A variant batch is a dictionary on the form {gene_id: {variant_id:variant_dict}}
    # Start by getting the genotypes for each variant:
    individuals = family.individuals.values()
    intervals = variant_batch.pop('haploblocks', {})
    for gene in variant_batch:
        for variant_id in variant_batch[gene]:
            
            variant_batch[gene][variant_id]['Compounds'] = {}
            # Add information of models followed:
            variant_batch[gene][variant_id]['Inheritance_model'] = {'XR': True, 'XR_dn': True, 
                'XD': True, 'XD_dn': True, 'AD': True, 'AD_dn': True, 'AR_hom': True, 
                'AR_hom_dn': True, 'AR_comp': False, 'AR_comp_dn': False}
    # Now check the genetic models:
    for gene in variant_batch:
        compound_candidates = []
        compound_pairs = []
        # We look at compounds only when variants are in genes:
        if gene != '-':
            # First remove all variants that can't be compounds to reduce the number of lookup's:
            compound_candidates = check_compound_candidates(variant_batch[gene], family)
        
        for variant_id in variant_batch[gene]:
            
            # Only check X-linked for the variants in the X-chromosome:
            # For X-linked we do not need to check the other models
            if variant_batch[gene][variant_id]['Chromosome'] == 'X':
                check_X_recessive(variant_batch[gene][variant_id], family)
                check_X_dominant(variant_batch[gene][variant_id], family)
                variant_batch[gene][variant_id]['Inheritance_model']['AD'] = False
                variant_batch[gene][variant_id]['Inheritance_model']['AD_dn'] = False
                variant_batch[gene][variant_id]['Inheritance_model']['AR_hom'] = False
                variant_batch[gene][variant_id]['Inheritance_model']['AR_hom_dn'] = False
            else:
                variant_batch[gene][variant_id]['Inheritance_model']['XR'] = False
                variant_batch[gene][variant_id]['Inheritance_model']['XR_dn'] = False
                variant_batch[gene][variant_id]['Inheritance_model']['XD'] = False
                variant_batch[gene][variant_id]['Inheritance_model']['XD_dn'] = False
                check_dominant(variant_batch[gene][variant_id], family)
                check_recessive(variant_batch[gene][variant_id], family)
            
        if len(compound_candidates) > 1:
            
            compound_pairs = pair_generator.Pair_Generator(compound_candidates)
            for pair in compound_pairs.generate_pairs():
                # Add the compound pair id to each variant
                if check_compounds(variant_batch[gene][pair[0]], variant_batch[gene][pair[1]], family, phased, intervals):
                    variant_batch[gene][pair[0]]['Compounds'][pair[1]] = 0
                    variant_batch[gene][pair[1]]['Compounds'][pair[0]] = 0
                    variant_batch[gene][pair[0]]['Inheritance_model']['AR_comp'] = True
                    variant_batch[gene][pair[1]]['Inheritance_model']['AR_comp'] = True
    return
        


src/m/i/mip_family_analysis-0.9.3/Mip_Family_Analysis/Utils/variant_consumer.py   mip_family_analysis(Download)
                    print('%s: Exiting' % proc_name)
                break
            genetic_models.check_genetic_models(next_batch, self.family, self.verbosity, proc_name = proc_name)
            fixed_variants = self.fix_variants(next_batch)
            score_variants.score_variant(fixed_variants, self.family.models_of_inheritance)