def run(self): """Run the consuming""" proc_name = self.name if self.verbosity: print('%s: Starting!' % proc_name) while True: # A batch is a dictionary on the form {gene:{variant_id:variant_dict}} next_batch = self.task_queue.get() # if self.verbosity: # if self.results_queue.full(): # print('Batch results queue Full! %s' % proc_name) # if self.task_queue.full(): # print('Variant queue full! %s' % proc_name) if next_batch is None: self.task_queue.task_done() if self.verbosity: print('%s: Exiting' % proc_name) break genetic_models.check_genetic_models(next_batch, self.family, self.verbosity, self.phased, proc_name) # Make shure we only have one copy of each variant: fixed_variants = self.fix_variants(next_batch) # Now we want to make versions of the variants that are ready for printing. self.make_print_version(fixed_variants) self.results_queue.put(fixed_variants) self.task_queue.task_done() return
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)
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)
def setup_class(self): """Setup a simple family with family id 1, sick son id 1 and a healthy mother with id 3""" # Setup family with sick kid, sick father and healthy mother: self.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) self.duo_family.add_individual(sick_son) self.duo_family.add_individual(healthy_mother) # This is a dummy phased interval: interval = [1,100, '1'] intervals = {ind_id:interval_tree.IntervalTree([interval], 1, 100) for ind_id in self.duo_family.individuals} #Setup two variants with autosomal recessive compound pattern self.recessive_comp_simple_1 = {'CHROM':'1', 'POS':'5', 'ALT':'A', 'REF':'C', 'ID':'rs2230749', '1':'0|1', '3':'0|0'} self.recessive_comp_simple_2 = {'CHROM':'1', 'POS':'10', 'ALT':'C', 'REF':'T', 'ID':'.', '1':'1|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', '3':'1|0'} self.recessive_comp_not_simple_2 = {'CHROM':'1', 'POS':'17', 'ALT':'C', 'REF':'T', 'ID':'.', '1':'1|0', '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', '3':'0|0'} self.not_recessive_comp_2 = {'CHROM':'1', 'POS':'35', 'ALT':'C', 'REF':'T', 'ID':'.', '1':'0|1', '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', '3':'0|0'} self.recessive_comp_missing_2 = {'CHROM':'1', 'POS':'57', 'ALT':'C', 'REF':'T', 'ID':'.', '1':'1|0', '3':'./.'} 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}, 'DBC':{'1_45_A_C':self.recessive_comp_missing_1, '1_57_C_T':self.recessive_comp_missing_2}, 'CBC':{'1_27_G_T':self.not_recessive_comp_1, '1_35_C_T':self.not_recessive_comp_2} } batch['haploblocks'] = intervals pp(self.duo_family) pp(batch) pp(sys.path) genetic_models.check_genetic_models(batch, self.duo_family, phased=True)
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)
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)
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)
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)