def test_parse_parents_no_mother(self):
     vcf_test = vcf(self.proband_index_QTB[0], self.number_affected_QTB[0],
                    self.mom_absent)
     self.assertEqual(
         vcf_test.parseAbsentParents(), [False, True],
         "Mother was not recognized as absent and/or father was not recognized as present."
     )
 def person_generator(self, person):
     new_person = vcf(
         self.June_Cohort[person]["index"],
         self.June_Cohort[person]["num_affected"],
         self.June_Cohort[person]["absent"], self.snv_file_June,
         self.indel_file_June, self.pedigree[0],
         "/home/alex/Documents/Frankie_Analysis/SOLVE_BRAIN_TEST/")
     new_person.computeParents()
     return new_person
 def test_compute_XL_false_one_parent_inherited_from_dad(self):
     vcf_test = vcf(self.June_Cohort["MP14-004"]["index"],
                    self.June_Cohort["MP14-004"]["num_affected"],
                    self.mom_absent)
     vcf_test.computeParents()
     self.assertFalse(
         vcf_test.computeXL(self.vcf_line_with_XL_2),
         "Compute XL did not recognize that proband has variant from father"
     )
 def test_compute_parents_june_cohort(self):
     for proband in self.June_Cohort:
         vcf_test = vcf(self.June_Cohort[proband]["index"],
                        self.June_Cohort[proband]["num_affected"],
                        self.June_Cohort[proband]["absent"])
         self.assertEqual(
             vcf_test.computeParents(),
             self.June_Cohort[proband]["parents"],
             "Parent indecies not computed correctly for June cohort")
 def test_compute_parents_no_father(self):
     for index in range(len(self.proband_index_QTB)):
         vcf_test = vcf(self.proband_index_QTB[index],
                        self.number_affected_QTB[index], self.dad_absent)
         vcf_test.parseAbsentParents()
         self.assertEqual(vcf_test.computeParents(), [
             0,
             self.proband_index_QTB[index] + self.number_affected_QTB[index]
         ])
 def test_map_return_array_length(self):
     vcf_test = vcf(self.June_Cohort["DB14-001"]["index"],
                    self.entire_cohort,
                    self.June_Cohort["DB14-001"]["absent"])
     vcf_test.computeParents()
     self.assertEqual(
         len(
             vcf_test.mapSearch("0/0",
                                self.map_return_all_ONE_ONE.split('\t'))),
         38)
 def test_map_return_all_false(self):
     vcf_test = vcf(self.June_Cohort["DB14-001"]["index"],
                    self.entire_cohort,
                    self.June_Cohort["DB14-001"]["absent"])
     vcf_test.computeParents()
     self.assertFalse(
         all(
             vcf_test.mapSearch("0/0",
                                self.map_return_all_ONE_ONE.split('\t'))),
         "Map Return thought a 0/0 existed when it did not")
 def test_map_return_all_true(self):
     vcf_test = vcf(self.June_Cohort["DB14-001"]["index"],
                    self.entire_cohort,
                    self.June_Cohort["DB14-001"]["absent"])
     vcf_test.computeParents()
     self.assertTrue(
         all(
             vcf_test.mapSearch(
                 "1/1", self.map_return_all_ONE_ONE.split('\t'))[24:]),
         "Map Return thought did not find all to be true searching for 1/1")
 def test_vcf_line_computation_homo(self):
     vcf_test = vcf(self.June_Cohort["DB14-001"]["index"],
                    self.entire_cohort,
                    self.June_Cohort["DB14-001"]["absent"])
     vcf_test.computeParents()
     returned_array = vcf_test.computeVCFLine(
         self.vcf_line_all_three_cases)['h**o']
     self.assertTrue(
         all([returned_array[24], returned_array[30]]),
         "Compute VCF lines did not find the homozygous(1/1) cases correctly"
     )
 def test_map_return_last_true_only(self):
     vcf_test = vcf(self.June_Cohort["DB14-001"]["index"],
                    self.entire_cohort,
                    self.June_Cohort["DB14-001"]["absent"])
     vcf_test.computeParents()
     returned_array = vcf_test.mapSearch(
         "0/1", self.map_return_last_true.split('\t'))
     self.assertFalse(all(returned_array[24:len(returned_array) - 1]),
                      "Map Return find a 0/1 in a sea of all 0/0")
     self.assertTrue(returned_array[len(returned_array) - 1:][0],
                     "Map Return did not find the last index to be 0/1")
 def test_vcf_line_computation_hetero(self):
     vcf_test = vcf(self.June_Cohort["DB14-001"]["index"],
                    self.entire_cohort,
                    self.June_Cohort["DB14-001"]["absent"])
     vcf_test.computeParents()
     returned_array = vcf_test.computeVCFLine(
         self.vcf_line_all_three_cases)['hetero']
     self.assertTrue(
         all([
             returned_array[26], returned_array[27], returned_array[28],
             returned_array[34], returned_array[35], returned_array[36],
             returned_array[37]
         ]),
         "Compute VCF lines did not find the absent(0/0) cases correctly")
	def test_map_return_last_true_only(self):
		vcf_test = vcf(self.June_Cohort["DB14-001"]["index"], self.entire_cohort, self.June_Cohort["DB14-001"]["absent"])
		vcf_test.computeParents()
		returned_array = vcf_test.mapSearch("0/1", self.map_return_last_true.split('\t'))
		self.assertFalse(all(returned_array[24:len(returned_array) - 1]), "Map Return find a 0/1 in a sea of all 0/0")
		self.assertTrue(returned_array[len(returned_array) - 1:][0], "Map Return did not find the last index to be 0/1")
	def test_parse_parents_both_absent(self):
		vcf_test = vcf(self.proband_index_QTB[0], self.number_affected_QTB[0], self.both_absent)
		self.assertEqual(vcf_test.parseAbsentParents(), [True, True], "Parents were not recognized as both being absent")
	def test_vcf_line_computation_absent(self):
		vcf_test = vcf(self.June_Cohort["DB14-001"]["index"], self.entire_cohort, self.June_Cohort["DB14-001"]["absent"])
		vcf_test.computeParents()
		returned_array = vcf_test.computeVCFLine(self.vcf_line_all_three_cases)['absent']
		self.assertTrue(all([returned_array[25], returned_array[29], returned_array[31], returned_array[32], returned_array[33]]), "Compute VCF lines did not find the heterozygous(0/1) cases correctly")
	def test_vcf_line_computation_hetero(self):
		vcf_test = vcf(self.June_Cohort["DB14-001"]["index"], self.entire_cohort, self.June_Cohort["DB14-001"]["absent"])
		vcf_test.computeParents()
		returned_array = vcf_test.computeVCFLine(self.vcf_line_all_three_cases)['hetero']
		self.assertTrue(all([returned_array[26], returned_array[27], returned_array[28], returned_array[34], returned_array[35], returned_array[36], returned_array[37]]), "Compute VCF lines did not find the absent(0/0) cases correctly")
	def test_compute_XL_false_one_parent_inherited_from_dad(self):
		vcf_test = vcf(self.June_Cohort["MP14-004"]["index"], self.June_Cohort["MP14-004"]["num_affected"], self.mom_absent)
		vcf_test.computeParents()
		self.assertFalse(vcf_test.computeXL(self.vcf_line_with_XL_2), "Compute XL did not recognize that proband has variant from father")
	def person_generator(self, person):
		new_person = vcf(self.June_Cohort[person]["index"], self.June_Cohort[person]["num_affected"], self.June_Cohort[person]["absent"], self.snv_file_June, self.indel_file_June, self.pedigree[0], "/home/alex/Documents/Frankie_Analysis/SOLVE_BRAIN_TEST/")
		new_person.computeParents()
		return new_person
	def test_map_return_all_true(self):
		vcf_test = vcf(self.June_Cohort["DB14-001"]["index"], self.entire_cohort, self.June_Cohort["DB14-001"]["absent"])
		vcf_test.computeParents()
		self.assertTrue(all(vcf_test.mapSearch("1/1", self.map_return_all_ONE_ONE.split('\t'))[24:]), "Map Return thought did not find all to be true searching for 1/1")
	def test_parse_parents_no_absent(self):
		vcf_test = vcf(self.proband_index_QTB[0], self.number_affected_QTB[0], self.no_absent)
		self.assertEqual(vcf_test.parseAbsentParents(), [False, False], "Parents were not recognized as absent.")
	def test_parse_parents_no_father(self):
		vcf_test = vcf(self.proband_index_QTB[0], self.number_affected_QTB[0], self.dad_absent)
		self.assertEqual(vcf_test.parseAbsentParents(), [True, False], "Father was not recognized as absent and/or mother was not recognized as present.")
 def test_parse_parents_no_absent(self):
     vcf_test = vcf(self.proband_index_QTB[0], self.number_affected_QTB[0],
                    self.no_absent)
     self.assertEqual(vcf_test.parseAbsentParents(), [False, False],
                      "Parents were not recognized as absent.")
	def test_map_return_array_length(self):
		vcf_test = vcf(self.June_Cohort["DB14-001"]["index"], self.entire_cohort, self.June_Cohort["DB14-001"]["absent"])
		vcf_test.computeParents()
		self.assertEqual(len(vcf_test.mapSearch("0/0", self.map_return_all_ONE_ONE.split('\t'))), 38)
	def test_compute_parents_no_absent(self):
		for index in range(len(self.proband_index_QTB)):
			vcf_test = vcf(self.proband_index_QTB[index], self.number_affected_QTB[index], self.no_absent)
			vcf_test.parseAbsentParents()
			self.assertEqual(vcf_test.computeParents(), [self.proband_index_QTB[index] + self.number_affected_QTB[index], self.proband_index_QTB[index] + self.number_affected_QTB[index] + 1])
	def test_map_return_all_false(self):
		vcf_test = vcf(self.June_Cohort["DB14-001"]["index"], self.entire_cohort, self.June_Cohort["DB14-001"]["absent"])
		vcf_test.computeParents()
		self.assertFalse(all(vcf_test.mapSearch("0/0", self.map_return_all_ONE_ONE.split('\t'))), "Map Return thought a 0/0 existed when it did not")
 def test_parse_parents_both_absent(self):
     vcf_test = vcf(self.proband_index_QTB[0], self.number_affected_QTB[0],
                    self.both_absent)
     self.assertEqual(vcf_test.parseAbsentParents(), [True, True],
                      "Parents were not recognized as both being absent")
	def test_compute_parents_june_cohort(self):
		for proband in self.June_Cohort:
			vcf_test = vcf(self.June_Cohort[proband]["index"], self.June_Cohort[proband]["num_affected"], self.June_Cohort[proband]["absent"])
			self.assertEqual(vcf_test.computeParents(), self.June_Cohort[proband]["parents"], "Parent indecies not computed correctly for June cohort")