Beispiel #1
0
    def setup_class(self):
        """Setup a simple family with family id 1, sick son id 1,
         healthy father id 2, healthy mother id 3"""
        # Setup family with sick kid, sick father and healthy mother:
        self.recessive_family = family.Family(family_id = '1')
        sick_daughter = individual.Individual(ind='1', family='1',mother='3', father='2', sex=2, phenotype=2)
        healthy_father = individual.Individual(ind='2', family='1',mother='0', father='0', sex=1, phenotype=1)
        healthy_mother = individual.Individual(ind='3', family='1',mother='0', father='0', sex=2, phenotype=1)
        
        self.recessive_family.add_individual(healthy_father)
        self.recessive_family.add_individual(sick_daughter)
        self.recessive_family.add_individual(healthy_mother)
        
        self.x_recessive_dn_variant = {'CHROM':'X', 'POS':'5', 'ALT':'A', 'REF':'C', 'ID':'rs2230749', '1':'0/1', '2':'0/0', '3':'0/0'}
        
        self.x_recessive_missing = {'CHROM':'X', 'POS':'10', 'ALT':'C', 'REF':'T', 'ID':'.', '1':'1/1', '2':'0/0', '3':'./.'}
        
        self.x_recessive_variant = {'CHROM':'X', 'POS':'13', 'ALT':'A', 'REF':'C', 'ID':'rs2230749', '1':'1/1', '2':'0/0', '3':'0/1'}

        self.not_x_recessive = {'CHROM':'X', 'POS':'15', 'ALT':'C', 'REF':'T', 'ID':'.', '1':'0/1', '2':'./.', '3':'1/1'}

        
        #This batch simulates one genewith all above variants:
        batch = {'ABC':{'X_5_A_C':self.x_recessive_dn_variant, 'X_10_C_T':self.x_recessive_missing,
             'X_13_A_C':self.x_recessive_variant, 'X_15_C_T':self.not_x_recessive}}
        
        genetic_models.check_genetic_models(batch, self.recessive_family, verbose=True)
