def test_next_with_GT(self): """Parse a file which already in Genotype format""" vcf_filename = os.path.join(test_data(), 'file_with_SNPs_in_GT_format.aln.vcf') vcf_file = open(vcf_filename, 'r') reader = SNPSitesReader(vcf_file) record = reader.next() samples = record.samples samples_with_alternative_bases = [sample.sample for sample in samples if sample.data.GT != '0'] expected = ['3002_8_1', '3002_8_2', '3002_8_6', '4056_2_10', '4056_2_4', '4056_8_6', '5174_5_1', '5174_5_7', '5174_5_9', '5174_6_10', '5174_7_1', '5174_8_5'] self.assertItemsEqual(samples_with_alternative_bases, expected)
def test_next(self): """Parse a file with Alternate Base info File was cerated using snp-sites""" vcf_filename = os.path.join(test_data(), 'file_with_SNPs.aln.vcf') vcf_file = open(vcf_filename, 'r') reader = SNPSitesReader(vcf_file) record = reader.next() samples = record.samples samples_with_alternative_bases = [sample.sample for sample in samples if sample.data.GT != '0'] expected = ['3002_8_1', '3002_8_2', '3002_8_6', '4056_2_10', '4056_2_4', '4056_8_6', '5174_5_1', '5174_5_7', '5174_5_9', '5174_6_10', '5174_7_1', '5174_8_5'] self.assertItemsEqual(samples_with_alternative_bases, expected)