def test_rhinoscleromatis(self): contigs = 'test/sequences/GCF_000163455.1.fna.gz' with tempfile.TemporaryDirectory() as tmp_dir: contigs = gunzip_contigs_if_necessary(contigs, tmp_dir) results = get_chromosome_mlst_results(self.data_dir, contigs, True) self.assertEqual(results['ST'], 'ST67 (subsp. rhinoscleromatis)') self.assertEqual(results['Chr_ST'], 'ST67')
def test_ozanae(self): contigs = 'test/sequences/GCF_900451425.1.fna.gz' with tempfile.TemporaryDirectory() as tmp_dir: contigs = gunzip_contigs_if_necessary(contigs, tmp_dir) results = get_chromosome_mlst_results(self.data_dir, contigs, True) self.assertEqual(results['ST'], 'ST90 (subsp. ozanae)') self.assertEqual(results['Chr_ST'], 'ST90')
def test_83(self): contigs = 'test/sequences/83.fasta.gz' with tempfile.TemporaryDirectory() as tmp_dir: contigs = gunzip_contigs_if_necessary(contigs, tmp_dir) results = get_chromosome_mlst_results(self.data_dir, contigs, True) self.assertEqual(results['gapA'], '10') self.assertEqual(results['infB'], '7') self.assertEqual(results['mdh'], '1') self.assertEqual(results['pgi'], '1') self.assertEqual(results['phoE'], '1') self.assertEqual(results['rpoB'], '1') self.assertEqual(results['tonB'], '35') self.assertEqual(results['ST'], 'ST160') self.assertEqual(results['Chr_ST'], 'ST160')
def test_unknown_ST(self): """ This test has exact matches for alleles but in an unknown ST combination """ results = get_chromosome_mlst_results(self.data_dir, 'test/sequences/test_mlst_3.fasta', True) self.assertEqual(results['gapA'], '44') self.assertEqual(results['infB'], '56') self.assertEqual(results['mdh'], '34') self.assertEqual(results['pgi'], '19') self.assertEqual(results['phoE'], '30') self.assertEqual(results['rpoB'], '53') self.assertEqual(results['tonB'], '55') self.assertEqual(results['ST'], '0') self.assertEqual(results['Chr_ST'], '0')
def test_chromosome_inexact(self): """ This test is is one base off from ST23 (single substitution in mdh_1 of G to A). """ results = get_chromosome_mlst_results(self.data_dir, 'test/sequences/test_mlst_2.fasta', True) self.assertEqual(results['gapA'], '2') self.assertEqual(results['infB'], '1') self.assertEqual(results['mdh'], '1*') self.assertEqual(results['pgi'], '1') self.assertEqual(results['phoE'], '9') self.assertEqual(results['rpoB'], '4') self.assertEqual(results['tonB'], '12') self.assertEqual(results['ST'], 'ST23-1LV') self.assertEqual(results['Chr_ST'], 'ST23-1LV')
def test_chromosome_exact(self): """ This test is an exact match for ST23. """ results = get_chromosome_mlst_results(self.data_dir, 'test/sequences/test_mlst_1.fasta', True) self.assertEqual(results['gapA'], '2') self.assertEqual(results['infB'], '1') self.assertEqual(results['mdh'], '1') self.assertEqual(results['pgi'], '1') self.assertEqual(results['phoE'], '9') self.assertEqual(results['rpoB'], '4') self.assertEqual(results['tonB'], '12') self.assertEqual(results['ST'], 'ST23') self.assertEqual(results['Chr_ST'], 'ST23')
def test_chromosome_random(self): """ This test has just random sequence and should give no MLST call. """ results = get_chromosome_mlst_results(self.data_dir, 'test/sequences/test_random.fasta', True) self.assertEqual(results['gapA'], '-') self.assertEqual(results['infB'], '-') self.assertEqual(results['mdh'], '-') self.assertEqual(results['pgi'], '-') self.assertEqual(results['phoE'], '-') self.assertEqual(results['rpoB'], '-') self.assertEqual(results['tonB'], '-') self.assertEqual(results['ST'], '0') self.assertEqual(results['Chr_ST'], '0')
def test_chromosome_exact(self): """ This test is an exact match for ST23. """ results = get_chromosome_mlst_results(self.mlstblast, self.data_folder, 'test/test_mlst_1.fasta') self.assertEqual(results['gapA'], '2') self.assertEqual(results['infB'], '1') self.assertEqual(results['mdh'], '1') self.assertEqual(results['pgi'], '1') self.assertEqual(results['phoE'], '9') self.assertEqual(results['rpoB'], '4') self.assertEqual(results['tonB'], '12') self.assertEqual(results['ST'], 'ST23')
def get_all_results(self, contigs): results = {'strain': get_strain_name(contigs)} results.update(get_contig_stat_results(contigs)) results.update(get_species_results(contigs, self.data_dir)) kp_complex = is_kp_complex(results) results.update( get_chromosome_mlst_results(self.data_dir, contigs, kp_complex)) results.update(get_ybt_mlst_results(self.data_dir, contigs)) results.update(get_clb_mlst_results(self.data_dir, contigs)) results.update(get_iuc_mlst_results(self.data_dir, contigs)) results.update(get_iro_mlst_results(self.data_dir, contigs)) results.update(get_hypermucoidy_results(self.data_dir, contigs)) results.update(get_wzi_and_k_locus_results(self.data_dir, contigs)) results.update( get_resistance_results(self.data_dir, contigs, self.args, self.res_headers, kp_complex)) results.update(get_summary_results(results, self.res_headers)) return results