Beispiel #2
0
    def setup_class(self):
        """Setup a simple family with family id 1, sick son id 1,
         healthy father id 2, healthy mother id 3"""
        # Setup family with sick kid, sick father and healthy mother:
        self.recessive_family = family.Family(family_id = '1')
        sick_son = individual.Individual(ind='1', family='1',mother='3', father='2', sex=1, phenotype=2)
        healthy_father = individual.Individual(ind='2', family='1',mother='0', father='0', sex=1, phenotype=1)
        healthy_mother = individual.Individual(ind='3', family='1',mother='0', father='0', sex=2, phenotype=1)
        self.recessive_family.add_individual(healthy_father)
        self.recessive_family.add_individual(sick_son)
        self.recessive_family.add_individual(healthy_mother)
        
        interval = [1,100, '1']
        intervals = {ind_id:interval_tree.IntervalTree([interval], 1, 100) for ind_id in self.recessive_family.individuals}
        
        #Setup two variants with only autosomal recessive pattern
        self.recessive_comp_simple_1 = {'CHROM':'1', 'POS':'5', 'ALT':'A', 'REF':'C', 'ID':'rs2230749',
                                                 '1':'0|1', '2':'0|1', '3':'0|0'}
        
        self.recessive_comp_simple_2 = {'CHROM':'1', 'POS':'10', 'ALT':'C', 'REF':'T', 'ID':'.', 
                                                '1':'1|0', '2':'0|0', '3':'0|1'}

        #Setup two variants that parents have but on same allele
        self.recessive_comp_not_simple_1 = {'CHROM':'1', 'POS':'15', 'ALT':'A', 'REF':'C', 'ID':'.',
                                                    '1':'0|1', '2':'0|1', '3':'1|0'}
        
        self.recessive_comp_not_simple_2 = {'CHROM':'1', 'POS':'17', 'ALT':'C', 'REF':'T', 'ID':'.', 
                                                    '1':'1|0', '2':'0|1', '3':'1|0'}
        
        #This one should not be recessive since the sick have both variants on same allele:
        self.not_recessive_comp_1 =  {'CHROM':'1', 'POS':'27', 'ALT':'G', 'REF':'T', 'ID':'.', 
                                        '1':'0|1', '2':'0|1', '3':'0|0'}

        self.not_recessive_comp_2 = {'CHROM':'1', 'POS':'35', 'ALT':'C', 'REF':'T', 'ID':'.', 
                                        '1':'0|1', '2':'0|0', '3':'0|1'}
        
        #Setup two variants that parents have but on same allele
        self.recessive_comp_missing_1 = {'CHROM':'1', 'POS':'45', 'ALT':'A', 'REF':'C', 'ID':'.',
                                                    '1':'0|1', '2':'./.', '3':'1|0'}
        
        self.recessive_comp_missing_2 = {'CHROM':'1', 'POS':'47', 'ALT':'C', 'REF':'T', 'ID':'.', 
                                                    '1':'1|0', '2':'0|1', '3':'1|0'}
        
        batch = {'ABC':{'1_5_A_C':self.recessive_comp_simple_1, '1_10_C_T':self.recessive_comp_simple_2},
                'BBC':{'1_15_A_C':self.recessive_comp_not_simple_1, '1_17_C_T':self.recessive_comp_not_simple_2},
                'CBC':{'1_27_G_T':self.not_recessive_comp_1, '1_35_C_T':self.not_recessive_comp_2},
                'DBC':{'1_45_A_C':self.recessive_comp_missing_1, '1_47_C_T':self.recessive_comp_missing_2}
                }
        
        batch['haploblocks'] = intervals
        genetic_models.check_genetic_models(batch, self.recessive_family, phased=True)
Beispiel #3
0
 def setup_class(self):
     """Setup a simple family with family id 1, sick daughter id 1, healthy father id 2, healthy mother id 3"""
     # Create a family
     self.fam_id = '1'
     self.family = family.Family(family_id=self.fam_id)
     # Create a sick daughter:
     self.daughter = individual.Individual(ind='1',
                                           family=self.fam_id,
                                           mother='3',
                                           father='2',
                                           sex=2,
                                           phenotype=2)
     # Create a healthy son:
     self.son = individual.Individual(ind='4',
                                      family=self.fam_id,
                                      mother='3',
                                      father='2',
                                      sex=1,
                                      phenotype=1)
     # Create a healthy father
     self.father = individual.Individual(ind='2',
                                         family=self.fam_id,
                                         mother='0',
                                         father='0',
                                         sex=1,
                                         phenotype=1)
     # Create a healthy mother
     self.mother = individual.Individual(ind='3',
                                         family=self.fam_id,
                                         mother='0',
                                         father='0',
                                         sex=2,
                                         phenotype=1)
     self.family.add_individual(self.daughter)
     self.family.add_individual(self.son)
     self.family.add_individual(self.father)
     self.family.add_individual(self.mother)
     self.family.family_check()
Beispiel #4
0
def main():
    from ped_parser import family, individual
    from interval_tree import interval_tree
    from vcf_parser import genotype
    
    duo_family = family.Family(family_id = '1')
    sick_son = individual.Individual(ind='1', family='1',mother='3', father='0', sex=1, phenotype=2)
    healthy_mother = individual.Individual(ind='3', family='1',mother='0', father='0', sex=2, phenotype=1)
    duo_family.add_individual(sick_son)
    duo_family.add_individual(healthy_mother)
    
    pp(duo_family.individuals)
    intervals = {ind_id:interval_tree.IntervalTree([[1,100, '1']], 1, 100) for ind_id in duo_family.individuals}

    pp(intervals)
    
    #Setup two variants with autosomal recessive compound pattern
    recessive_comp_simple_1 = {'CHROM':'1', 'POS':'5', 'ALT':'A', 'REF':'C', 'ID':'rs2230749',
                             '1':'0|1', '3':'0|0'}
    genotypes = {'1':genotype.Genotype('0|1'), '3':genotype.Genotype('0|0')}
    recessive_comp_simple_1['genotypes'] = genotypes
    
    recessive_comp_simple_2 = {'CHROM':'1', 'POS':'10', 'ALT':'C', 'REF':'T', 'ID':'.', 
                            '1':'1|0', '3':'0|1'}
    genotypes = {'1':genotype.Genotype('1|0'), '3':genotype.Genotype('0|1')}
    recessive_comp_simple_2['genotypes'] = genotypes
    
    
    batch = {'ABC':{'1_5_A_C':recessive_comp_simple_1, '1_10_C_T':recessive_comp_simple_2}}
    batch['haploblocks'] = intervals
    
    check_genetic_models(batch, duo_family, phased=True)
    for gene in batch:
        # pp(batch[gene])
        for variant in batch[gene]:
            pp(batch[gene][variant])
            for ind in batch[gene][variant]['genotypes']:
                print(ind, batch[gene][variant]['genotypes'][ind].__dict__)
Beispiel #5
0
    def setup_class(self):
        """Setup a simple family with family id 1, sick son id 1,
         healthy father id 2, healthy mother id 3"""
        # Setup family with sick kid, sick father and healthy mother:
        self.recessive_family = family.Family(family_id = '1')
        sick_son = individual.Individual(ind='1', family='1',mother='3', father='2', sex=1, phenotype=2)
        healthy_father = individual.Individual(ind='2', family='1',mother='0', father='0', sex=1, phenotype=1)
        healthy_mother = individual.Individual(ind='3', family='1',mother='0', father='0', sex=2, phenotype=1)
        self.recessive_family.add_individual(healthy_father)
        self.recessive_family.add_individual(sick_son)
        self.recessive_family.add_individual(healthy_mother)
        
        #Setup two variants with only autosomal recessive pattern
        self.recessive_comp_variant_1 = {'CHROM':'1', 'POS':'5', 'ALT':'A', 'REF':'C', 'ID':'rs2230749', '1':'0/1', '2':'0/1', '3':'0/0'}
        self.recessive_comp_variant_2 = {'CHROM':'1', 'POS':'10', 'ALT':'C', 'REF':'T', 'ID':'.', '1':'0/1', '2':'0/0', '3':'0/1'}
        #This one should not be recessive since both parents will have a combination:
        self.not_recessive_comp =  {'CHROM':'1', 'POS':'7', 'ALT':'G', 'REF':'T', 'ID':'.', '1':'0/1', '2':'0/1', '3':'0/1'}

        self.recessive_comp_missing = {'CHROM':'1', 'POS':'15', 'ALT':'C', 'REF':'T', 'ID':'.', '1':'0/1', '2':'0/1', '3':'./.'}
        
        batch = {'ABC':{'1_5_A_C':self.recessive_comp_variant_1, '1_10_C_T':self.recessive_comp_variant_2, '1_7_G_T':self.not_recessive_comp},
                'BBC':{'1_10_C_T':self.recessive_comp_variant_2, '1_15_C_T':self.recessive_comp_missing}}
        
        genetic_models.check_genetic_models(batch, self.recessive_family)
Beispiel #6
0
    def setup_class(self):
        """Setup a simple family with family id 1, sick son id 1,
         healthy father id 2, healthy mother id 3"""
        # Setup family with sick kid, sick father and healthy mother:
        self.dominant_family = family.Family(family_id='1')
        sick_son = individual.Individual(ind='1',
                                         family='1',
                                         mother='3',
                                         father='2',
                                         sex=1,
                                         phenotype=2)
        sick_father = individual.Individual(ind='2',
                                            family='1',
                                            mother='0',
                                            father='0',
                                            sex=1,
                                            phenotype=2)
        healthy_mother = individual.Individual(ind='3',
                                               family='1',
                                               mother='0',
                                               father='0',
                                               sex=2,
                                               phenotype=1)

        self.dominant_family.add_individual(sick_father)
        self.dominant_family.add_individual(sick_son)
        self.dominant_family.add_individual(healthy_mother)

        self.dominant_variant = {
            'CHROM': '1',
            'POS': '5',
            'ALT': 'A',
            'REF': 'C',
            'ID': 'rs2230749',
            '1': '0/1',
            '2': '0/1',
            '3': '0/0'
        }

        self.dominant_missing = {
            'CHROM': '1',
            'POS': '10',
            'ALT': 'C',
            'REF': 'T',
            'ID': '.',
            '1': '0/1',
            '2': './.',
            '3': '0/0'
        }

        self.not_dominant = {
            'CHROM': '1',
            'POS': '15',
            'ALT': 'C',
            'REF': 'T',
            'ID': '.',
            '1': '0/1',
            '2': '0/1',
            '3': '0/1'
        }

        #This batch simulates two genes, one variant is present in both genes
        batch = {
            'ABC': {
                '1_5_A_C': self.dominant_variant,
                '1_10_C_T': self.dominant_missing,
                '1_15_C_T': self.not_dominant
            }
        }

        genetic_models.check_genetic_models(batch,
                                            self.dominant_family,
                                            verbose=True)
Beispiel #7
0
    def setup_class(self):
        """Setup a simple family with family id 1, sick son id 1,
         healthy father id 2, healthy mother id 3"""
        # Setup family with sick kid, sick father and healthy mother:
        self.recessive_family = family.Family(family_id='1')
        sick_son = individual.Individual(ind='1',
                                         family='1',
                                         mother='3',
                                         father='2',
                                         sex=1,
                                         phenotype=2)
        healthy_father = individual.Individual(ind='2',
                                               family='1',
                                               mother='0',
                                               father='0',
                                               sex=1,
                                               phenotype=1)
        healthy_mother = individual.Individual(ind='3',
                                               family='1',
                                               mother='0',
                                               father='0',
                                               sex=2,
                                               phenotype=1)
        self.recessive_family.add_individual(healthy_father)
        self.recessive_family.add_individual(sick_son)
        self.recessive_family.add_individual(healthy_mother)

        #Setup two variants with only autosomal recessive pattern
        self.recessive_variant = {
            'CHROM': '1',
            'POS': '5',
            'ALT': 'A',
            'REF': 'C',
            'ID': 'rs2230749',
            '1': '1/1',
            '2': '0/1',
            '3': '0/1'
        }
        self.recessive_dn = {
            'CHROM': '1',
            'POS': '7',
            'ALT': 'G',
            'REF': 'T',
            'ID': '.',
            '1': '1/1',
            '2': '0/1',
            '3': '0/0'
        }

        self.recessive_missing = {
            'CHROM': '1',
            'POS': '10',
            'ALT': 'C',
            'REF': 'T',
            'ID': '.',
            '1': '1/1',
            '2': './.',
            '3': '0/1'
        }

        self.not_recessive = {
            'CHROM': '1',
            'POS': '15',
            'ALT': 'C',
            'REF': 'T',
            'ID': '.',
            '1': '0/1',
            '2': '0/1',
            '3': './.'
        }

        #This batch simulates two genes, one variant is present in both genes
        batch = {
            'ABC': {
                '1_5_A_C': self.recessive_variant,
                '1_10_C_T': self.recessive_missing,
                '1_7_G_T': self.recessive_dn
            },
            'BBC': {
                '1_10_C_T': self.recessive_missing,
                '1_15_C_T': self.not_recessive
            }
        }

        genetic_models.check_genetic_models(batch, self.recessive_family)